so im making a single player tycoon game and im adding cash suffixes. I mean like when you have 1 000 000 money, instead of displaying 1 000 000 its gonna show you 1M.
Everything works perfectly, but when i get a number like 1 839 918, instead of 1.83M I get 1.839918M. Is there any way to round numbers after a comma?
My english isnt really good but i hope you understand my issue. Heres the script, i dont know if its gonna help but ima just put it here:
local Money = script.Parent.Money -- text gui which displays the money
while true do
wait()
local playersmoney = game.Players.LocalPlayer.leaderstats.Cash.Value -- players money
if playersmoney > 0 and playersmoney < 1000 then
Money.Text = playersmoney
elseif playersmoney > 999 and playersmoney < 1000000 then
Money.Text = playersmoney / 1000 .."K"
elseif playersmoney > 999999 and playersmoney < 1000000000 then
Money.Text = playersmoney / 1000000 .."M"
end
end

6 comments
Thanks!
this version works, but it displays 14.5M as 1.4B, doesnt display T, and probably some more things
That shouldn't happen, I probably made some mistakes. I'll take a look.
Ok
the suffixes are just kinda glitchy
ok i fixed it myself