Abbreviated leaderboard

Since NumberValues can only go up to septillion, my friend told me I should make an abbreviat-or since I have big numbers like quadrillion and quintillion.

I’ve tried but I can’t find anything that can help me with this. The reason why I wanted to fix this is because there is the thing will say you have like-9.838593e+18 and that looks bad to the eye.

This tutorial will explain :)))

2 Likes

I’d do this by using logarithms of 1000.

Something like this:

local abbreviations = { 'K', 'M', 'B', 'T' };
function shorten(value)
   if value < 1000 then
        return tostring(value);
   end;
   local p = math.min(math.floor(math.log(value, 1000)), #abbreviations);
   return ('%.1f'):format(value / (1000 ^ p)) .. abbreviations[p];
end;