Help with restarting round when all players died

I just made an round system and i want to break the loop and restart the entire round when all players died or escaped. But i don’t know how to break an loop with events.

local server = {}
--//variables
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local VoteEvent = ReplicatedStorage:WaitForChild("VoteRemote")
local RoundRemote = game.ReplicatedStorage:WaitForChild("RoundRemote")
local Maps = ReplicatedStorage:WaitForChild("Maps")

--//modules
local terrainModule = require(game.ServerStorage:WaitForChild("ServerModules"):WaitForChild("TerrainHandler"))
local keyCreator = require(game.ServerStorage:WaitForChild("ServerModules"):WaitForChild("AccessKeyCreator"))
local Voter = require(game.ServerStorage.ServerModules:WaitForChild("MapVote"))
local AIModule = require(game.ServerStorage.ServerModules:WaitForChild("AIInitializer"))
local paperModule = require(game.ServerStorage.ServerModules:WaitForChild("PaperActorHandler"))

--//session Data
local CurrentVoter = nil
local PlayersVoted = {}
local Intermission = 10
local VoteTime = 40
local GameTime = 600
local votingStatus = nil
local serverStatus = ReplicatedStorage.ServerStatus

--//initialize some stuff
Voter.SetMapFolder(Maps)
local createdAssetKey = keyCreator.createAssetKey()
game:GetService("ServerStorage"):WaitForChild("SessionData"):WaitForChild("ServerModuleAccessKey").Value = createdAssetKey

--//local functions
function OnVote(player: Player, Key, MapName)
	if CurrentVoter == nil then return end
	local MapObj = Maps:FindFirstChild(MapName)

	if Key == "Vote" then
		local Voted = CurrentVoter:AddVote(player, MapObj)

		VoteEvent:FireAllClients("Update", {#CurrentVoter[1].Votes, #CurrentVoter[2].Votes, #CurrentVoter[3].Votes})
	end

	if Key == "Unvote" then
		local Voted = CurrentVoter:RemoveVote(player, MapObj)

		VoteEvent:FireAllClients("Update", {#CurrentVoter[1].Votes, #CurrentVoter[2].Votes, #CurrentVoter[3].Votes})
	end
end

function loadLighting(lightingToLoad)
	local lightingSettings = lightingToLoad
	local lighting = game:GetService("Lighting")
	for i,v in pairs(lighting:GetDescendants()) do
		v:Destroy()
	end
	for i,v in pairs(lightingToLoad:WaitForChild("InLighting"):GetChildren()) do
		v:Clone().Parent = lighting
	end
	local lighting = game:GetService("Lighting")

	local function getLightingConfigFromStorage()
		local storageFolder = lightingToLoad
		if not storageFolder then
			return nil
		end

		local lightingConfig = {}
		for _, property in ipairs(lightingSettings.Lighting:GetChildren()) do
			if property:IsA("Color3Value") or property:IsA("NumberValue") or property:IsA("StringValue") or property:IsA("BoolValue") then
				if property.Name == "GlobalShadows" then
					--//globalshadows disabled for settings stuff
				else
					lightingConfig[property.Name] = property.Value
				end
			end
		end

		return lightingConfig
	end

	local function updateLightingProperties(lightingConfig)
		for property, value in pairs(lightingConfig) do
			lighting[property] = value
		end
	end

	local lightingConfig = getLightingConfigFromStorage()

	if lightingConfig then
		updateLightingProperties(lightingConfig)
	else
		warn("cant find the lighting configuration for the map " .. lightingToLoad.Name .. ". fix it asap")
	end
end

function setAudio(mapName, status)
	if workspace and workspace:WaitForChild("Map") and workspace:WaitForChild("Map"):WaitForChild(mapName) then
		local map = workspace:WaitForChild("Map"):WaitForChild(mapName)
		local audioActors = map:WaitForChild("LoadedMap"):WaitForChild("AudioActors")
		local audioAssets = map:WaitForChild("Configuration"):WaitForChild("AudioAssets")
		local aiActor = map:WaitForChild("AIActors"):WaitForChild("AIBase")
		for i,v in pairs(audioAssets:GetChildren()) do
			if v:IsA("Sound") then
				if v.Name == "Chase" then
					v.SoundGroup = game:GetService("SoundService"):WaitForChild("SoundBusMaster"):WaitForChild("MusicSoundBus")
				elseif v.Name == "AllPapersCollectedMusic" then
					v.SoundGroup = game:GetService("SoundService"):WaitForChild("SoundBusMaster"):WaitForChild("MusicSoundBus")
				elseif v.Name == "HeartBeat" then
					v.SoundGroup = game:GetService("SoundService"):WaitForChild("SoundBusMaster"):WaitForChild("SFXSoundBus")
				else
					v.SoundGroup = game:GetService("SoundService"):WaitForChild("SoundBusMaster"):WaitForChild("SFXSoundBus")
				end
			end
		end
		for i,v in pairs(aiActor:WaitForChild("HumanoidRootPart"):GetChildren()) do
			if v:IsA("Sound") then
				v.SoundGroup = game:GetService("SoundService"):WaitForChild("SoundBusMaster"):WaitForChild("SFXSoundBus")
			end
		end
		for i,v in pairs(audioActors:GetDescendants()) do
			if v:IsA("Sound") then
				v.SoundGroup = game:GetService("SoundService"):WaitForChild("SoundBusMaster"):WaitForChild("AmbienceSoundBus")
				v.Playing = status
			end
		end
	end
end

function server.cleanup(WinningMap)
	game.ReplicatedStorage:WaitForChild("RoundRemote"):FireAllClients("ClearMap", WinningMap.Name)
	WinningMap:Destroy()
	workspace:WaitForChild("Terrain"):Clear()
	loadLighting("newDefault") --//default lighting
	setAudio(WinningMap.Name, false)

	--> Teleport Players To Lobby (Add This Yourself)
	game.ReplicatedStorage:WaitForChild("RoundRemote"):FireAllClients("ReturnLobby")
	GameTime = 0
end

function server.startGame()
	while task.wait() do
		serverStatus.Value = "intermission"
		task.wait(Intermission)
		
		RoundRemote:FireAllClients("Intermission", Intermission)
		GameTime = 600
		CurrentVoter = Voter.StartVote()
		game.ReplicatedStorage.CollectedPapers.Value = 0
		repeat task.wait() until CurrentVoter ~= nil
		VoteEvent:FireAllClients("Voting", {CurrentVoter[1].Map.Name, CurrentVoter[2].Map.Name, CurrentVoter[3].Map.Name})
		game.ReplicatedStorage:WaitForChild("RoundRemote"):FireAllClients("Voting")
		votingStatus = true
		serverStatus.Value = "voting"
		
		--//check if an player joins the game while voting
		game.Players.PlayerAdded:Connect(function(plr)
			if votingStatus == true then
				wait(2)
				VoteEvent:FireClient(plr, "Voting", {CurrentVoter[1].Map.Name, CurrentVoter[2].Map.Name, CurrentVoter[3].Map.Name})
			end
		end)
		
		task.wait(VoteTime - 10)
		game.ReplicatedStorage:WaitForChild("RoundRemote"):FireAllClients("Last10Seconds")
		wait(8)
		for i,v in pairs(game:GetService("Players"):GetChildren()) do
			if v.ClassName == "Player" then
				v:LoadCharacter()
			end
		end
		
		--//voting done
		serverStatus.Value = "votingDone"
		local Winner = CurrentVoter:GetVotedMap()
		local WinningMap = game:GetService("InsertService"):LoadAsset(tonumber(game.ReplicatedStorage.Maps:FindFirstChild(Winner[1].Name).Value))
		game.ReplicatedStorage.SelectedMap.Value = game.ReplicatedStorage.Maps:FindFirstChild(Winner[1].Name).Name
		VoteEvent:FireAllClients("VotingOver", game.ReplicatedStorage.Maps:FindFirstChild(Winner[1].Name).Name, game.ReplicatedStorage.Maps:FindFirstChild(Winner[1].Name):GetAttribute("Thumbnail"), game.ReplicatedStorage.Maps:FindFirstChild(Winner[1].Name):GetAttribute("FullName"))
		votingStatus = false
		CurrentVoter:Over()
		CurrentVoter = nil
		
		--//setup map
		local mapFolder = Instance.new("Folder")
		mapFolder.Parent = workspace
		mapFolder.Name = "Map"
		WinningMap.Parent = workspace
		for index,found in pairs(WinningMap:GetChildren()) do
			found.Parent = mapFolder
		end
		
		WinningMap:Destroy()
		WinningMap = workspace:WaitForChild("Map"):WaitForChild(Winner[1].Name)
		game.ReplicatedStorage:WaitForChild("RoundRemote"):FireAllClients("VotingOver", WinningMap.Name, WinningMap:WaitForChild("Configuration"):WaitForChild("Thumbnail").Image,  WinningMap:WaitForChild("Configuration"):WaitForChild("FullName").Value)
		setAudio(WinningMap.Name, true)
		paperModule.initializePapersNew(WinningMap)
		if WinningMap:WaitForChild("Configuration"):FindFirstChild("Terrain") then
			terrainModule.Load(WinningMap:WaitForChild("Configuration"):FindFirstChild("Terrain"))
		end
		loadLighting(WinningMap:WaitForChild("Configuration"):WaitForChild("Lighting")) --// selected map lighting
		
		game.ReplicatedStorage.LivePlayers.Value = game.ServerStorage.SessionData.PlayerCount.Value
		serverStatus.Value = "loadingAllClientsPreround"
		
		game.ReplicatedStorage:WaitForChild("RoundRemote"):FireAllClients("PreloadMap", WinningMap.Name)
		AIModule.mapLoaded(WinningMap)
		workspace:WaitForChild("ReplicatedAudioActors"):WaitForChild("AmbienceEmitterAudioActor"):WaitForChild("AudioEmitter"):WaitForChild("Music"):Pause()
		task.wait(2)
		for i,v in pairs(WinningMap:WaitForChild("LoadedMap"):GetDescendants()) do
			if v.ClassName == "Sound" and v:GetAttribute("CanPlayStartup") then
				v.SoundGroup = game:GetService("SoundService"):WaitForChild("SoundBusMaster"):WaitForChild("SFXSoundBus")
				v:Play()
			end
		end
		game:GetService("SoundService").AmbientReverb = game.ReplicatedStorage.Maps:FindFirstChild(WinningMap.Name):GetAttribute("AmbientReverb")
		
		game.ReplicatedStorage:WaitForChild("RoundRemote"):FireAllClients("TeleportPlayer",  WinningMap.Name)
		wait(2)
		serverStatus.Value = "roundBefore"
		game.ReplicatedStorage:WaitForChild("RoundRemote"):FireAllClients("RoundBefore")
		wait(40)
		game.ReplicatedStorage:WaitForChild("RoundRemote"):FireAllClients("RoundStarted")
		serverStatus.Value = "inRound"
		AIModule.roundStarted(WinningMap)
		game.ReplicatedStorage.CountdownTimeRemote.CountdownBindable:Fire("StartCounting")
		game.ReplicatedStorage.CountdownTimeRemote:FireAllClients("StartCounting", WinningMap.Name)
		game.ServerStorage.SessionData.CollectedPapers.Value = 0
		wait(1)
		local paperActors = paperModule.spawnPapersNew(WinningMap)
		game.ReplicatedStorage.FPSRemote:FireAllClients("RoundStarted", WinningMap:WaitForChild("AIActors"), paperActors)
		wait(4)
		workspace:WaitForChild("ReplicatedAudioActors"):WaitForChild("AmbienceEmitterAudioActor"):WaitForChild("AudioEmitter"):WaitForChild("Music"):Resume()
		--> Game Time
		task.wait(GameTime)
		
		server.cleanup(WinningMap)
		
	end
end

function server.breakRoundLoop()
	--// here???
end

function server.livePlayersChanged(WinningMap)
	if game.ReplicatedStorage.LivePlayers.Value == 0 then
		server.cleanup()
	end
end

return server

its an module script btw