Ad
Log in to vote
0

How to get a player in a team when they touched a touch to claim door? [closed]

Asked by 2 months ago

I don't know how to make a team and then when they touched a touch to claim door how to put them in a team.

0
this is not a request site Filipalla 69 — 2mo

Closed as Too Broad by 2eggnog, Thetacah, PyccknnXakep, and Void_Frost

This question has been closed because it is too broad and is generally unanswerable. Please ask a more specific question.

Hi.

Looks like you're using an ad blocker.

That's fine...

No, it really is.

Just, I mean, we put a lot of work into this site, you know?

It would be really really appreciated if you would turn off your ad blocker for our website...

We tried really hard to make our ads as unobtrusive as possible.

If you really hate ads, would you consider a $2 donation via Patreon?

Here's the link.

We love you. We hope you love us too.

.

..

...

Now back to your regularly scheduled Scripting Helpers....

...

..

.

1 answer

Log in to vote
0
Answered by 2 months ago
local part = script.Parent -- variable for part
local claimed = false -- sets a boolean to check if the door is claimed or not

part.Touched:connect(function(hit) -- when the part is touched, hit is defined as the thing that touched the part
    if game.Players:FindFirstChild(hit.Parent.Name) and claimed == false then -- checks hit is a player
        claimed = true -- the door is now claimed
        local player = game.Players:FindFirstChild(hit.Parent.Name) -- defines the player variable
        player.Neutral = false -- now the player is in a team
        player.Team = game.Teams.blue -- change blue to whatever team you want it to be (the team has to be already created)
    end
end)

should work -- tested it

0
It work but now the problam is that the touch to claim door won't dissapear bramieboy241 -19 — 2mo
Ad
Ad