PlayerID only GUI not showing up

  1. What do you want to achieve?
    An Admin Panel GUI that appears if a Player with matching ID joins

  2. What is the issue?
    The GUI doesn’t show up. It says its not a valid Member of PlayerGui

  3. What solutions have you tried so far?
    Adding “WaitForChild” But now I get a “Infinite yield possible” Warning

Here is the Script (game.ServerScriptService):


local AdminAccess = {
	[117780107] = "Owner lol"	;
	[1539509146] = "Loiternity"	;
}


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

			for userId, reason in pairs (AdminAccess) do
		if player.userId == userId then
					player.PlayerGui:WaitForChild("ADMINPanel").TextButton.Visible = true
					end				
			end
		end)

Maybe because it doesn’t exist in PlayerGui?, try to check explorer or printing for ADMINPanel, make sure you have ADMINPanel in startergui if you want to enable it thru the playergui. (Insecure way of making an admin gui only, clone it to the player’s playergui if .playeradded is an admin instead.

I added this Line now:

local AdminPanel = game.ServerStorage.ADMINPanel:Clone()
			AdminPanel.Parent = player.PlayerGui

This works fine. But does it only show for the Whitelisted IDs?

if you add it into the player.UserId == userId statement, it should only show for the whitelisted people

1 Like

Do something like:

game.Players.PlayerAdded:Connect(function(plr)
   if plr.UserId == UserId then
     local AdminPanel = game.ServerStorage.ADMINPanel:Clone()
     AdminPanel.Parent = player.PlayerGui
    end
end)
1 Like