Gui only the devs see

In a game I am making on roblox, I want to add a button GUI/text button that only the devs can see. I tried doing

Local server=if plr = (Ninja_Justin3) than screen GUI = true
if not = false
end
end

This script above is for me

Local server=If plr = (iiKloee) than screen GUI = true
if not = false
end
end

This script is for my cousin aka the other dev.

6 Likes

Use a while true do loop;

local player = game.Players.LocalPlayer
while true do
     wait()
     if player.Name == "(name of player here) "  then
          script.Parent.Visible = true
    end
end
3 Likes

create a dictionary with all the developers user ids, and when a player joins check if their user id is in that dictionary, if it is clone a gui into their player gui

2 Likes

Use the player added event and utilize a list, it’ll look something like this:

local validPlrs = {"Player1", "Player2"}
  
-- I was too lazy to actually implement the onPlayerAdded but you get the jist of it
onPlayerAddedEvent:Connect(function(player)
  if validPlrs[player.Name] then
     -- Make gui visible here
  end
end)

You don’t need a server script for making gui’s visible, but you’ll need it if you wanna make the gui safe, in case it has admin commands and such.

3 Likes

i dont understand why it’d need to be a while true do loop, this should suffice:

local player = game:GetService("Players").LocalPlayer

if player.Name == "username" then
    script.Parent.Visible = true
end

EDIT:
or even better… :

local player = game:GetService("Players").LocalPlayer

if player.UserId == 144029154 then --this is my id, put your own id here
    script.Parent.Visible = true
end
1 Like

Do a server script and place the gui inside of it, this makes it more secure, then use this code:

local frame = script.GuiName --replace with your gui name

game.Players.PlayerAdded:Connect(function(player)

if player.UserId == 0 then --replace 0 with the dev user id 
frame:Clone.Parent = player.PlayerGui
end
end)

2 Likes

this is actually a lot better than my method as any player could execute a script that makes it visible if they were exploiting for my method, but it’s not possible for this method. :smiley:

but how do i make it so it knows what GUI i mean

Shouldn’t be an infinite loop, you only need to check when they join.

Let’s say for example the GUI was in the workspace
You would change the variable to a GUI in the workspace.

local frame = game.Workspace.GUI

Replace the GuiName thing with ur GUI and make sure it’s in the script

ok thanks so basicaly what you mean is for the script I put

script.DevControlPlace.Gui etc?

That would crash because there is no wait() in the loop.

Just put the gui with the frames in the same one last the button if you know what I mean then it should work

Yes, obviously there should be a wait. That was a mistake on my part

i think I understand but what do you mean by “name” of the GUI?

The you named you GUI in the explorer, copy the name in there

also, you wouldn’t need a loop anyways as the username is set once, doesn’t change, and could just be checked once and then that script can be ignored. a lot of other examples done this where it was esentially the same code as you apart from there was no while true() do loop

2 Likes

The name of the gui like what holds the frames

You should do something like this:

--start a function when a player joins
game.Players.PlayerAdded:Connect(function(player) 
-- checking the UserId
	if (player.UserId == put id here) then
		-- run code
	end
end)

Pretty sure this should be done through a LocalScript, but correct me if I’m wrong.

2 Likes