Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I make a switch team on death thing?

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

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.