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

How do I change a player's team when they touch a part?

I am trying to make someone receive a team once they spawn in a lobby of a game and once they enter a portal. Is there any way I can change someone's team when they touch a specific part without killing the player?

2 comments

0

edited answer

0

now try again

2 answers

✓ Accepted answer
part.Touched:Connect(function(hit)
    local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
    player.Team = game.Teams.TEAMNAMEGOESHERE
    end
end)

10 comments

1

Thank you for answering, but when I touch the part, the following error shows:

0

?

1

Hit is not a valid member of part

0

fixed

1

Wait a lil'...

0

wait lemme edit 1 more time

0

Alr.

0

there now trt

1

:o Thanks.

0

ty for the rep <3

You could make the portal a spawn point and go into properties and make it so player doesn't spawn there but it changes there team on touch. For example place a tp brick and the spawn point make sure there in each other so when the player spawns they tp.

1 comment

0

Can you please give a list of the properties I have to change for me? For me, the properties are kind of confusing. Sorry.

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