How do I cancel this loop?

I don’t know how to cancel this, need help. I want to cancel it when the for loop for the timer of the round detects that the cowboy table or sheriff table have no players because they all died.

while true do
	if ingame == false then
		while true do
			wait(1)
			local plyrs = game.Players:GetChildren()
			if #plyrs < 2 then
				for i, plyr in pairs(plyrs) do
					if plyr then
						plyr.PlayerGui:WaitForChild("Status").Frame.TextLabel.Text = "Not Enough Players"
					end
				end
			elseif #plyrs >= 2 then
				ingame = true
				for i, plyr in pairs(game.Players:GetChildren()) do
					if plyr then
						plyr.PlayerGui:WaitForChild("Status").Frame.TextLabel.Text = "Starting"
					end
				end
				for i, plyr in pairs(plyrs) do
					plyr.Team = game.Teams.Playing
				end
				wait(3)
				local rdmplyr = game.Teams.Playing:GetPlayers()[math.random(1,#game.Teams.Playing:GetPlayers())]
				table.insert(cowboy,rdmplyr)
				local tool = game.ReplicatedStorage.RevolverTool:Clone()
				for i, plyr in pairs(cowboy) do
					plyr.Character.HumanoidRootPart.Position = workspace.SaloonPVPPrototype.CowboySpawns:GetChildren()[math.random(1,#workspace.SaloonPVPPrototype.CowboySpawns:GetChildren())].Position+Vector3.new(0,2,0)
					plyr.Character.clientside.Disabled = false
					if not plyr.Backpack:FindFirstChild(tool) or plyr.Character:FindFirstChild(tool) then
						tool.Parent = plyr.Backpack
						tool:WaitForChild("Equip"):FireClient(plyr)
						plyr.Character.Humanoid:EquipTool(tool)
					end
				end
				for i, plyr in pairs(game.Teams.Playing:GetPlayers()) do
					if plyr ~= rdmplyr and plyr.Name ~= rdmplyr.Name then
						table.insert(sheriffs,plyr)
						local tool = game.ReplicatedStorage.RevolverTool:Clone()
						if not plyr.Backpack:FindFirstChild(tool) or plyr.Character:FindFirstChild(tool) then
							tool.Parent = plyr.Backpack
							tool:WaitForChild("Equip"):FireClient(plyr)
							plyr.Character.Humanoid:EquipTool(tool)
							end
						end
					end
					for i, plyr in pairs(sheriffs) do
						for i, spawnn in pairs(workspace.SaloonPVPPrototype.SheriffSpawns:GetChildren()) do
							plyr.Character.HumanoidRootPart.Position = spawnn.Position+Vector3.new(0,2,0)
							plyr.Character.clientside.Disabled = false
							end
				end
				for i, plyr in pairs(game.Players:GetChildren()) do
					plyr.PlayerGui:WaitForChild("Status").Frame.TextLabel.Text = "The Cowboy is Preparing"
				end
				wait(5)
				for count = 30,1,-1 do
					for i, plyr in pairs(game.Players:GetChildren()) do
						plyr.PlayerGui:WaitForChild("Status").Frame.TextLabel.Text = count-1
					end
					wait(1)
				end
				


				for i = 1, #"Sheriffs...FIRE AT WILL!!!!" do
					for v, plyr in pairs(game.Players:GetChildren()) do
						plyr.PlayerGui:WaitForChild("Status").Frame.TextLabel.Text = string.sub("Sheriffs...FIRE AT WILL!!!!",1,i)
						wait(0.15)
					end
				end
				wait(2.5)
				for i, blocker in pairs(workspace.SaloonPVPPrototype.Blockers:GetChildren()) do
					blocker.CanCollide = false
				end
				for count = 600,1,-1 do
					wait(1)
					for i, plyr in pairs(game.Players:GetChildren()) do
						plyr.PlayerGui:WaitForChild("Status").Frame.TextLabel.Text = count-1
					end
					if isEmpty(cowboy) == false then
						for v, plyr in pairs(game.Teams.Playing:GetPlayers()) do
							if plyr.Character:FindFirstChild("RevolverTool") then
								for i, tool in pairs(plyr.Character:GetChildren()) do
									if tool:IsA("Tool") then
										tool.discon:FireClient(plyr)
										tool:Destroy()
									end
								end
							end
							if plyr.Character:FindFirstChild("RevolverTool") then
								for i, tool in pairs(plyr.Character:GetChildren()) do
									if tool:IsA("Tool") then
										tool.discon:FireClient(plyr)
										tool:Destroy()
									end
								end
							end
							plyr.PlayerGui:WaitForChild("Status").Frame.TextLabel.Text = sheriffswin[math.random(1,#sheriffswin)]
							wait(5)
							plyr.Character.HumanoidRootPart.Position = workspace.SpawnLocation.Position+Vector3.new(0,2,0)
							ingame = false
							for count = 15,1,-1 do
								for i, plyr in pairs(game.Players:GetChildren()) do
									plyr.PlayerGui:WaitForChild("Status").Frame.TextLabel.Text =  "Intermission "..count-1
								end
								wait(1)
							end
	                          -- I tried putting break here but it only cancels the for loop its in, how do i cancel the actual loop so it restarts?
						end
					end
					if isEmpty(sheriffs) == false then
						for v, plyr in pairs(game.Teams.Playing:GetPlayers()) do
							if plyr.Character:FindFirstChild("RevolverTool") then
								for i, tool in pairs(plyr.Character:GetChildren()) do
									if tool:IsA("Tool") then
										tool.discon:FireClient(plyr)
										tool:Destroy()
									end
								end
							end
							if plyr.Character:FindFirstChild("RevolverTool") then
								for i, tool in pairs(plyr.Character:GetChildren()) do
									if tool:IsA("Tool") then
										tool.discon:FireClient(plyr)
										tool:Destroy()
									end
								end
							end
							plyr.PlayerGui:WaitForChild("Status").Frame.TextLabel.Text = cowboywin[math.random(1,#cowboywin)]
							wait(5)
							plyr.Character.HumanoidRootPart.Position = workspace.SpawnLocation.Position+Vector3.new(0,2,0)
							ingame = false
							for count = 15,1,-1 do
								for i, plyr in pairs(game.Players:GetChildren()) do
									plyr.PlayerGui:WaitForChild("Status").Frame.TextLabel.Text =  "Intermission "..count-1
								end
								wait(1)
							end
							-- I tried putting break here but it only cancels the for loop its in, how do i cancel the actual loop so it restarts?
						end
					end
				end
			end
		end
	end
	wait()
end

You would benefit from splitting your code into smaller, well-defined functions. The overarching goal you’re looking for would follow something like this:

function runGame()
   while not endConditions() do
      --Whatever you need to do on loop while the game is running
      wait() --Add whatever waiting period you want
   end
end

function endConditions()
   --Do whatever checks you need in this function. Return true if
   --one of them is satisfied (aka the game is over)
   return false
end

while true do
   runGame()
end

just make a variable like local breakloop = false and change it in the for loop where you wanted to break the loop, then check if it’s true after the for loop and beak the loop. (i’m not very good at explaining, sorry :sweat:)