I can't make a Timer but if the player wins then the timer stops

Hey this is kinda of confusing, I have a sword fighting game and I’m trying to make a timer when the round starts but if the player wins the timer stops and it says the player won

			gamers = game.ReplicatedStorage.Playing:GetChildren()
			for i = 300, 1, -1 do --the first loop
				announce.Value = "Game in Progress: ".. i
				wait(1)
				if #gamers == 1 then --if this is 1 then it break the "for = 300, 1, -1" loop pls help :)
					for i, winner in pairs(gamers) do

						wait()
						announce.Value = winner.Name .. " won and everyone else is a loser!"
						for i, v in pairs(players) do
							if v.Name == winner.Name then
								v.leaderstats.Wins.Value = v.leaderstats.Wins.Value + 1
								wait()
								v.Character:MoveTo(game.Workspace.Spawn.Position)
							end
						end
						for i, v in pairs(game.ReplicatedStorage.Playing:GetChildren())do
							v:Destroy()
							thechosemap.Parent = game.ReplicatedStorage.Maps
							for i, removes in pairs(game.Players:GetChildren()) do
								local inside = removes.Character:GetChildren()
								for i, v in pairs(inside) do
									if v.ClassName == "Tool" then
										v:Destroy()
									end
								end
							end
							local players = game.Players:GetChildren()
							for i, v in pairs(players) do
								local bp = v.Backpack:GetChildren()
								for i, thing in pairs(bp) do
									if thing.ClassName == "Tool" then
										thing:Destroy()
									end
								end
							end
							for i, v in pairs(players) do
								v.Character.Humanoid.Health = 100
							end
						end
					end
				end
			end
			wait()
		end

If theres a way to break the first loop if #gamers = 1 then that would be very helpful, i tried doing just break but it did work and idk if i put it in the wrong spot or what but if you could help I’d really appreciate it Thanks, Joesiuh

break is a keyword, write that at the end of #gamers == 1 statement.

1 Like