I can't figure out how to do it. I can get the part to kill on touch, but it won't change the team. Here's what i have so far:
local player= game.Players.LocalPlayer
function onTouch(part) player.TeamColor = BrickColor.new ("Dark stone grey") local humanoid = part.Parent:FindFirstChild("Humanoid") if (humanoid ~= nil) then humanoid.Health = 0 end end
script.Parent.Touched:connect(onTouch)
This should work. Put this script in the part you want to change the player's team.
local TeamName = nil --Set this to the name of the team you want the player to be added to, in quotes. script.Parent.Touched:connect(function(char) --This is a touched event. "char" is the name of the variable which is the part being touched. local player = game.Players:GetPlayerFromCharacter(char.Parent) --Get PlayerFromCharacter will get a character, and if there is a player, it will output the player's name. char.Parent means we are getting the parent of the part that hit, which, if it is a player, should be the Player's model. if player then --This will check if a player was found, and if it does, it will run the following script. player.TeamColor = game.Teams[TeamName].TeamColor --Changes the players team. player.Character.Humanoid.Health = 0 end end)