Myself and my team are trying to create a Custom Loading Screen but we’re having a few issues, the player appears in the game before the Splash Screen is loaded. And that sometimes the warning:
‘Infinite Yield’ is returned when the :WaitForChild is used on Localplayer.PlayerGui to load the UI in.
We’re using a LocalScript which is placed into ReplicatedFirst (A client-side service which is often used for loading GUI’s) I don’t see why remote events have to be used for this.
“A container whose contents are replicated to all clients (but not back to the server) first before anything else.” Documentation - Roblox Creator Hub
The LoadingGui is a child to the LocalScript and scripts inside are disabled, the main parent LocalScript deals with enabling the scripts once it is loaded onto the PlayerGui, but it seems that ReplicatedFirst doesn’t see PlayerGui as the player is loading. I’m unsure of how to solve this.
Same happens to me as well, in my local script in replicated first, I can’t use a :WaitForChild , but instead I have to use a While() look and :FindFirstChild to be able to get the playergui without errors. And yes, a lot of times this causes the character to display before the custom load screen can be displayed.
I have been encountering this problem as well and have been using repeat to wait until the PlayerGui is not nil. This allows the character to be visible for a split second before the loading UI appears. I have been unable to find a solution and it’s a little annoying.
As far as I’m aware, this has always been a problem. The PlayerGui is added in sometime after ReplicatedFirst scripts start.
A workaround is to use a BillboardGui or a SurfaceGui and put it in front of the camera on every frame. This looks identical to a gui in PlayerGui, but you don’t have to wait for the PlayerGui to appear.
I’ve never relied on the PlayerGui appearing soon after starting; it has always seemed to take too long for me. Maybe that changed recently, but the workaround I use is still relevant.
I still am trying to figure a way around this. I tried @Corecii’s method but I always ran into issues and could not get it implemented. If anyone would be willing to share a solution that’d be helpful.
You can optionally move the Gui from a BillboardGui to a ScreenGui once the PlayerGui appears. I don’t do that here because it’s only meant to be a simple example.
It seems to be a prevalent issue when the game is large. Don’t quote me since I have no clue what the technical shenanigans is occurring (correct me if I’m wrong), but I do believe that the engine is prioritizing the loading of the Workspace, before ReplicatedFirst.
And since the workspace is so large. Instances in ReplicatedFirst haven’t loaded in yet.
The loading screen needs to be in well before the character loads. The issue is that they couldn’t get it to properly wait for PlayerGui, but they solved the issue.