function comma_value(amount)
local formatted = amount
while true do
formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2')
if (k==0) then
break
end
end
return formatted
end
script.Parent.BackgroundColor3 = script.Parent.Parent.Color.Value
script.Parent.Parent.Color:GetPropertyChangedSignal("Value"):Connect(function()
script.Parent.BackgroundColor3 = script.Parent.Parent.Color.Value
end)
function comma_value(amount)
local formatted = amount
while true do
formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2')
if (k==0) then
break
end
end
return formatted
end
script.Parent.BackgroundColor3 = script.Parent.Parent.Color.Value
script.Parent.Parent.Color:GetPropertyChangedSignal("Value"):Connect(function()
script.Parent.Text = comma_value(script.Parent.Parent.Color.Value) -- call the function here
-- (assuming script.Parent is the text label)
script.Parent.BackgroundColor3 = script.Parent.Parent.Color.Value
end)