Simplest way to do this is by doing while wait loop checking.
Instead of using while wait() do in your script use Instance:GetChangedPropertySignal
Read more here:
Example Script:
local player = game.Players.LocalPlayer
local suffixes = {
"K",
"M",
"B",
"T",
"Qd",
"Qn"
}
player:WaitForChild("leaderstats").Coin:GetChangedPropertySignal("Value"):Connect(function()
local number = player:WaitForChild("leaderstats").Coin.Value
local count = 0
while number / 1000 >= 1 do
number = number / 1000
count = count + 1
end
if count == 0 then
script.Parent.Text = number
return false
else
script.Parent.Text = string.format("%.2f", number/10*10) .. suffixes[count]
end
end
The idea of this script is that the script will divide your number until it's not greater or equal to 1. Then the script will choose an appropriate suffix for the number.
1 comment
oof, feel dumb cuz, before I knew about math.floor function I use if statements for this