Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I make this only run after it checks if player has certain rank in group?

Here, I got this script and I want it to only run for a specific rank and up in a group, if anyone can do this it will be appreciated.

local Opened = script.Parent.Opened

function Open(Part, Type)
    if Opened.Value == false then
        if game.Players:FindFirstChild(Part.Parent.Name) or game.Players:FindFirstChild(Part.Parent.Parent.Name) then
            Opened.Value = true
            for i = 0.1,5.4, 0.1 do
                script.Parent.DoorLeft.CFrame = script.Parent.DoorLeft.CFrame * CFrame.new(0.1,0,0)
                script.Parent.DoorRight.CFrame = script.Parent.DoorRight.CFrame * CFrame.new(-0.1,0,0)
                wait()
            end
            wait(script.Parent.WaitTime.Value)
            for i = 0.1,5.4, 0.1 do
                script.Parent.DoorLeft.CFrame = script.Parent.DoorLeft.CFrame * CFrame.new(-0.1,0,0)
                script.Parent.DoorRight.CFrame = script.Parent.DoorRight.CFrame * CFrame.new(0.1,0,0)
                wait()
            end
            Opened.Value = false
        end
    end
end

script.Parent.Field1.Touched:connect(Open)
script.Parent.Field2.Touched:connect(Open)

1 answer

There are 2 options. One returns the int value rank and one returns the string value role.

Rank:

Player = whatever your player variable is
GroupID = Id of the group

Player:GetRankInGroup(GroupID)

Role:

Player = whatever your player variable is
GroupID = Id of the group

Player:GetRoleInGroup(GroupID)

To clarify: for players not in a group, the rank would be 0 and the role would be "Guest". Similarly, if the player owns the group, the rank would be 255 and the role would be whatever the "Owner" role is named. If you don't have access to the group admin panel, finding each roles rank would be fairly difficult, but you can use either.

This discussion is preserved as it was. New answers, comments, and votes are closed.