Loop script acting weird

I have script that contain multiple loops and all of them working fine execpt …

this two function:

if self.FinishRound ~= true then
		return
	else
		
		if #self.InLobby < 1 then print("[Server Waiting] : No Player Available") task.wait(2) Timer.Value = ("No Available Player") repeat task.wait(1) until #self.InLobby >= 1 end	

		task.wait(2)

		self.InRound = {}
		self.Participants = {}
		self.Winner = {}

		--self.FinishRound = false
		self.Reward = 0

		for _ , players in pairs(Players:GetPlayers()) do

			--players:SetAttribute("CoinsCollected" , 0)
			players:SetAttribute("TimeSurvival" , 0)
			self:InsertPlayerToTable(self.InLobby , players)
		end

		print("[Server Initialize] : New Round")

		for i = self.IntermissionTime , 1 , -1 do

			Timer.Value = tostring(("Intermissions : %i "):format(i))
			task.wait(1)

		end
			
	end

this is the Intermission

self.FinishRound = false
	
	Values:SetAttribute("GameFinished" , true)
		for i = self.GameOverTime , 1 , -1 do
		Timer.Value = ("Game Over!")
		SoundService.Alaram:Play()
		task.wait(1)

	end
	for k , winner in pairs(self.InRound) do
		self:InsertPlayerToTable(self.Winner , winner)
	end

	SoundService.Alaram:Stop()
	self:CleanUp()
end

This is the Game Over

this both function is colliding with each other for some reasons . But when I tried it with my times up function it didnt collide with the intermission script.

so I have no idea what is causing my game over function with my intermission function script.
Any help is appreciated :smile:

I cannot gather much information about your script, but I would like to note that anytime you wait and a condition changes, code like this will continue unless you check it again after waiting. Something like this is likely your error.