Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I repeatedly kill everyone in a team? [Solved]

Asked by
awfulszn 394 Moderation Voter
7 years ago
Edited 7 years ago

I have a script, and I want it to check that if the player is in the team test it will insert their name into a table and repeatedly kill them, there are no errors, it is in a regular script in ServerScriptService

local kill = {}

for _, v in pairs(game.Players:GetPlayers()) do
    if v.Team == "Test" then
        table.insert(kill, v.Name)
    end
end

game.Players.PlayerAdded:connect(function(player)
while true do
     for _, v in pairs(kill) do   
        if player.Name == v then       
            coroutine.wrap(function()
               while true do                                            
                   game:GetService("RunService").Heartbeat:wait()
                   if player.Character then                         
                        player.Character:BreakJoints()
                    else                            
                        player.CharacterAdded:wait()
                    end
                end                
            end)()            
        end
        end
    wait()
end
end)

Answer this question