Help with NumberValue tween

Hiya,

I’m having a slight problem with tweening a NumberValue. When the value is tweened, it gets from value A to value B but during the transition, but it goes through extremely long decimals which make many things buggy, for instance, the leaderstats and my gui:

There are many more things that break due to this, any solution would be appreciated.

Code

The code that updates the actual value in the leaderstats folder:

MoneyStore:OnUpdate(function(NewMoney)
	TweenService:Create(MoneyValue, TweenInfo.new(1), {Value = NewMoney}):Play()
end)

Code of the cube for context:

script.Parent.ClickDetector.MouseClick:Connect(function(Player)
	local Money = DataStore2("Money", Player)
	Money:Increment(15)
end)

Code of the Gui:

Money.Changed:Connect(function(NewValue)
	MoneyLable.Text = "$"..tostring(Money.Value)
end)

I need the value to gradually increase/decrease without going through decimal values.

for this, I recommend using math.round which should work pretty well.

MoneyLable.Text = "$"..tostring(math.round(Money.Value))
2 Likes

This only fixes the issue with my GUI but thanks!

Try using “Math.round()” for the GUI that displays the cash amount!