So I made a Group rank door that when a player in the group a certain rank or higher touched the door, cancollide = false for about .5 seconds. But during that .5 seconds, I have found that players can go through with the player who has a higher group rank even if they are in a low rank or not in the group. How would u make it so the door is cancollide = true for group members that aren't higher than a certain rank, and for those who are above a certain rank in the group, it is always concollide = false for them. Here is the script.
local group = 3309505 --My group id is here
local rank = 254 -- Lowest qualifying rank number (For example everyone from rank 65 and up can go through the door)
script.Parent.Touched:connect(function(p)
while p.Parent.Name~="Workspace" do
p = p.Parent
end
local plyr = game.Players:FindFirstChild(p.Name)
if plyr~=nil and plyr:IsInGroup(group)==true and plyr:GetRankInGroup(group)>=rank then
script.Parent.CanCollide = false
script.Parent.Transparency = 1
wait(.5)
script.Parent.CanCollide = true
script.Parent.Transparency = 1
end
end)

2 comments
I'd recommend checking out collision groups http://wiki.roblox.com/index.php?title=Collision_Filtering
http://wiki.roblox.com/index.php?title=Collision_Filtering_Team_Doors