Admin only GUI help

So I am working on coding a Admin panel but I wanna make it so only Admins and above, and also certain people can access the GUI how do would I do that???

3 Likes

Localscript:

If game.Players.LocalPlayer.Name = "ppwwppw2" then --see if name is in list
     -this localscript is in a gui frame.
     script.parent.Visible = true
else
     script.parent.Visible = false
end

Then do server side checks for commands sent.

Don’t worry! I will help you.
Put this local script at screengui you made.
I believe you do that.

Make you sure the screengui is disabled.
Try this code:

local plr = game.Players.LocalPlayer

if plr.Name == “YourUsernameHere” and “AnotherPerson” then
script.Parent.Enabled = true
end)

I may be suck at coding. cause haven’t practice yeah…

Maybe have a look at:
https://devforum.roblox.com/t/admin-panel-gui/861030

Tysm @xXSuperBoyxX124 @pro_9283 now I just gotta figure out how to code the group part but I think I can do that

Yeah, it should be easy. Hope you get it working!

You shouldn’t do plr.Name, as a player will change their Username in the nearby future.

If I were you, I would try something like:

local plr = game.Players.LocalPlayer

if plr.UserId == "plrIDHERE" or "anotherIDHere" then
 script.Parent.Visible = true
else
script.Parent.Visible = false
end

You can do what the others said, but if you want to put multiple users to be whitelisted, do this.

local Whitelisted = {IDS} -- for multiple id's, seperate them by a comma. (e.g: {1, 2, 3, 4}).

local player = game.Players.LocalPlayer


for i,v in ipairs(Whitelisted) do
	if v == player.UserId then
		script.Parent.Enabled = true
	end
end

(p.s: set the StarterGui from Enabled to false, and put this script in a Localscript.)

I recommend having a server script (with remotes AKA client-to-server communication) for the purposes of:

  1. Verification, i.e. making sure the player’s an admin
  2. Having events (kill, fling, etc) being able to run effectively
  3. The server verifies that the player’s an admin and gives them the gui, instead of the client handling that
1 Like

I don’t fully get what you mean here can you explain?

You should have admin verification be handled on the server, as well as handling giving the gui to them.

local AdminIds = {12345, 67890}
local AdminGui = -- path to gui

game.Players.PlayerAdded:Connect(function(NewPlayer)
    local IsAdmin = table.find(AdminIds, NewPlayer.UserId) ~= nil -- Is their user id in the admin list?
    if IsAdmin then -- Were they an admin? If so...
        local NewAdminGui = AdminGui:Clone()
        NewAdminGui.Parent = NewPlayer.PlayerGui -- Give them the gui
    end
end)

game.ReplicatedStorage.AdminRemote.OnServerEvent:Connect(function(Player, Command, Arguments)
    if table.find(AdminIds, Player.UserId) then -- A player called the remote - are they an admin? If so...
        -- Execute admin commands
    else -- However, if the player wasn't an admin...
        Player:Kick("You're not an admin.") -- Or however you want to handle a non-admin calling the remote (which wouldn't be possible without the gui)
    end
end)

And the gui (with command buttons/inputs) would call the AdminRemote, having the server verify the call/request.

Does this make a bit more sense?

5 Likes

Yeah ty now I get it.
What I ended up doing myself (I might do your recommendation still) is the following:
game.Players.PlayerAdded:Connect(function(Player)
if Player:GetRankInGroup(12502892) >= 253 then
script.parent.Visible = true
else
script.parent:Destroy()
end
end)

If that’s within the gui, that’ll only work when any player (aside from the local client) joins the game.
If a non-admin joined first, then an admin after, the non-admin would get the gui and not the actual admin.
I recommend the solution I recommended earlier instead.

1 Like

Ok limittttttttttttttttttttttttt

1 Like