I want to know how do you make 1000 1,000 and 10000 10,000
2 Likes
Use the If function
local Num = 1000
local ui = script.Parent.Text
if Num == 1000 then
ui = "1,000"
end
and u can split it i think if its above 1000 and u want to get the hundreds unit.
1 Like
You can use string.gsub with patterns for that (example):
local function fnumber(x)
x = tostring(x)
return x:reverse():gsub("%d%d%d", "%1,"):reverse():gsub("^,", "")
end
print(fnumber(1000)) --> output: 1,000. Also works with huge numbers such as 10000000000
References:
1 Like
but if have a 100 numbers, do i need to type if 100 then
if 100 then
if 1000 then
if 10000 then
if 100000 then
if 1000000 then
if 10000000 then
if 100000000 then
if 1000000000 then
is there any easy way?
1 Like