I have an admin console that spawns maps and shows available commands. I want it to only show to people with certain ranks (RANKS: 16,17,252,253,255)
Here is my current code that doesn't work.
local rank = 16 local groupID = 4126160
script.Parent.Touched:connect(function(hit) if (hit and hit.Parent and game.Players:FindFirstChild(hit.Parent.Name)) then if (game.Players[hit.Parent.Name]:IsInGroup(groupID) and game.Players[hit.Parent.Name]:GetRankInGroup(groupID) <= rank) then script.Parent.Enabled = true else script.Parent.Enabled = false end end end)
Thanks for your help!
Your method of disabling the GUI is not at all adequate as the client could easily enable the GUI or avoid touching the brick. You also gave multiple errors in your code such as flipping your sign and not spacing properly.
Instead of doing what you did, I will create a table for all the ranks that are allowed to get the GUI, and only insert the GUI into those who are the proper rank.
In order for this to work you must NOT place the Gui in StarterGui, you must place it inside of this script. This script should be placed inside of ServerScriptService.
Ranks = {16,17,252,253,255} -- Allowed ranks GroupID = 4126160 GUI = script:FindFirstChildOfClass("ScreenGui") Players = game:GetService("Players") Players.PlayerAdded:connect(function(Player) if Player:IsInGroup(GroupID) then local Allowed = false for _,Rank in pairs(Ranks) do if Player:GetRankInGroup(GroupID) == Rank then Allowed = true break -- Stop searching end end if Allowed then -- If allowed to see the gui local NewGui = GUI:Clone() -- copy of the GUI NewGui.Parent = Player.PlayerGui end end end
I hope I helped! Let me know if you have any questions.