i have a leaderstats called Clicks, when i get somewhere around 2.1 mil clicks, it goes into negatives. im not requesting a script here, just wondering why it goes into negatives.
COMMUNITY QUESTION
leaderstats going into negatives?
1 answer
Integers.
Specifically, signed integers. IntValues use 32-bit signed integers which have a maximum range from -2,147,483,648 to 2,147,483,647. What this means for you is that when you hit 2,147,483,647 and try to add 1, an integer overflow happens and it wraps around to the lowest number it has. You can have a similar effect by subtracting 1 from -2,147,483,648
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
ok, but how do i fix it?
Don't go over 2,147,483,647 isn't that obvious? If you need, store your number in a StringValue instead or just keep it in the script.