Org Admin Guide

Permissions & Moderation SDK Reference

Complete reference for all read and write functions in RoPerms.lua related to permissions, bans, kicks, and punishments.

Require first

All functions below are accessed through the module. Call RoPerms.Init() once at startup before using any function.

Permissions — read#

fnGetPermboolean
RoPerms.GetPerm(playerOrId: Player | number, permKey: string): boolean

Returns true if the player currently holds the named permission.

lua
if RoPerms.GetPerm(player, "vip") then
    -- grant VIP benefits
end
fnGetPermAttrany | nil
RoPerms.GetPermAttr(playerOrId: Player | number, permKey: string, attrKey: string): any

Returns the value of a single attribute on the player's permission assignment, or nil if the permission is not held or the attribute is not set.

lua
local tier = RoPerms.GetPermAttr(player, "whitelist", "tier")
-- tier might be "bronze", "silver", or "gold"
fnGetPermAttrstable | nil
RoPerms.GetPermAttrs(playerOrId: Player | number, permKey: string): table | nil

Returns a key-value table of all attributes for the named permission, or nil if the permission is not held.

lua
local attrs = RoPerms.GetPermAttrs(player, "vip")
if attrs then
    print(attrs.color, attrs.tier)
end
fnGetPermstable
RoPerms.GetPerms(playerOrId: Player | number): table

Returns a list of all permission keys the player currently holds.

lua
local perms = RoPerms.GetPerms(player)
for _, key in ipairs(perms) do
    print(key)
end
fnIsBannedboolean, reason?
RoPerms.IsBanned(playerOrId: Player | number): boolean, string | nil

Returns whether the player is currently banned. If banned, also returns the ban reason as a second value.

lua
local banned, reason = RoPerms.IsBanned(player)
if banned then
    player:Kick("You are banned: " .. reason)
end
fnIsToolbannedboolean
RoPerms.IsToolbanned(playerOrId): boolean

Returns true if the player has an active tool ban. RoPermsClient.lua applies the CoreGui change automatically — use this function if you need to check the state manually in a server script.

fnIsChatbannedboolean
RoPerms.IsChatbanned(playerOrId): boolean

Returns true if the player has an active chat ban.

fnIsModcallBannedboolean
RoPerms.IsModcallBanned(playerOrId): boolean

Returns true if the player is banned from submitting modcalls.

fnGetWarningsnumber
RoPerms.GetWarnings(playerOrId): number

Returns the total number of warnings issued to the player.

fnInvalidate
RoPerms.Invalidate(playerOrId: Player | number)

Clears the local cache for a player. The next call to any read function will fetch fresh data from the backend. Useful after granting/revoking permissions outside the SDK (e.g., via the dashboard).

lua
-- After granting a perm from the dashboard, force the cache to refresh
RoPerms.Invalidate(player)

Permissions — write#

fnGrantPermboolean
RoPerms.GrantPerm(playerOrId: Player | number, permKey: string): boolean

Grants the named permission to the player. Returns true on success.

lua
local ok = RoPerms.GrantPerm(player, "vip")
if not ok then warn("Failed to grant VIP") end
fnRevokePermboolean
RoPerms.RevokePerm(playerOrId: Player | number, permKey: string): boolean

Removes the named permission from the player. Returns true on success.

fnCreatePermboolean
RoPerms.CreatePerm(key: string, displayName: string, color: string): boolean

Creates a new permission definition for the org. color is a hex string (e.g., '#8b5cf6'). Returns true if created, false if the key already exists.

fnDeletePermboolean
RoPerms.DeletePerm(key: string): boolean

Deletes a permission definition and all its assignments. This is permanent — use carefully.

fnListPermstable
RoPerms.ListPerms(): table

Returns an array of all permission definitions for the org. Each entry has key, displayName, and color fields.

Moderation — write#

fnBanboolean
RoPerms.Ban(playerOrId: Player | number, reason: string, durationDays: number?): boolean

Creates a ban record for the player. Omit durationDays or pass nil for a permanent ban. Returns true on success. If enforcement is enabled, the player is kicked from the server automatically.

lua
-- Permanent ban
RoPerms.Ban(player, "Exploiting")

-- 7-day ban
RoPerms.Ban(player, "Harassment", 7)
fnUnbanboolean
RoPerms.Unban(playerOrId: Player | number): boolean

Lifts the player's active ban. Returns true on success.

fnKickboolean
RoPerms.Kick(playerOrId: Player | number, reason: string): boolean

Kicks the player from all active servers without creating a ban record. Returns true if the kick was queued successfully.

fnWarnboolean
RoPerms.Warn(playerOrId: Player | number, reason: string): boolean

Issues a warning to the player. Warnings are recorded on the player's profile and counted.

fnToolbanboolean
RoPerms.Toolban(playerOrId: Player | number, reason: string, durationDays: number?): boolean

Applies a tool ban. If RoPermsClient.lua is installed, the Backpack CoreGui is hidden for the player. Permanent if durationDays is omitted.

fnChatbanboolean
RoPerms.Chatban(playerOrId: Player | number, reason: string, durationDays: number?): boolean

Applies a chat ban. If RoPermsClient.lua is installed, the Chat CoreGui is hidden. Works with both the legacy chat and TextChatService.

fnModcallbanboolean
RoPerms.Modcallban(playerOrId: Player | number, reason: string, durationDays: number?): boolean

Prevents the player from submitting modcalls. The SDK rejects their modcall.create requests while the ban is active.

Caching behaviour#

All read functions cache results per-player for cacheDuration seconds (default 60). This means:

  • The first read for a player fires an HTTP request to the backend.
  • Subsequent reads within the window return the cached value instantly.
  • Write functions automatically invalidate the cache for the affected player.
  • Call RoPerms.Invalidate(player) to force a fresh fetch after an out-of-band change.