How would i make a large number have commas?

Uh seems to work fine for me. Here is an example with the correct result.

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

local NumberWithCommas = 1000000

print(comma_value(NumberWithCommas))
9 Likes