How to add big numbers to a leaderstats value

Hello, I am doing a simulator game and I have very big numbers (Going to hundreds of zeroes) and I don’t know how to make advanced items that add massive amounts of strenght every click. I haven’t really got an idea on how to add those amounts of strenght but anything could help.

What’s exactly the issue? Making calculations with large numbers or displaying them?

1 Like

I think he meant Number Abbreviations,
but I myself don’t know how they work. :sweat_smile:

(edit: just misspelled one word!)

If you plan on adding hundreds of 0’s you may run into floating point errors. The maximum 64 bit int is 9,223,372,036,854,775,807. This can be bypassed using strings to store the data instead of integers but it’s a little annoying when you start trying to preform math on these strings as you have to compute in chunks so you don’t overflow. For addition and subtraction this isn’t too bad to do as you can just add in splits instead of all at once. Multiplication can be achieved by repeating the addition function multiple times in a row as that is essentially what multiplication is. Division can be accomplished with not too much effort if you plan on including remainders but if you want to fully divide it’s a bit harder.

As for displaying it just use a string instead of an int for your leaderboard value. If you want to display 100 billion you can do 100B instead of 100,000,000,000.

1 Like