Top bar button not appearing

So i want a tob bar button to appear for certain players, But it does not work.
This is a local script aswell.

Script
local Allowed = {
	133840022, --Me!
	1086569792, --lolllduts
	1322476304, --Witherstorm2086
	2941827753, --JelleV2015
	1525298988, --victirialistin
	1044329467, --meesterj4n
	292794842 -- Mischa123K
}
game.Players.PlayerAdded:Connect(function(plr)
	if table.find(Allowed, plr.UserId) then
		print("User going by the name of "..plr.Name.." is an admin!")
		local plrgui = script.Parent.Parent.PlayerGui
		local adminmenu = script.Parent.Parent.PlayerGui:WaitForChild("AdminGUI").Frame
		local Icon = require(game.ReplicatedStorage.Icon)
		local icon = Icon.new()
		icon:setCaption("Open Admin Menu [Q]")
		icon:setLabel("Admin Menu")
		icon:setImage("rbxasset://textures/ui/PlayerList/developer@3x.png")
		icon:bindToggleKey(Enum.KeyCode.Q)
		icon.selected:Connect(function()
			adminmenu.Visible=true
			plrgui:WaitForChild("ScreenGui").Enabled=false
		end)
		icon.deselected:Connect(function()
			adminmenu.Visible=false
			plrgui:WaitForChild("ScreenGui").Enabled=true
		end)
	else
		print("User going by the name of "..plr.Name.."Is not an admin!")
	end
end)

Can anyone help me?
(TopbarPlus was used)

Also, There is NO ERROR or warning AT ALL.

Just tested a newer version of the script.
It successfully works.

New script
local Allowed = {
	133840022, --Me!
	1086569792, --lolllduts
	1322476304, --Witherstorm2086
	2941827753, --JelleV2015
	1525298988, --victirialistin
	1044329467, --meesterj4n
	292794842 -- Mischa123K
}
if table.find(Allowed, game.Players.LocalPlayer.UserId) then
	warn("User going by the name of "..game.Players.LocalPlayer.Name.." is an admin!")
	local plrgui = script.Parent.Parent.PlayerGui
	local adminmenu = script.Parent.Parent.PlayerGui:WaitForChild("AdminGUI").Frame
	local Icon = require(game.ReplicatedStorage.Icon)
	local icon = Icon.new()
	icon:setCaption("Open Admin Menu [Q]")
	icon:setLabel("Admin Menu")
	icon:setImage("rbxasset://textures/ui/PlayerList/developer@3x.png")
	icon:bindToggleKey(Enum.KeyCode.Q)
	icon.selected:Connect(function()
		adminmenu.Visible=true
		plrgui:WaitForChild("ScreenGui").Enabled=false
	end)
	icon.deselected:Connect(function()
		adminmenu.Visible=false
		plrgui:WaitForChild("ScreenGui").Enabled=true
	end)
elseif not table.find(Allowed, game.Players.LocalPlayer.UserId) then
	print("User going by the name of "..game.Players.LocalPlayer.Name.."Is not an admin!")
end

Where is the script located? If it’s in the wrong place, PlayerAdded might not be reliable.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.