How to make a staff door with key

Does anyone know how to add a feature where you can get a key for a door like Divine sister and have only staff be able to unlock it?

1 Like

You can probably make a whitelist table for those who can unlock a door,.

1 Like

you could also try adding a Bool Value to each player and if the value is true then they can use the door. it could go like this:

script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild(“Humanoid”) then --to make sure it’s their character that has touched the part
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
if plr:FindFirstChild(“DoorKey”) then --to make sure they have the Bool Value
if plr.DoorKey.Value == true then
print(“someone has opened the door”)
script.Parent.Transparency = 0.7
script.Parent.CanCollide = false
end
else
print(“Someone tried to open the door but they didn’t have a key”)
end
end
end)