I'm Trying To Figure Out How I would go about formatting a large number to the shorter version by appending 'K' or 'M' using Lua. Example:
1000 = 1K
1254 = 1.2K
1000000 = 1M
1200000 = 1.2M
I Already Have The Script Here But I Don't Know How To Continue It, Thanks. Script:
while wait(0.1) do
if game.Players.LocalPlayer.leaderstats.Coins.Value > 1000 then
local shortAmt = tostring(game.Players.LocalPlayer.leaderstats.Coins.Value / 1000) .. "K"
script.Parent.Text = " " .. shortAmt
else
script.Parent.Text = " "..game.Players.LocalPlayer.leaderstats.Coins.Value
end
end
For Example :
while wait(0.1) do
if game.Players.LocalPlayer.leaderstats.Coins.Value > 1000 then
local shortAmt = tostring(game.Players.LocalPlayer.leaderstats.Coins.Value / 1000) .. "K"
script.Parent.Text = " " .. shortAmt
else
local shortAmr = tostring(game.Players.LocalPlayer.leaderstats.Coins.Value / 1000000) .. "M"
script.Parent.Text = " " .. shortAmr
game.Players.LocalPlayer.leaderstats.Coins.Value
end
end

2 comments
Is this what you want?: https://devforum.roblox.com/t/most-efficient-way-of-converting-a-number-in-scientific-notation-into-a-suffix-and-back/178431
no, I want it like my script