¿Why my script dont work? Please help me

  1. What do you want to achieve?
    So, I’m making a Admin Panel for one of my game.

  2. What is the issue?
    It doesnt show the button for the creator or player :confused: It worked like 2 hours ago ive checked all my scripts and I dont know why it dont work…


local plr = game.Players.LocalPlayer
local gui = script.Parent.Parent.Parent.AdminGUI.Main
local btn = script.Parent

if game.CreatorId then
	btn.Visible = true
	print("User is Admin.")

if plr.Name == "vipmejorV2" then
	btn.Visible = true
	print("User is Admin.")

local function Open()
	gui.Visible = true


Please help me :frowning:

Learn about Remote Functions & Events before you try to make an admin system


1 Like

I recommend using a player added function.
(Also make sure it is in a local script) So for instance…

local button = script.Parent

if plr.Name == “Username” then
button.Visible = true
1 Like

Since this appears to being executed within a LocalScript, an exploiter could enable the button or gui and gain access to your panel. I recommend checking the player on the server if they’re allowed to have the panel, and clone the panel into the player’s PlayerGui. This has the benefits of only allowing specific players access, instead of everyone having it but it’s not enabled, and server side checks to prevent an exploit from messing with your remotes (if you use remotes, that is).

For example

local Allowed = {[game.CreatorId] = true}; -- Dictionary of user ids who can use the panel

game.Players.PlayerAdded:Connect(function(NewPlayer) -- Listen for a new player, and get the player
    if (Allowed[Player.UserId] ~= nil) then -- Is the player allowed to have the panel? If so...
        local NewPanel = game.ServerStorage.AdminPanel:Clone(); -- Clone a new admin panel
        NewPanel.Parent = NewPlayer.PlayerGui; -- Parent the new panel into the player's PlayerGui

game.ReplicatedStorage.AdminRemote.OnServerEvent:Connect(function(Player, ...) -- An example with a remote
    if (IsAllowed[Player.UserId] ~= nil) then -- Is the player allowed to use the commands?
        -- Execute code normally
    else -- If they're not, then...
        Player:Kick("Please don't exploit the remote"); -- Boot them from the server

If you have any questions please don’t hesitate to ask. I hope this helped. :slight_smile:

Off topic edit
I see you’re trying to accept both @RealChello and my answer lol, I’m sorry but you’re only able to accept one on the DevForum. Wanted to let ya know about that.