Help with fixing stopwatch/timer

I want to create a timer for an obby game that I am making. It would look like 00:00.00 and starts on a remote event in a localscript.

The problem is that I can’t figure out how to make the milliseconds only show the numbers right of the decimal. So, right now it would look like this for example: 3:07.0.33

I tried looking into how to use string.format() on DevForum but I didn’t understand at all.

This is the localscript for the timer:

	local Finished = game.Workspace:FindFirstChild(button.Name).Finish.Finished
	print("Timer Started")
	local milliseconds = 0
	local seconds = 0
	local minutes = 0
		print("New Cycle")
			milliseconds = milliseconds + 0.03
			if seconds < 10 then
				button.Parent.Parent.Board.SurfaceGui.WhereamITime.Text = (minutes..":0"..seconds.."."..milliseconds)
				button.Parent.Parent.Board.SurfaceGui.WhereamITime.Text = (minutes..":"..seconds.."."..milliseconds)
		until milliseconds >= 0.99
			seconds = seconds + 1
			milliseconds = 0
			if seconds == 60 then
				minutes = minutes + 1
				seconds = 0
	until Finished.Value == true
	print("Timer Stopped")

I’m not too familiar with string.format either, although I was able to find a similar post explaining formatted timers using string.split to get the milliseconds.

I’ll check it out and see if it helps. Thanks.

1 Like

Nevermind, I just figured out a simpler way to do it. Thanks for your help anyways!