[Solved] Loading scripts - somewhat confused

I know there are lots of posts related to loading screens, though it’s due to the diversity of answers that looking into making load screens has made me more perplexed than I originally started with. The sources I’ve looked into are listed below (names are my own interpretation of what I took from them), the actual content will follow afterwards.

Most of these sources seem to be old so pardon me if my assumptions are all incorrect.

Sources

PreloadAsync vs RequestQueueSize
Roblox’s core loading script (post)
Roblox’s core loading script (GitHub)
Loading screens being pointless
DevHub Page
DevHub RemoveDefaultLoadingScreen

So this will mostly be me saying what I think I know about this and hoping to find out whether this is true or not.

  • PreloadAsync should be used over RequestQueueSize - not entirely sure why, people have stated different reasons - I think it’s related to RequestQueueSize being able to also increase when new assets are downloaded (?) (Solved)

  • If you use PreloadAsync, you shouldn’t do it on the whole game. Would it be a good idea to find the parts surrounding the player within a certain radius and then preload those? (Solved)

  • If you want to remove the loading screen, you need to put a LocalScript into ReplicatedFirst because scripts there run first. However, the wiki page says:

Note if any object has been placed in ReplicatedFirst , the default loading screen will remove after 5 seconds regardless if this function has been called or not.

A LocalScript should be cast as an object? Does that means that it would take 5 seconds to remove the loading screen? Should it still be placed there? Am I wrong in assuming that ROBLOX registers the LocalScript as an object? (Solved)

  • In order to display a GUI to the player, they need to have a PlayerGui but, as this post states:

Does this mean that even if you got the loading screen removed immediately, there would still be a delay where players could see the content of your game loading in? (Solved)

I feel like I’m missing something important here?

EDIT: Tried testing RemoveDefaultLoadingScreen in Studio along with a part object in ReplicatedFirst - There was a removal delay for the screen both with and without the part, however the time for the delay was roughly the same?

Solutions to each question found in brackets at the end of the questions - thanks to all who helped :slight_smile:

2 Likes

You would put your loading script into ReplicatedFirst, this allows it to load and run before everything else has a chance to load in. If you place a LocalScript inside ReplicatedFirst, that LocalScript will execute immediately when the player enters the game. This allows you to place a GUI inside the LocalScript, which can be parented to PlayerGui. Since the GUI was in ReplicatedFirst with the LocalScript, it has already been loaded and will be visible when it is placed into PlayerGui. You may have to preload assets with PreloadAsync if you have any images or assets within your GUI. Make sure you load these using the script inside ReplicatedFirst, so that these take immediate priority when a user joins the game.

This should hopefully clear up some of your confusion on how you would make the loading screen appear immediately.

1 Like

So if descendants aren’t directly underneath ReplicatedFirst but instead of a child of ReplicatedFirst, then there isn’t a 5 second delay?

There is no 5 second delay if you remove the default loading GUI from roblox. What it was saying is that if there is a descendant of ReplicatedFirst then the default loading GUI will disappear after 5 seconds no matter what, even if you decided not to remove it manually.

1 Like

Here’s my way of doing this:

local PlayerService=game:GetService("Players")
local Player=PlayerService.LocalPlayer
local PlayerGui=Player:WaitForChild("PlayerGui")
script.Parent.Parent=PlayerGui
local StarterGui = game:GetService("StarterGui")
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All,false)
local ReplicatedStorage=game:GetService("ReplicatedFirst")
ReplicatedStorage:RemoveDefaultLoadingScreen() 

Script.Parent being the GUI Object, everything inside ReplicatedFirst.
So far I didn’t experience any delay whatsoever.

1 Like

RequestQueueSize is the number of images/sounds/whatever else being loaded. It increases when a Sound object, Decal, etc. loads in. For that reason, it’s not an accurate reflection of how much of the game is loaded.

I don’t think preloading parts is possible, but even if you can it’s not worth it. Images and sounds take longer to load, so you should load any images you use in your UI or billboards or whatever.

2 Likes

This is false. Non-zero children of ReplicatedFirst and explicitly calling RemoveDefaultLoadingScreen behave the same way; there is a 5-second hard-coded delay before the screen is removed.

1 Like

So there will remain a 5 second delay when you use RemoveDefaultLoadingScreen? Or is there a way to get past/decrease the delay?

Yeah. The 5 second delay will stay and there’s no way to get past it as it’s hard-coded.

So if you replaced the CoreScript with a copy without the wait, you could get past this? Then add appropriate changes to the script to incorporate your custom loading UI.

You can go into your own client CoreScripts directory on your computer under the latest version of Roblox and change the wait but that’d only affect you, not anyone else. You can’t get past this using only platform APIs and make the effects work with everyone.

1 Like