Well I have 12 max players in my game and at a certain point I want to kill them all. It works, but is there a more efficient way of doing it? [Its not working atm...]
Here is my script:
game.Workspace.ChildAdded:connect(function(child) if child.Name == "KillAllPlayers" then local pl = game.Players:GetChildren() for i=1,#pl do if pl.Teamcolor == BrickColor.new("Bright red") or pl.Teamcolor == BrickColor.new("Bright blue") then pl[i].Character.Humanoid.Health = 0 end for i=2,#pl do if pl.Teamcolor == BrickColor.new("Bright red") or pl.Teamcolor == BrickColor.new("Bright blue") then pl[i].Character.Humanoid.Health = 0 end for i=3,#pl do if pl.Teamcolor == BrickColor.new("Bright red") or pl.Teamcolor == BrickColor.new("Bright blue") then pl[i].Character.Humanoid.Health = 0 end for i=4,#pl do if pl.Teamcolor == BrickColor.new("Bright red") or pl.Teamcolor == BrickColor.new("Bright blue") then pl[i].Character.Humanoid.Health = 0 end for i=5,#pl do if pl.Teamcolor == BrickColor.new("Bright red") or pl.Teamcolor == BrickColor.new("Bright blue") then pl[i].Character.Humanoid.Health = 0 end for i=6,#pl do if pl.Teamcolor == BrickColor.new("Bright red") or pl.Teamcolor == BrickColor.new("Bright blue") then pl[i].Character.Humanoid.Health = 0 end for i=7,#pl do if pl.Teamcolor == BrickColor.new("Bright red") or pl.Teamcolor == BrickColor.new("Bright blue") then pl[i].Character.Humanoid.Health = 0 end for i=8,#pl do if pl.Teamcolor == BrickColor.new("Bright red") or pl.Teamcolor == BrickColor.new("Bright blue") then pl[i].Character.Humanoid.Health = 0 end for i=9,#pl do if pl.Teamcolor == BrickColor.new("Bright red") or pl.Teamcolor == BrickColor.new("Bright blue") then pl[i].Character.Humanoid.Health = 0 end for i=10,#pl do if pl.Teamcolor == BrickColor.new("Bright red") or pl.Teamcolor == BrickColor.new("Bright blue") then pl[i].Character.Humanoid.Health = 0 end for i=11,#pl do if pl.Teamcolor == BrickColor.new("Bright red") or pl.Teamcolor == BrickColor.new("Bright blue") then pl[i].Character.Humanoid.Health = 0 end for i=12,#pl do if pl.Teamcolor == BrickColor.new("Bright red") or pl.Teamcolor == BrickColor.new("Bright blue") then pl[i].Character.Humanoid.Health = 0 game.Workspace.HostageFree:Remove() end end end end end end end end end end end end end end end)