Not sure if this helps, but this is an example of how I add commas in my game.
function comma_value(amount)
local formatted = amount
while wait() do
formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)","%1,%2")
if (k==0) then
break
end
end
return formatted
end
print(comma_value(12000)) -- 12,000