Check if a player is higher than a group role as opposed to rank number?

Hello! I have been using a system to check if players are over a certain role in my group with rank numbers (1-255), but I often change them and the script no longer works until I adjust it. I was looking for a way to check if a player is higher than a role rather than using just the rank number, any help would be greatly appreciated. Currently, whenever I change the rank numbers I have to go through many lines in different scripts to change the “rank-check” value.

Sounds like you should be using a module that exports the rank id you want to check rather than hardcoding it. If you do this then you only have to change it in one place and all of your scripts will use the updated number.

-- Module.lua
return {
  Admin = 50
}

-- Script.lua
local rankModule = require(module)
local groupId = 123

...
if Player:GetRankInGroup(groupId) == rankModule["Admin"] then
  -- stuff
end
...
1 Like