What do you want to achieve? So, I’m making a Admin Panel for one of my game.
What is the issue? It doesnt show the button for the creator or player It worked like 2 hours ago ive checked all my scripts and I dont know why it dont work…
Script:
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.")
end
if plr.Name == "vipmejorV2" then
btn.Visible = true
print("User is Admin.")
end
local function Open()
gui.Visible = true
end
btn.MouseButton1Click:Connect(Open)
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
end
end);
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
end
end);
If you have any questions please don’t hesitate to ask. I hope this helped.
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.