:I'm making a clicker game where you make in-game currency, and the numbers will be getting quite high, in the billions or so. Is there any way I could use symbols to account for some of the numbers in order to make them more readable? For instance, if we had 21,500,000,000 (21.5 Billion), it would say something like 21.5B? I don't have much experience with getting specific characters in values and such so how would this be achieved?
I just found this. Not sure if it works.
function ConvertShort(Filter_Num) local x = tostring(Filter_Num) -- This is the number you want changed if #x>=10 then local important = (#x-9) return x:sub(0,(important)).."."..(x:sub(#x-7,(#x-7))).."B+" elseif #x>= 7 then local important = (#x-6) return x:sub(0,(important)).."."..(x:sub(#x-5,(#x-5))).."M+" elseif #x>=4 then return x:sub(0,(#x-3)).."."..(x:sub(#x-2,(#x-2))).."K+" else return Filter_Num end end
To use this, just put this anywhere below the function in your script when you need it. It makes a variable with the new form.
local ShortCash = ConvertShort(Your number goes here)