So, to learn about IntValues I made this little script.
local Amount = game.Workspace.Amount.Value
while wait (1) do
Amount = Amount + 1
print (Amount)
end
But what happens is that the value in workspace doesn’t change at all, while the output begins counting up (1, 2, 3, etc.). The value stays at 0. What’s supposed to happen, is that the value increases by one for every second that elapses, but it just stays at 0 while the output shows what the value is supposed to be. What did I do wrong?
You set the Amount to the number stored inside of the IntValue Amount. When you increase this it increases the Amount variable and not the IntValue. To get around this you can set Amount to game.Workspace.Amount and then change the Value. This refers to the value stored inside the IntValue and changes it accordingly.
So when you are getting the “amount” variable, it just sets it to a separate number. So that amount has nothing to do with the actual value itself. So when you are adding to the amount, you are just adding to the amount variable, not the value itself. You have to set the IntValue.Value to something to make it work. So whenever you are changing a value, always do IntValue.Amount = 2. Sorry this is kind of hard to explain.