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

How can you make it so a sliding door will only open if you are a certain team?

So basically, what I have been trying to do, was make a gate that only Security Guards could go through and not prisoners. How could I make it like that? Help would be appreciated.

1 answer

✓ Accepted answer

Use the GetPlayerFromCharacter, then use Player.Team to check if they are on security guards.

function onTouch(hit)
    local player = game.Players:GetPlayerFromCharacter(hit.Parent)
    if player.Team == “Security Guards” then
    --Door opening script here
    elseif player.Team == “Prisoners” then print(“Prisoner attempted to go through sliding door”)
end

script.Parent.Touched:connect(onTouch)

2 comments

0

Thanks alot, this helped.

0

The one on top works.

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