How To Make Money Value Appear After Touching A Coin / Treasure

Hello All,

When a player touches a coin in my game, the coin gets destroyed and the player is awarded the value of the coin…say +10. How can I make the words +10 appear at the coin location, right after the coin disappears?

My current idea is to add to the coin a transparent part with a TextLabel “+10” text that becomes visible after the coin is touched. That complicates matters as destroying the coin has to be postponed. Plus the gold coin has to be made invisible and can’t touch until +10 is done being displayed.

Is there another, better way to accomplish this?

1 Like

You would use Instance.New("SurfaceGui) and then put a TextLabel inside of that (with all your customizations) and then destroy the surface gui after how ever long.

Where is the SurfaceGUI being added to, the invisible part or the coin?

If you add a part with Surface GUI it would complicate the thing.
Instead, the moment the player touched the coin you can Instance a surface gui and depending on how long you want it to wait and destroy it or you can use the Debris Service as well which would be making the work a little bit clearer

What will be set as the parent of the SurfaceGUI? I assume its position would be the position of the coin.

You could try using a BillboardGui

Would the BillboardGui be parented by the coin? If it is, then the BillboardGui would be destroyed when the coin is destroyed.

You would probably need to parent it to a transparent part then, there isn’t really another way to do it.

I was able to get the result I hoped for. I don’t know if it’s the best way. To get a value to appear I cloned an invisible part into the position of the coin (actually a bubble in this game). The invisible part has visible text showing a value (+1, +2, +3). The part is scripted to be destroyed after 2 seconds. I added BodyThrust to the part to make it rise up. See the video below.

Coin.wmv (2.7 MB)

1 Like