Why isn't my script finding the guy in playergui?

I am using topbar+ to create a new button in the Topbar.

However, it says that it can not find the settingsGui in playerGui, but when I go to my explorer it is there.

local iconModule = game:GetService("ReplicatedStorage").Icon
local IconController = require(iconModule.IconController)
local Themes = require(iconModule.Themes)
IconController.setGameTheme(Themes["BlueGradient"])
local settingsFrame = game.Players.LocalPlayer.PlayerGui.settingsGui.Frame

local icon = iconModule:new()
	:setImage(485882402)
	:setCaption("Settings")
	:setCornerRadius(0, 8)
	:bindToggleItem(settingsFrame)

icon:notify()
1 Like

It could be that settingsGui does not load in time.

Since this is on the client, I would make use of WaitForChild

2 Likes

ok. I will try that right now!