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

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

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

✓ Accepted answer

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)

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