> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bloxcord.net/llms.txt
> Use this file to discover all available pages before exploring further.

# Ranking & Permissions

> Change a user's group rank and read their BloxCord permissions.

## setRank

Changes a user's rank in your Roblox group through BloxCord's authoritative ranking pipeline (Open Cloud + audit log).

```lua theme={null}
local ok = BloxCord:Invoke("setRank", userId, reason, rank, actor)
```

### Parameters

<ParamField body="userId" type="number | string" required>
  The `UserId` of the user whose rank will change. Coerced to a string.
</ParamField>

<ParamField body="reason" type="string" required>
  The reason recorded in the audit log for the rank change.
</ParamField>

<ParamField body="rank" type="number" required>
  The target group rank (the rank number, not the roleset name).
</ParamField>

<ParamField body="actor" type="Player | table | number" required>
  Who is performing the change. See [the actor object](/gi-concepts#the-actor-object).
</ParamField>

### Returns

<ResponseField name="success" type="boolean">
  `true` if the rank change was accepted and applied. `false` if the backend rejected it or was unreachable.
</ResponseField>

### Example

```lua theme={null}
local BloxCord = game:WaitForChild("BloxCord")

local function promote(targetUserId, byPlayer)
    local ok = BloxCord:Invoke("setRank", targetUserId, "Field promotion", 5, byPlayer)
    if ok then
        print("Promoted", targetUserId)
    else
        warn("Failed to promote", targetUserId)
    end
end
```

***

## getUserPermissions

Returns the list of BloxCord permission strings a **player currently in the server** holds, based on their roles and group rank. Results are cached per player for the duration of their session.

```lua theme={null}
local permissions = BloxCord:Invoke("getUserPermissions", player)
```

<Note>
  Unlike most methods, this takes a live `Player` instance (not a `UserId`), because it caches the result against the player.
</Note>

### Parameters

<ParamField body="player" type="Player" required>
  The player whose permissions to fetch. Must be an in-server `Player` instance.
</ParamField>

### Returns

<ResponseField name="permissions" type="string[]">
  An array of permission identifiers the player holds. May be empty if the player has no special permissions.
</ResponseField>

### Example

```lua theme={null}
local BloxCord = game:WaitForChild("BloxCord")

local function canModerate(player)
    local permissions = BloxCord:Invoke("getUserPermissions", player)
    for _, perm in ipairs(permissions or {}) do
        if perm == " [see permissions reference] " then
            return true
        end
    end
    return false
end
```
