How can I restart a while loop?

Hello,
So, I’m making a game inspired to piggy, and I’m checking if all the players left in a while loop.
Code:

coroutine.wrap(function()
	while true do
		repeat wait() until #WaitingPlayers >= 1
		
		wait()
		
		
		for i = IntermissionTime,0,-1 do
			if #WaitingPlayers < 1 then break end
			game.ReplicatedStorage.Values.IntermissionTime.Value = 'Intermission ('..i..')'
			wait(1)
		end
		
		if #WaitingPlayers < 1 then  end
	end
end)()

Where I put:

if #WaitingPlayers < 1 then  end

I want to restart the while loop from the beginning, how is this possible?

1 Like

continue inside your if check will reset the loop (since it’s infinite and does not change any global variables).

4 Likes