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

How do I make a door than only opens to a a certain group rank?

Asked by 10 years ago

How do I make a door than only opens to a a certain group rank (or more than one rank for a group)?

1 answer

Log in to vote
2
Answered by
Bebee2 195
10 years ago

Key methods: Game.Players:GetPlayerFromCharacter Player:IsInGroup Player:GetRoleInGroup

local groupid = 9000001 -- Id of your group
local door = script.Parent -- Replace this to the path of the door
door.Touched:connect(function(part)
local plr =  game.Players:GetPlayerFromCharacter(part.Parent)
if plr then
if plr:IsInGroup(groupid) then
if plr:GetRoleInGroup(groupId)  >= 50 then -- replace with minimal rank to open door
if not debounce then debounce = true -- Let's try not to do something we will regret.
door.Transparency = 0.5
door.CanCollide = false
wait(1)
door.Transparency = 0
door.CanCollide = true
debounce = nil
end
end
end
end
end)

Ad

Answer this question