Skip to main content

Auth

Functions

roleIdSort

Auth.roleIdSort(
aRole,
bRole
) → boolean

Sorts roleIds by highest to lowest

roleIdSortAscending

Auth.roleIdSortAscending(
aRole,
bRole
) → boolean

Sorts roleIds by lowest to highest

userRoleAdd

Auth.userRoleAdd(
userIdnumber,
roleIdRole,
persistboolean?
) → boolean

Adds a role to a user if they don't already have it

userRoleRemove

Auth.userRoleRemove(
userIdnumber,
roleIdRole
) → boolean

Removes a role from a user if it exists

roleCanUseArgument

Auth.roleCanUseArgument(
roleIdRole,
argumentany
) → boolean

Checks if a role has access to a command argument

roleCanUseCommand

Auth.roleCanUseCommand(
roleIdRole,
commandany
) → boolean

Checks if a role has access to a command

hasArgument

Auth.hasArgument(
userIdnumber,
argumentany
) → boolean

Checks if a user has access to a command argument

hasCommand

Auth.hasCommand(
userIdnumber,
commandany
) → boolean | number

Checks if a user has access to a command, returns their rank if they do

hasPermission

Auth.hasPermission(
userIdnumber,
permissionstring
) → boolean

Checks if a user has access to a permission

getRank

Auth.getRank(userIdnumber) → (
number,
Role
)

Checks the maximum role rank of the user

getRoleFromRank

Auth.getRoleFromRank(ranknumber) → Role

Gets the closest role equal to or above a given rank

targetUserArgument

Auth.targetUserArgument(
argany,
userIdnumber,
valuePlayer | number | string
) → ()

Validates if a user can be targeted by a command argument based on permissions and rank limits

hasRestrictedRole

Auth.hasRestrictedRole(userIdnumber) → boolean

Checks if a user has any non-purchasable roles; Roles not associated with any assets, gamepasses, or subscriptions

Show raw api
{
    "functions": [
        {
            "name": "roleIdSort",
            "desc": "Sorts roleIds by highest to lowest",
            "params": [
                {
                    "name": "a",
                    "desc": "",
                    "lua_type": "Role"
                },
                {
                    "name": "b",
                    "desc": "",
                    "lua_type": "Role"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 215,
                "path": "src/Shared/Auth.luau"
            }
        },
        {
            "name": "roleIdSortAscending",
            "desc": "Sorts roleIds by lowest to highest",
            "params": [
                {
                    "name": "a",
                    "desc": "",
                    "lua_type": "Role"
                },
                {
                    "name": "b",
                    "desc": "",
                    "lua_type": "Role"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 223,
                "path": "src/Shared/Auth.luau"
            }
        },
        {
            "name": "userRoleAdd",
            "desc": "Adds a role to a user if they don't already have it",
            "params": [
                {
                    "name": "userId",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "roleId",
                    "desc": "",
                    "lua_type": "Role"
                },
                {
                    "name": "persist",
                    "desc": "",
                    "lua_type": "boolean?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 228,
                "path": "src/Shared/Auth.luau"
            }
        },
        {
            "name": "userRoleRemove",
            "desc": "Removes a role from a user if it exists",
            "params": [
                {
                    "name": "userId",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "roleId",
                    "desc": "",
                    "lua_type": "Role"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 275,
                "path": "src/Shared/Auth.luau"
            }
        },
        {
            "name": "roleCanUseArgument",
            "desc": "Checks if a role has access to a command argument",
            "params": [
                {
                    "name": "roleId",
                    "desc": "",
                    "lua_type": "Role"
                },
                {
                    "name": "argument",
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 395,
                "path": "src/Shared/Auth.luau"
            }
        },
        {
            "name": "roleCanUseCommand",
            "desc": "Checks if a role has access to a command",
            "params": [
                {
                    "name": "roleId",
                    "desc": "",
                    "lua_type": "Role"
                },
                {
                    "name": "command",
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 418,
                "path": "src/Shared/Auth.luau"
            }
        },
        {
            "name": "hasArgument",
            "desc": "Checks if a user has access to a command argument",
            "params": [
                {
                    "name": "userId",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "argument",
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 468,
                "path": "src/Shared/Auth.luau"
            }
        },
        {
            "name": "hasCommand",
            "desc": "Checks if a user has access to a command, returns their rank if they do",
            "params": [
                {
                    "name": "userId",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "command",
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean | number\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 491,
                "path": "src/Shared/Auth.luau"
            }
        },
        {
            "name": "hasPermission",
            "desc": "Checks if a user has access to a permission",
            "params": [
                {
                    "name": "userId",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "permission",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 517,
                "path": "src/Shared/Auth.luau"
            }
        },
        {
            "name": "getRank",
            "desc": "Checks the maximum role rank of the user",
            "params": [
                {
                    "name": "userId",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "desc": "",
                    "lua_type": "Role"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 546,
                "path": "src/Shared/Auth.luau"
            }
        },
        {
            "name": "getRoleFromRank",
            "desc": "Gets the closest role equal to or above a given rank",
            "params": [
                {
                    "name": "rank",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Role\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 573,
                "path": "src/Shared/Auth.luau"
            }
        },
        {
            "name": "targetUserArgument",
            "desc": "Validates if a user can be targeted by a command argument based on permissions and rank limits",
            "params": [
                {
                    "name": "arg",
                    "desc": "",
                    "lua_type": "any"
                },
                {
                    "name": "userId",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "value",
                    "desc": "",
                    "lua_type": "Player | number | string"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 587,
                "path": "src/Shared/Auth.luau"
            }
        },
        {
            "name": "hasRestrictedRole",
            "desc": "Checks if a user has any non-purchasable roles; Roles not associated with any assets, gamepasses, or subscriptions",
            "params": [
                {
                    "name": "userId",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 626,
                "path": "src/Shared/Auth.luau"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "Auth",
    "desc": "",
    "source": {
        "line": 12,
        "path": "src/Shared/Auth.luau"
    }
}