So here the example;
Cash = 10,
Cash get added with some value,
Now Cash = 100,
Question:
How to know when the Cash value changed?
How to know how much Value that has been added to Cash?
Thank's for Reading!
So here the example;
Cash = 10,
Cash get added with some value,
Now Cash = 100,
Question:
How to know when the Cash value changed?
How to know how much Value that has been added to Cash?
Thank's for Reading!
cashbefore = game.Players.LocalPlayer.leaderstats.Cash
game.Players.LocalPlayer.leaderstats.Cash.Changed:Connect(function() -- if a property is changed on the value
print(tonumber(game.Players.LocalPlayer.leaderstats.Cash) - tonumber(cashbefore)) -- prints the cash how many it added
cashbefore = game.Players.LocalPlayer.leaderstats.Cash -- updates the cash currently
end)
Mistake some people will do: Value.Value.Changed, Value:Changed or any kind.
This discussion is preserved as it was. New answers, comments, and votes are closed.
11 comments
thank you Xapelize, u are my true Savior ;-;
btw what tonumber do?
Change the string to number! Like a string value's value is a string, so you can convert it to numbers if you type numbers inside!
oo
i try this but not working ;-; = local Added = tonumber(player:WaitForChild("leaderstats").Coin) - tonumber(cashbefore)
can you help me?
can you help me?
Are you sure the name is Coin? If it is, then the Coin value is probably nil?
Also, I think you can't make a math with variables using local
just print it,
ow ok