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

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

Asked by
DemGame 271 Moderation Voter
4 years ago
Edited 4 years ago

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?

0
edited answer raid6n 2196 — 4y
0
now try again raid6n 2196 — 4y

Locked by PrismaticFruits, Dovydas1118, raid6n, and IAmNotTheReal_MePipe

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

Why was this question closed?

2 answers

Log in to vote
0
Answered by
raid6n 2196 Moderation Voter Community Moderator
4 years ago
Edited 4 years ago
part.Touched:Connect(function(hit)
    local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
    player.Team = game.Teams.TEAMNAMEGOESHERE
    end
end)
1
Thank you for answering, but when I touch the part, the following error shows: DemGame 271 — 4y
0
? raid6n 2196 — 4y
1
Hit is not a valid member of part DemGame 271 — 4y
0
fixed raid6n 2196 — 4y
View all comments (6 more)
1
Wait a lil'... DemGame 271 — 4y
0
wait lemme edit 1 more time raid6n 2196 — 4y
0
Alr. DemGame 271 — 4y
0
there now trt raid6n 2196 — 4y
1
>:o Thanks. DemGame 271 — 4y
0
ty for the rep <3 raid6n 2196 — 4y
Ad
Log in to vote
0
Answered by 4 years ago

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.

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. DemGame 271 — 4y