How to automatically team when the player dies?

I’m currently creating a game and I’m having trouble with finding out how to automatically team somebody once they die…

I would really appreciate some help. Thanks!! :slight_smile:

Here’s an API Reference, if this doesn’t help I could try to make a script for you :smile:

1 Like

What do you mean automaticaly team somebody? You mean like put them in a team after they die?

local players = game:GetService("Players")
local teams = game:GetService("Teams")

players.PlayerAdded:Connect(function(player)
    local character = player.Character or player.CharacterAdded:Wait()
    local humanoid = character:WaitForChild("Humanoid")

    humanoid.Died:Connect(function()
        player.Team = teams.Dead -- team name here whatever
    end)
end)
4 Likes

awesome- it works! thank you. i really appreciate it :).

1 Like