When a high rank goes threw the door it opens to everyone…
I’d like it to close and even if a high rank is “going threw” the door, a low rank cannot go threw. Here is my current script:
local doorpart = script.Parent -- Put the part acting as the door here
local id = 34046669 -- Put your group id here
local minimumRankLevel = 42 -- Put your desired minimum rank level here
doorpart.Touched:Connect(function(touchPart)
if touchPart.Parent:FindFirstChild("Humanoid") then
local plr = game.Players:FindFirstChild(touchPart.Parent.Name)
if plr:IsInGroup(id) and plr:GetRankInGroup(id) >= minimumRankLevel then
doorpart.CanCollide = false
end
end
end)