I am trying to format a number to a readable stance. Here is what I have
FormatCounter ModuleScript (This works with everything else except the PopupHandler script):
local module = {}
local abbreviations = {"", "K", "M", "B", "T", "Qa", "Qi", "Sx", "Sp"}
function module.Format(value, idp)
local ex = math.floor(math.log(math.max(1, math.abs(value)), 1000))
local abbrevs = abbreviations[1 + ex] or ("e+"..ex)
local normal = math.floor(value * ((10 ^ idp) / (1000 ^ ex))) / (10 ^ idp)
return("%."..idp.."f%s"):format(normal, abbrevs)
end
return module
PopupHandler:
local FormatCounter = require(game.ReplicatedStorage:WaitForChild("FormatCounter"))
wait(2)
click = 0
local plr = game.Players.LocalPlayer
while wait() do
if click ~= plr.leaderstats.Taps.Value then
local random = math.random(1, 900)
local xnew = random / 1000
local new = game.ReplicatedStorage.ShowAdd:Clone()
new.Parent = script.Parent.PopupGui
new.Position = UDim2.new(xnew, 0, 1, 0)
new.Text = "+"..FormatCounter.Format(plr.leaderstats.Taps.Value) - click.." Taps"
click = plr.leaderstats.Taps.Value
end
end
Any help will be appreciated
Thanks
-GreenTreeGamingYT