For loop for timer

I’m trying to make a timer that uses a for loop, I got the timer working but, if I call the function while the timer is running it glitches, it switches between the two times.

Please help!

System.Start_Timer = function (Time : number)		
		
for i = Time, 0, -1 do task.wait(1)
		
local Time_Txt = i
		
for i, v in pairs(game.Players:GetChildren()) do
			
v.PlayerGui.Main.Frames.Timer.Timer.Text = Time_Txt			
			
end		
		
end
	
end
1 Like

Then just don’t call it? Or just add a debounce so the function would only run when the debounce variable is true.