Add commas to numbers

Hey, how do I make a TextLabel display commas to numbers? (like 1,000, 100,000, 1,000,000, 10,000,000 etc.)

1 Like

This might help you.

The script he provided did nothing.

You need to do it by yourself.

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

label.Text = comma_value(MoneyAmount)