I'm trying to make a script that changes a gui text to show "1m" instead of "1000000" as it's more neater and easier to read. I found a script that I could use but I'm not exactly 100% sure on how to use it on a gui text, here's the script in my gui:
script.Parent.Text = game.Players.LocalPlayer.leaderstats.Cash.Value
while true do
wait(0.1)
script.Parent.Text = game.Players.LocalPlayer.leaderstats.Cash.Value
end
Here is the script I found but I tried using but couldn't get it to work:
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
script.Parent.Text = toSuffixString(game.Players.LocalPlayer.leaderstats.Cash.Value)
If you know how fix this, please let me know.

3 comments
The script you found is self explanatory, you just put the number in and it gives you the number with the suffix back. All you had to do was test it.
Also, make sure Cash is a string value
How do I do that?