I've asked this before but I feel like I wasn't clear about what I wanted. basically I want somewhere in my code to stop the loop but start it from the beginning.
local Plr = game.Players.PlayerAdded:Wait() local InOut = Instance.new("BoolValue") InOut.Name = "InOut" InOut.Value = false InOut.Parent = Plr while true do local mapclone = game.ReplicatedStorage["Hex's"]:Clone() mapclone.Parent = workspace local status = game.ReplicatedStorage.Status local inter = game.ReplicatedStorage.Intermission status.Value = "Time until next round: " inter.Value = 30 repeat inter.Value -= 1 wait(1) until inter.Value == 0 local Josh = game.ReplicatedStorage.Spawn:Clone() Josh.Parent = workspace for i, plr in pairs(game.Players:GetPlayers()) do local Character = plr.Character if Character then Character.HumanoidRootPart.Position = Josh.SpawnPoint.Position plr.Character.Humanoid.WalkSpeed = 0 InOut.Value = true end end status.Value = "" inter.Value = 3 wait(1) inter.Value = 2 wait(1) inter.Value = 1 wait(1) inter.Value = "" status.Value = "Go!" game.ReplicatedStorage.GameStarted.Value = true wait(1) game.ReplicatedStorage.PlayersInRound.Value = #game.Players:GetChildren() status.Value = "" inter.Value = "" Josh:Destroy() Plr.Character.Humanoid.WalkSpeed = 16 wait(10) if game.ReplicatedStorage.PlayersInRound.Value == 1 or game.ReplicatedStorage.PlayersInRound.Value == 0 then Plr.Character.HumanoidRootPart.Anchored = true Plr.PlayerGui.RoundOver.RoundOver:TweenPosition(UDim2.new(-0.4, 0,0.434, 0)) wait(3) Plr.PlayerGui.RoundOver.RoundOver:TweenPosition(UDim2.new(-2.17, 0,0.434, 0)) Plr.Character.HumanoidRootPart.Anchored = false Plr.PlayerGui.RoundOver.RoundOver.Position = UDim2.new(2, 0,0.434, 0) wait(1) game.ReplicatedStorage.GameStarted.Value = false for i, plr in pairs(game.Players:GetPlayers()) do local Character = plr.Character if Character then local spawnpoint = game.ReplicatedStorage.ReturnSpawn:Clone() spawnpoint.Parent = workspace Character.HumanoidRootPart.Position = spawnpoint.Position spawnpoint:Destroy() game.ReplicatedStorage.AddCash:FireAllClients() end end -- here I want it to cut the loop short but continue looping end mapclone:Destroy() end game.ReplicatedStorage.PlayersInRound.Value = 0
look at the comment and try to help! Thanks
Just use
break
at the line where you want to stop the loop