Hello! I’m Trying to make a Text on the Screen what displays how much Coins you just got (No Leaderboard ) If I do
game.Players.LocalPlayer.Currency.Coins.Changed:Connect(function(v)
script.Parent.Text = v
end)
It will show the Value. But not how much changed! I wan’t it to be like I have 23 Coins and if you get 1 Coin The Text Says (1) Instead of 24! Is there any way to detect this? And This should be an IntValue!
local current = 0
game.Players.LocalPlayer.Currency.Coins.Changed:Connect(function(v)
script.Parent.Text = v - current
current = script.Parent.Text
end)
You cast an integer to a string and then assign it to a value that should be an integer potentially resulting in erroneous behavior.
You assign the value of current to the difference between the new value and the current value. This will work correctly the first time Coins changes, but every subsequent change will be wrong.