Load all client UI once instead of a wall of WaitForChild

I’ve built my GUI, and now I want to program it… Well, get ready to write local component = Parent:WaitForChild("Component") a million times…

I want to load (or wait for) all my UI to load at once without WaitForChild walls.
I do not currently know of a way to do this. I know ContentProvider:PreloadAsync() can well preload Instances, but to my knowledge (Correct me if I’m wrong), it will not work with UI because it doesn’t exist yet and has to be replicated from server to client.

PreloadAsync can’t preload any instance. You would need to give the instance to the method, which would mean the instance already exists. The method’s meant for preloading content IDs associated with the given instance(s).

There’s not much of a point to going above and beyond to ultimately do the same thing: wait for GUIs to exist. Just cope with having to use WaitForChild. You could abstract references to the GUI’s descendants in a ModuleScript

Mb then, misunderstood part of the functionality of PreloadAsync.
It seems this is one of the few things I can’t improve for Qol roblox development, unfortunately.

Anyways thank you for this new insight!

You can put it in ReplicatedStorage
To my knowledge, everything here is loaded before scripts ran

So then you just parent it to player gui and can get any objects without wait for child (Worked for me)

its more like you have the wrong approach for ui, it should be made on the client in the first place and you wouldnt have had to go through this

You didn’t understood him I think

I currently have Players.CharacterAutoLoads disabled and I need to clone the UI from StarterGui into PlayerGui. It seems to be working as I would like for declaration and it is similar to your ReplicatedSotrage approach.
In further testing, I’ll probably set your reply as the solution because it is very similar to what I am doing.

1 Like