How to get the amout of the COINS of player?

Hello!
How can I know the amount of the coins of the player?
I’m using Verse.
Thank you !

Using the conditional_button_device, use .GetItemCount(:agent, :int) to get the amount of the item the agent has. Here is a quick example:
You fisrt declare a variable of type conditional_button_device

@editable GoldCounter: conditional_button_device = conditional_button_device{}

Then you create a function using .GetItemCount(:agent, :int)

CountGold(Agent: agent): void=
     # Assuming you only inserted gold in the button so the index of gold is 0
     Amount:= GoldCounter.GetItemCount(Agent, 0) 
     Print("{Amount}")
1 Like

Thank you for your reply.
I tried to do this allday but Its not working for my code…
Everytime I just getting the number *2147483647 always(maximum of the integar)
Is the conditional button shoud be inserted 1 coin right?

Yes you need the insert the coin inside the conditional button so the verse program knows what to count

Yes thank you but Its still not working.
Its just keep showing me this number and I challenged alot.
image

I have just tested it and yes I’m getting the same error. It appears that this method is bugged at the time.

You need to disable Infinite Resources in your Island Settings

4 Likes

It worked!!
Thank you very much!!

1 Like

Any ideas on how to display the resource count with commas for example: 5,000,000. I found an example code snippet but I’m not sure how to implement it.

code example here: Functions to work with ridiculously big numbers. | Uefn Code Snippet