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
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.
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
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)
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.
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
--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.