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

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

Asked by 6 years ago

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

Log in to vote
2
Answered by 6 years ago

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)
0
Thanks alot, this helped. P_sychik 7 — 6y
0
The one on top works. SkatePro888899999 5 — 6y
Ad

Answer this question