Text GUI Animation

Hi there! How would i go about making a animation on a textlabel when i get coins etc. (For eg. Bubble Gum Sim where the coin value gui has an animation that shows a change in value)

1 Like

For moving a text label, you should use :TweenPosition()

Check out the GUI Animations page for additional information and code samples on animating the position and size of GUI objects.

20190331_100040

sorry if i didn’t phrase that correctly. Look at the gems ui when i collect the chest. How would i achieve that “animation”

To animate your text, you could consider using a For Loop. If your TextLabel consists of only numbers, you can use a For Loop to add to your currency value until you have reached the desired amount. Here’s an example inside of a Part:

local newcoins = 10 --The total number we want to add.
for i = 1, 5 do --The second number should be the number of segments you want to divide the adding 'animation' into. This example divides the number into 5 "segments."
  script.Parent.CoinValue.Value = script.Parent.CoinValue.Value + (newcoins/5) --Add the coins in segments.
  wait(0.2) --How long we want to wait in between each segment. Smaller time = smoother and quicker.
end

I believe TweenService will help you with this case.

@Froredion It would, if this didn’t pertain to changing the value of text.

The thread’s title confused me, since it asked for Gui animation and not a text effect. That isn’t really animation, that’s a text effect. An animation would be something more akin to tweening.

You’ll definitely need to look into the usage of a For Loop. Have the server determine how much currency is being added and send that over to the client. The client would then split that number into segments and then add it up each time. So basically what SFranxisco posted, though a little change:

local receivedCoins = 10
local addSegments = 5

for i = 1, addSegments do
    someValue = someValue + (receivedCoins/addSegments)
    -- something else
end

Didn’t test this so I don’t actually even know if this is okay. I kind of just took SFran’s code and refurbished it a little bit.

4 Likes