players = game.Players:GetChildren()
coin = game.Workspace.Coins:GetChildren()
player = game.Players.LocalPlayer
player.PlayerAdded:connect(function()
	s = Instance.new("IntValue")
	s.Name = "leaderstats"
	s.Parent = player.Backpack
	p = Instance.new("IntValue")
	p.Name = "Points"
	p.Parent = s
	p.Value = 0
	d = Instance.new("intValue")
	d.Name = "Deaths"
	d.Parent = s
	d.Value = 0
end)
while true do
	if (#players * math.pi) >12 then -- If there are at least 4 players, do the loop
		h = game.Workspace.Hint
		h.Text = "Obby Race"
		for i = 1,25 do
			h.Text = "There are"..i.."seconds until the next round!"
			wait(1)
		end
		h.Text = "Starting round..."
		wait(3)
		for i = 1, #players do
			players[i].Character:MoveTo(game.Workspace.SpawnBrick)
		end
		wait(3)
		h.Text = "Go!"
		wait(1)
		for i = 1,180 do
			h.Text = "There are"..i.."seconds left!"
			wait(1)
			if game.Workspace.ObstacleMap.Finish:FindFirstChild("Humanoid") ~= nil then
				h.Text = "We have a winner!"
				pack = game.Workspace.ObstacleMap.Finish:FindFirstChild("Backpack")
				pack.leaderstats.Points.Value = p.Value + 1
				player.Torso:BreakJoints()
			end
		end
	end
	wait(2)
end

I'm confused.

4 comments

0

on what

0

how would i stop the for loop and reset it?

0

Just put in “break” in the for loop if you want to stop, or “reset” the loop.

0

mk