Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I make a GUI only show up to certain group ranks?

This is the code I tried but it didn't work. I put it in a local script and placed it inside starter GUI with the GUI itself as the child.

local requiredRank = 246

local groupId = 5169488

local client = game.Players.LocalPlayer

if client:GetRoleInGroup(groupId) >= requiredRank then

   client.PlayerGui.Rooms.Enabled = true

   client.PlayerGui.StaffTeleport.Enabled = true

end

2 answers

You need to use the rank as a name, not a permission number

local ID = 5169488

game.Players.PlayerAdded:Connect(function(p)
if p:IsInGroup(ID).Rank == "Admin" then
--let's say for instance there's a part that cancollide = true
Instance.new("Part").CanCollide = true
end
end)

3 comments

0

So, if there are multiple ranks needing to see it, would I write them all down there?

0

or i guess you can do "if p:IsInGroup(ID).Rank == "Admin" or p:IsInGroup(ID).Rank == "Member" then" this is how you do it

0

I dont think my script works

You have almost done it, the thing is that you need to use :GetRankInGroup() and not :GetRoleInGroup().

GetRank returns the rank id that the player has, this is what you would want to use.

GetRole returns a string name of the players rank/role.

This discussion is preserved as it was. New answers, comments, and votes are closed.