My script keeps repeating Intermission and "Choosing players" after a new player joins after one round. Why is that?
Award = 1 local gui = game.Workspace.Part1.v.z game.Players.PlayerAdded:connect(function(plr) local leaderstats = Instance.new("IntValue") leaderstats.Name = "leaderstats" local points = Instance.new("IntValue") points.Name = "Points" points.Parent = leaderstats leaderstats.Parent = plr end) GIP = false function Fight() winner = "No one" ended = false GIP = true for i = 15, 0, -1 do if i <= 9 then gui.Text = "Intermission (0:0"..i..")" else gui.Text = "Intermission (0:"..i..")" end wait(1) end gui.Text = "Now choosing duelers." wait(5) local plrs = game.Players:GetPlayers() if #plrs <= 2 then local p1 = plrs [math.random(1, #plrs)] local p2 = plrs [math.random(1, #plrs)] ended = false repeat p2 = plrs[math.random(1, #plrs)] until p2 ~= p1 gui.Text = p1.Name.. " and " ..p2.Name.. " have been chosen to duel." wait(3) p1.Character.Torso.CFrame = CFrame.new(148.9, 13.6, 14.4) p2.Character.Torso.CFrame = CFrame.new(148.9, 13.6, -59.6) local sword1 = game.ServerStorage.Sword1:Clone() sword1.Parent = p1.Backpack local sword2 = game.ServerStorage.Sword2:Clone() sword2.Parent = p2.Backpack p1.Character.Humanoid.WalkSpeed = 0 p2.Character.Humanoid.WalkSpeed = 0 wait(2) for i = 3, 0, -1 do gui.Text = "Starting in (0:0"..i..")" wait(1) if p1.Character ~= nil and p2.Character ~= nil then else ended = true break end end p1.Character.Humanoid.WalkSpeed = 16 p2.Character.Humanoid.WalkSpeed = 16 wait(0.1) for i = 30, 0, -1 do if ended == true then break end gui.Text = "Round, please wait (0:"..i..")" if i <= 9 then gui.Text = "Round, please wait (0:0"..i..")" end game.Players.PlayerRemoving:connect(function(player) if player.Name == p1.Name then winner = p2.Name ended = true end end) game.Players.PlayerRemoving:connect(function(player) if player.Name == p1.Name then winner = p2.Name ended = true end end) if p1.Character ~= nil then p1.Character.Humanoid.Died:connect(function() if ended == false then p2.leaderstats.Points.Value = p2.leaderstats.Points.Value + Award winner = p2.Name --game:GetService("PointsService"):AwardPoints(p2.userId,1) --Remove the first 2 dashes to activate PP. Edit the 1 to how many PP you want to give ended = true end end)end if p2.Character~=nil then p2.Character.Humanoid.Died:connect(function()if ended == false then p1.leaderstats.Points.Value = p1.leaderstats.Points.Value + Award winner = p1.Name --game:GetService("PointsService"):AwardPoints(p1.userId,1) --Remove the first 2 dashes to activate PP. Edit the 1 to how many PP you want to give ended = true end end)end wait(1) if ended == true then wait()break end end if p1.Character ~= nil then p1.Character.Torso.CFrame = CFrame.new(192.9, 3.4, -30.1) while wait() do if p1.Character.Humanoid ~= nil then p1.Character.Humanoid:UnequipTools() break end end p1.Backpack:ClearAllChildren()end if p2.Character ~= nil then p2.Character.Torso.CFrame = CFrame.new(183.9, 3.4, -30.1) p2.Character.Humanoid:UnequipTools() p2.Backpack:ClearAllChildren() end end gui.Text = winner.." has won" wait(2) GIP = false end while true do if game.Players.NumPlayers > 1 and GIP == false then wait(0.5) Fight() elseif game.Players.NumPlayers == 1 then gui.Text = "Waiting for 2 or more players." end wait() end