Skip to content
Components & Interactions getRoleSelectRoleIDs

$getRoleSelectRoleIDs

The function $getRoleSelectRoleIDs[] retrieves all role IDs selected by the user in a multi-select role menu.

Syntax

bdfd
$getRoleSelectRoleIDs[(separator)]

Syntax

$getRoleSelectRoleIDs[(separator)]

Parameters

Parameter Description
separator Optional - The separator between each ID. Defaults to , (comma + space).

Return Value

  • Type: String
  • The list of all selected role IDs.
  • An empty string if no role was selected.

Behavior

  • Used with a role select menu configured with maxValues > 1.
  • Returns all IDs in a single string with the specified separator.
  • Compatible with $textSplit[] to iterate over each role.

Examples

Assigning multiple roles

$onInteraction[role_select]
$var[roles;$getRoleSelectRoleIDs[,]]

$textSplit[$var[roles];,]
  $giveRole[$authorID;$splitText[$index]]
  + Role added: $roleName[$splitText[$index]]
$endTextSplit

$sendMessage[✅ All roles have been assigned!]

Displaying selected roles

$onInteraction[role_select]
$var[list;$getRoleSelectRoleIDs[, ]]
$var[count;$length[$splitText[$var[list];, ]]]

$title[🎭 $var[count] role(s) selected]
$description[
$textSplit[$var[list];, ]
  $index. $roleName[$splitText[$index]]
$endTextSplit
]
$color[#5865F2]
$sendMessage[]

Notes

  • For a single selection, use $getRoleSelectRoleID[].
  • The separator can be any string of characters.
  • Useful for auto-role systems with multiple selections.