Uncapped Leaderboards

Basically - I want to make my leaderboards not be stuck at 9.223qn, I can do this by saving the value dividing it by 10, and multiplying what is displayed by 10 and it’ll now be 92.223qn and so on. However, this would make the minimum amount of that stat needed, now 10.

So my idea was:

function gatherMath(amount)
if amount > 1e7 and amount < 1e8 then
return 10
end
if amount > 1e8 and amount < 1e9 then
return 100
end
if amount > 1e9 and amount < 1e10 then
return 1000
end
end

However, this would only work for so many numbers - how could I make this faster (without typing every if statement)?

Solved! Made this function:

function getMultiplier(amount)
	local digits = #tostring(amount); -- gets the # of digits in number
	
	if amount >= 92000000000000000000 then -- 9Qn (original cap)
		local newNumber = digits * 10; -- multiplies it by 10 to make sure its always enough
		return newNumber; -- returns the multipler
	else
		return 1; -- number smaller than normal cap - returns 1
	end
end

Left comments for anyone else who wants to learn off this. :smile: