I made a money Gui that displays the amount of currency a player has from leaderstats. Well I ran into a problem where the amount of 0’s gets very high in the bigger numbers. I was wondering if anyone could help me insert this 0 shortner into the currency Gui.
Number to Suffix
local suffixes = {"K", "M", "B", "T", "Q", "Qu", "S", "Se", "O", "N", "D"}
local function toSuffixString(n)
for i = #suffixes, 1, -1 do
local v = math.pow(10, i * 3)
if n >= v then
return ("%.0f"):format(n / v) .. suffixes[i]
end
end
return tostring(n)
end
Currency Gui
local stats = game.Players.LocalPlayer.leaderstats:FindFirstChild("Coins")
stats.Changed:Connect(function()
script.Parent.Text = stats.Value
end)
It would help if you actually tried debugging your own code instead of reposting it so many times then and maintaining a single thread. This is something that you could’ve reviewed your own code for.
Please don’t spam the forums with the same thread, In the future post only 1 thread if your still confused after debugging and using other resources such as developer.roblox.com, rblxlua.com, rblxforum.com, Scripting Support - Developer Forum | Roblox other friends from others using the same problem or similar persay, Free Models toolbox. Then post a thread, It’s what I do reduces amount of spam threads being posted & so its not spammed.
yeah well it could help if people on the forum could actually help. Also I’m not a scripter, I just wrote this script on my own for a game I’m working on. I’m a builder, not that good at debugging.