Can't add a small number to my numbervalue

Well basically my numbervalue value is 682414565312878483175636992 if I try to add one so it becomes 682414565312878483175636993 it just turns back to the old number on the other side if I change it to bacome 782414565312878483175636992 or change the sixth number it works perfectly 682415565312878483175636992

Switch to a StringValue. Lets you use larger numbers and should fix that bug you’re having.

3 Likes

Still does the same thing even though I used a string value.

Show me what you are doing exactly.

you can try it for yourself, make a numbervalue make 1 Button that gives 1SP of the currency, click it a couple times, then click another button which gives a low amount like 1 for example, the amount won’t be changing, it will just keep reverting back to the big number unless you click the 1SP button again

Pretty sure its a roblox bug at this point

It’s not a bug per se, it is the way floating point numbers work, see: Double-precision floating-point format - Wikipedia

Precision goes down the further away you go from 0 and the largest Integer you can safely store in lua is 2^53 or 9,007,199,254,740,992, anything larger than and you don’t have enough precision to store every Integer accurately anymore.
See:

print(2^53-1-2^53 == 0) --this will print false
print(2^53+1-2^53 == 0) --this will print true
2 Likes

And is there a way to get over that

Not easily if you want to do math with it and you shouldn’t even need that much precision to begin with.

1 Like

You’re right, okay thanks for the information I’m not that good at math :grinning_face_with_smiling_eyes:, I was just wondering.