How do I make a door than only opens to a a certain group rank (or more than one rank for a group)?
COMMUNITY QUESTION
How do I make a door than only opens to a a certain group rank?
1 answer
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)
This discussion is preserved as it was. New answers, comments, and votes are closed.
