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

Group rank door cancollide = false for certain rank and higher?

Asked by 6 years ago
Edited 6 years ago

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)

1 answer

Log in to vote
0
Answered by
Nowaha 459 Moderation Voter
6 years ago

You COULD teleport them in instead of it being not collidable

Ad

Answer this question