Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

leaderstats going into negatives?

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.

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

2 comments

0

ok, but how do i fix it?

0

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.