Right-clicking a role tag in a message will bring up the menu for the message, not the role. To copy the ID of a role, click the name or profile picture of a user with the role and right-click the role in their profile. Alternatively, navigate to the
Roles tab in the server settings and right-click the role (
Manage Roles permission is required for this method).