Cannot find another StarterGUI from within a StarterGUI Local Script

  • What are you attempting to achieve? (Keep it simple and clear)
    I am trying to alter the enabled property of a startergui from another startergui. IE a startergui contains the frames for all my buttons in-game, whereas the startergui with the localscript trying to disable the enabled property is an intro gui, which will disable the gui when it is active, and enable it once it is de-activated.
  • What is the issue? (Keep it simple and clear - Include screenshots/videos/GIFs if possible)
    The error states that it cannot find the GUI within PlayerGUI, but this error should only occur if it is either a server-side script or if the GUI does not exist, neither case is present.
  • What solutions have you tried so far? (Have you searched for solutions through the Roblox Wiki yet?)
    What solutions are there? It should work, yet it doesn’t.

You may then include any further details.


image
image
(I have blanked the sound names, but those are irrelevant anyway)

The script tries to run your line when the player (and its descendants, i.e. your GUI) haven’t fully loaded in yet. You can easily fix this by using WaitForChild(); then the script will wait until it finds your ‘GUIs’ object and won’t throw an error.

local gui = script.Parent.Parent:WaitForChild("GUIs")

gui.Enabled = false

^ Possible Implementation

FYI: #help-and-feedback:scripting-support would be a better category for your topic

3 Likes

well I wasn’t sure whether gui would come under scripting or building more, but thanks.
Also yeah that might well be the problem, I’ll try that thanks!

1 Like

Thanks, it worked! Also cleaned up some of the code while I was at it, and no more errors.

1 Like