How can i abbreviate the leaderstats?
This Should be 17.2T and not 17,200B.
I can abbreviate everything else but leaderstats.
This is how i abbreviate guis:
local AbbreviateNumber = require(game.ReplicatedStorage.AbbreviateNumber)
while (1) do
wait()
local number = game.Players.LocalPlayer.leaderstats.Cash.Value
script.Parent.Text = number
local text = AbbreviateNumber:Abbreviate(number)
script.Parent.Text = text
end
Thats the Abbreviation script in RS:
local AbbreviateNumber = {}
local abbreviations = {
N = 30;
O = 27;
Sp = 24;
Sx = 21;
Qn = 19;
Q = 16;
T = 13;
B = 10;
M = 7;
K = 4
}
function AbbreviateNumber:Abbreviate(number)
local text = tostring(math.floor(number))
local chosenAbbreviation
for abbreviation, digits in pairs(abbreviations) do
if #text >= digits and #text < (digits + 3) then
chosenAbbreviation = abbreviation
break
end
end
if chosenAbbreviation then
local digits = abbreviations[chosenAbbreviation]
local rounded = math.floor(number / 10 ^ (digits - 2)) * 10 ^ (digits - 2)
text = "" .. string.format("%.1f", rounded / 10 ^ (digits - 1)) .. chosenAbbreviation
else
text = "" .. number
end
return text
end
return AbbreviateNumber
I would appreciate any help.