while true do wait() player = game.Players:GetChildren() for i = 1, #player do if player[i].TeamColor ~= game.Teams.SCP.TeamColor then if player[i].Character.Humanoid.WalkSpeed > 50 or player[i].Character.Humanoid.Health > 5000 or player[i].Character.Humanoid.MaxHealth > 5000 then player[i].Character.Parent = nil player[i].Parent = nil wait(3) end end end end
01 | while true do -- Infinite loop |
02 | wait() -- To prevent a lag spike |
03 | player = game:GetService( "Players" ):GetPlayers() -- Same as GetChildren but instead filters it to only Players. |
04 | for i = 1 , #player do -- For loop |
05 | if player [ i ] .TeamColor ~ = game:GetService( "Teams" ).SCP.TeamColor then -- Is the player not the same color as the SCP team |
06 | if player [ i ] .Character.Humanoid.WalkSpeed > = 50 or player [ i ] .Character.Humanoid.Health > = 5000 or player [ i ] .Character.Humanoid.MaxHealth > = 5000 then -- Is the player does meet the conditions above. |
07 | player [ i ] :Kick() -- Kick the player |
08 | wait( 3 ) |
09 | end |
10 | end |
11 | end |
12 | end |
What you are doing is trying to parent the player to nil which is not possible.
I also recommend using GetPlayers and GetService so that it can still be retrieved even though the name is changed.
I recommend to instead change it to player[i]:Kick()