How would I be able to allow certain ranks in a group to click/activate a TextButton?

So I’ve been working on a new aircraft Jetway for a few days now and for the scripting aspect of it, I just decided to replace the model of a free model which moves using 4 TextButtons on a part. The Jetway moves perfectly fine and works as intended, but I’m looking to make it so only certain members/roles in a roblox group are able to click the TextButtons to control the jetway. I’m not super familiar with using TextButtons so I’m not entirely sure how to do so on my own. I’ve tried a couple different scripts I’ve found on the dev forum but most, if not all of them just end up not working and leave no errors. Any helps or tips are greatly appreciated.

Control Panel
TextButtonPanel

Explorer View
TextButtonsExplorer

Within the MouseButton1Down Event, you’d have to check for the players rank in the group with the function GetRankInGroup.

It should look something like this:

local player = game.Players.LocalPlayer

button.MouseButton1Down:Connect(function()
   if player:GetRankInGroup(GROUP ID HERE) >= RANK NUMBER HERE then

      -- Code here

   end
end)

You can get the rank numbers by going to configure group, selecting the roles category and every rank number will be posted under “Rank”.

1 Like