Is there an easy way to do this?

So my game has very big numbers. And I have to check if player has more than 10^21 or 10^18 or 10^15 or 10^12 or 10^9 or 10^6 or 10^3 or less than 10^3 points. And this ends up in tens of lines of code. Is there a way that i can optimize this?

1 Like

you could probably put them in a table and then check through the table

you would have 2 tables, one will be if the player has more points, and the other will be if they have less

local moreThan = {"10^21", "10^18", "10^15", "10^12", "10^9", "10^6", "10^3"}
local lessThan = {"10^3"}
1 Like

I have a different situation for each one. If they have more than 10^21 then do A if they have mroe than 10^18 do B if they have mroe than 10^15 do C etc.

1 Like

Search around on the forum for formatting big numbers, it gets asked all the time so there should be lots of suitable answers already

1 Like