Hello community, this script is an abbreviation of numbers but it does not work for me who can help me?
script - “ServerScriptService”:
local T = {"K","M","B","T","q","Q","s","S","O","N","d","U","D"}
local function formatNumber(n)
if not tonumber(n) then return n end
if n < 10000 then return math.floor(n) end
local d = math.floor(math.log10(n)/3)*3
local s = tostring(n/(10^d)):sub(1,5)
return s.." "..tostring(T[math.floor(d/3)])
end
You never actually called the formatNumber function
local T = {"K","M","B","T","q","Q","s","S","O","N","d","U","D"}
local function formatNumber(n)
if not tonumber(n) then return n end
if n < 10000 then return math.floor(n) end
local d = math.floor(math.log10(n)/3)*3
local s = tostring(n/(10^d)):sub(1,5)
return s.." "..tostring(T[math.floor(d/3)])
end
print(formatNumber(95000000))
-- > 95 M