Attempt to index number with gsub

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Timer milliseconds

  2. What is the issue? Not working

  3. What solutions have you tried so far? Tweaking milliseconds, wont work

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
Code:

num = 30
min = 0
mic = 0
game:GetService("RunService").Stepped:Connect(function()
	mic -= 333
	if mic < 0 then
		num -= 1
		mic = 999
	end
	local str = "%02i"
	script.Parent.Text = string.format(str, min)..":"..string.format(str, num).."."..string.format(str, tostring(mic:gsub(".?$","")))
print()
if num == 0 and mic == 0 and min == 0 then
	workspace.B.Script.Disabled = false
	end
	end)

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

Change to tostring(mic):gsub(".?$","")

string.format(str, min)..":"..string.format(str, num).."."..string.format(str, tostring(mic:gsub(".?$","")))

the variables min and num are numbers
numbers cant be procesed by string.format.

mic:gsub(".?$","")

probaly an atempt to fix it.
jsut use

tostring(mic)

Invalid argument #2 to ‘format’ (number expected, got string)

That’s what I got from trying your soluton.

How do I fix the issue? It’s been more than 14 days.

num = 30
min = 0
mic = 0

repeat
    game:GetService("RunService").Stepped:Wait()

    mic -= 333
    if mic < 0 then
	    num -= 1
	    mic = 999
    end
    local str = "%02d"
    script.Parent.Text = string.format(str, min)..":"..string.format(str, num)..".".. string.format(str, mic)
until num <= 0 and mic <= 0

workspace.B.Script.Disabled = false
print("Done")

You don’t need to use gsub; it doesn’t include any magic characters since it’s just a number.

it doesntn remove the last character

I think i should have got a response by now