Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago

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

Log in to vote
0
Answered by 4 years ago

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)
0
So, if there are multiple ranks needing to see it, would I write them all down there? Diamond9195 45 — 4y
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 User#29913 36 — 4y
0
I dont think my script works User#29913 36 — 4y
Ad
Log in to vote
0
Answered by
Lucke0051 165
4 years ago

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.

Answer this question