hhello i want to make a script that turns the money into a value like this:
2500 → 2,500
i made something similar but it dosen’t work good it reverse the output:
2500 → 250,0
here is the code:
local ABX = game.Players.LocalPlayer.ABX
local First = false
function round(n, decimals) decimals = decimals or 0 return math.floor(n * 10^decimals) / 10^decimals end
function update()
local val = tostring(ABX.Value)
local s = ""
for i = 1, round(string.len(val)) do
s = s .. string.sub(val, 3 * (i - 1) + 1, 3 * i)
if string.len(string.sub(val, 3 * (i - 1) + 1, 3 * i)) >= 3 and string.len(val) > 3 * i then
s = s .. ","
end
end
script.Parent.Text = s
end
update()
ABX.Changed:Connect(function()
update()
end)
thank you for reading!