How can i add multiple roblox group ranks to my script?

Hi there,
I would like to add to my staff door script the feature of multiple roblox group ranks to get access to the script function but when I try to make it, it just doesn’t works. If someone can help me, that would be great! I let you guys here an screenshot of the script:


waiting for any help!

local Groups = {
    [12345] = 106,
    [123456] = 106,
    [123457] = 106
}

script.Parent.Touched:Connect(function(Hit)
    if (Hit.Parent) and (Hit.Parent:FindFirstChild("Humanoid")) then 
        local HitPlayer = game:GetService("Players"):GetPlayerFromCharacter(Hit.Parent)

        script.Parent.CanCollide = true
        for i,v in pairs(Groups) do 
            if (HitPlayer:GetRankInGroup(i) >= v) then 
                script.Parent.CanCollide = false
            end
        end
    end
end)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.