Have objects in PlayerGui load before script execution

As a Roblox developer it is currently too hard to have scripts run that reference objects in PlayerGui that loads after it.

Basically, its either I spam :WaitForChild or get an error.

Has loading objects in PlayerGui and its children ever been so slow? I even tried wait(.1) at the beginning of script execution, and it still breaks sometimes.

Have objects in PlayerGui load before script execution.

3 Likes

Do you mean local scripts anywhere on the client or only ones in guis? obviously doing this to all client scripts would break a lot of games, not sure about ones in guis though

Only in guis.

Why would it break games?

It’s just better practice to use :WaitForChild()

There are definitely client scripts that should not yield before executing in some games.

What? Op was talking about gui loading before anything else, not scripts.

Op is talking about PlayerGui being cloned from StarterGui so localScripts won’t have to wait for members at runtime. Sounds lazy.

No I meant that if this was implemented it would have to only be with local scripts within GUIs, some local scripts outside guis make references to GUIs too, so these would still need a WaitForChild.