I recently noticed a discussion where people were discussing when :WaitForChild() is necessary and when it is not. I think that a lot of Roblox’s loading procedures remain a mystery to a lot of us, which leads to overusing :WaitForChild() just to be safe.
So, my question here is: can we expect the entire environment to exist prior to the execution of server scripts in ServerScriptService?
You basically never have to use :WaitForChild() on the server for instances that are pre-made in studio. The only time you’d need to use :WaitForChild() on the server is if you are creating instances via code, and are needing a reference to it in an alternate script.
Always use :WaitForChild() on the client as it takes time to replicate.
While we’re here, I also heard something about client replication that perhaps you can shed some light on.
I heard that, when a top level object (let’s say PlayerGui.ScreenGui) is replicated, all of its’ children will exist immediately. Which would mean that we wouldn’t have to be using :WaitForChild() on children of that ScreenGui object, if my explanation makes sense. Is that true?
really just trying to reduce my usage of :WaitForChild() as it’s really ugly and bad if it’s unnecessary
I’ve tested with the .ChildAdded event, and it seems like scripts insife ServerScriptService are ran before most of the Workspace children are loaded in.
Reviving thread again, I don’t get why we can’t get a straight answer on this. This is pretty important to not breaking core server scripts by accidentally indexing into something before it exists, and halting the thread from the error