Counting Effect not working!

The title says it all lol

local TweenService = game:GetService("TweenService")

function AnimateNumber()
	local n = game.Players.LocalPlayer.leaderstats.Worms
	TweenService:Create(script.Parent.Displayer.TextLabel, TweenInfo.new(0.5), {Text = n.Value}):Play()
end


game.Players.LocalPlayer.leaderstats.Worms.Changed:Connect(function()
	AnimateNumber()
end)

I dont think tweens work with text. You’d need to have a 2nd fake value thats used just for the text, and whenever the Worms changes, increase the fake value by 1 or however much you want to go up until its the same, like

repeat
      wait()
      2ndValue += 1
      script.Parent.Displayer.TextLabel.Text = 2ndValue
until 2ndValue == game.Players.LocalPlayer.leaderstats.Worms.Value

i see 2 errors in your script,
the first one’s the script’s a local one. (and the Changed funciton wont work in client)

the second one’s that you have to use math.floor() in the n.Value thingy, so it wont tween the number to numbers like 4.4435353425

how do you know decimals/fractions will be used?

cuz you’re tweening a number so math.floor() will fix the issue

not all numbers are fractions, I don’t get your point
math.floor() is only needed for fractions and I don’t see where they said fractions are used

tween a number and you’ll get the point
ig you never did that before huh

if you tween 1 into 2 yea it is a fraction while tweening

but my point was that the starting number is probably not a fraction and instead an integer
I thought you meant to tween that even tho you wouldn’t need to

I misread that and now I know you mean to floor the number while it is being tweened, so to answer your question I have tweened a number before and I really only misread your replys

honestly tho they shouldn’t be using tweening for a counting effect

1 Like