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

Team Change When Death Occurs? (Will this work regardless of change of teams?)

Asked by 7 years ago

The first script works, but idk if it'll work for both, if it does please confirm with me. Title says it all, I'll give you the script down below...

game.Players.PlayerAdded:connect(function(plr)
    plr.CharacterAdded:connect(function(char)
        char.Humanoid.Died:connect(function()
                plr.Team = game.Teams.Bystanders
        end)
    end)
end)

--(Idk if this is the same thing regardless of the Teams lol)


-- THIS SCRIPT WON'T WORK PHO SUM REASON--

local plr = game.Players.LocalPlayer

if plr.Team == game.Teams.Home or game.Teams.Away then
    if plr.Humanoid == 0 then
        plr.Team = game.Teams.Bystanders
    end
end

-- THIS SCRIPT WON'T WORK PHO SUM REASON--

1 answer

Log in to vote
0
Answered by 7 years ago

If you're going to credit my answer you might as well just accept it.. xD

game.Players.PlayerAdded:connect(function(plr)
    plr.CharacterAdded:connect(function(char)
        char.Humanoid.Died:connect(function()
                if plr.Team == game.Teams.Home or plr.Team == game.Teams.Away then
              plr.Team = game.Teams.Bystanders
            end
        end)
    end)
end)

Ad

Answer this question