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.
✓ ANSWER ACCEPTED
How can you make it so a sliding door will only open if you are a certain team?
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)
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Thanks alot, this helped.
The one on top works.