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:

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

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!