How can I restrict a command for a specific rank and above?

Hey all! I’m trying to make a command admin, the command works but I’m not aware how to make it restricted for a certain rank and above
Simple words: Check if user is rank 12 or above in group if is, then allow command, else cancel command

Thanks alot!

local Rank = Player:GetRankInGroup(GroupId)
if Rank >= Number then -- equal to or above (>=)
   -- code.
end

I do recommend using GroupService over this, as these methods are cached on the server side ( IsInGroup, GetRoleInGroup & GetRankInGroup).

(GroupService | Documentation - Roblox Creator Hub)

1 Like