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

How do I make a switch team on death thing?

Asked by 4 years ago

I'm working on a sword fight event game and I want it once a player dies they switch teams so they spawn somewhere else, if anyone can help will be greatly appreciated. I don't have any code cause I got no clue how to.

1 answer

Log in to vote
-1
Answered by
JesseSong 3916 Moderation Voter Community Moderator
4 years ago

Modify your team name and change them to your preference.Parent Use the humanoid.Died it better and efficient to check whether the player has died

Also make sure this is in a server script.

for _,plr in pairs(game.Players:GetPlayers()) do
    local char = plr.Character or plr.CharacterAdded:Wait()
    local hum = char.Humanoid
    hum.Died:Connect(function()
        if plr.Team == game.Teams.YOURTEAMS then -- Change the team names to your own teams by going on explorer and inserting teams
            plr.Team = game.Teams.YOURTEAMS
        end
    end)
end

If my answer helped make sure to accept it.

Ad

Answer this question