It’s actually very easy easy to do once you know what you are doing. There are several steps you need to do to get this to work.
- Disable default loading screen
- Replace with your own loading screen. The less assets/pictures and fonts it has the faster the loading screen will load. (I have seen some games take a while to load up on a bad internet connection)
- Preload using ContentProvider
- Wait for game to load
- Delete loading screen and init eveything else you want to do for the game.
Only assets need to be loaded when you join the game. This includes: Pictures, Audio, Videos, Meshes, Union(sorta). Data is also loaded but depending on that data it is sometimes streamed in if the player does not have enough RAM.(Best thing to do in this case is to wait for the game to load)
Remove the default loading screen with
game:GetService("ReplicatedFirst"):RemoveDefaultLoadingScreen()
ContentProvider includes a callback parameter which you can use to update the loading screen.
Here is an example:
ContentProvider:PreloadAsync(
{game},
function(asset: string,assetFetchStatus: Enum.AssetFetchStatus)
print("Loading:",asset)
print("Status:",assetFetchStatus.Name)
end
)
Output:
Loading: rbxasset://textures/ui/Settings/Help/AButtonDark.png
Status: Success
Loading: rbxasset://textures/ui/Scroll/scroll-bottom.png
Status: Success
Loading: rbxasset://textures/ui/Vehicle/SpeedBarBKG.png
Status: Success
Loading: rbxasset://textures/ui/ErrorPrompt/ShimmerOverlay.png
Status: Success
Loading: rbxassetid://4965945816
Status: Success
Loading: rbxasset://textures/ui/Keyboard/key_selection_9slice.png
Status: Success
Loading: rbxasset://textures/ui/Settings/Help/BButtonDark.png
Status: Success
Loading: rbxasset://textures/ui/Scroll/scroll-top.png
Status: Success
Loading: rbxasset://textures/ui/Scroll/scroll-middle.png
Status: Success
Loading: rbxasset://textures/ui/Settings/Help/XButtonDark.png
Status: Success
Loading: rbxasset://textures/ui/ErrorPrompt/PrimaryButton.png
Status: Success
Loading: rbxasset://textures/ui/LuaApp/graphic/shimmer_darkTheme.png
Status: Success
Loading: rbxasset://textures/blackBkg_round.png
Status: Success
Loading: rbxasset://textures/loading/cancelButton.png
Status: Success
Loading: rbxasset://textures/ui/Vehicle/SpeedBar.png
Status: Success
Loading: rbxasset://textures/ui/Vehicle/SpeedBarEmpty.png
Status: Success
Loading: rbxasset://textures/loading/robloxTilt.png
Status: Success
Loading: rbxthumb://type=GameIcon&id=1131304171&w=256&h=256
Status: Success
Loading: rbxasset://textures/ui/PurchasePrompt/LoadingBG.png
Status: Success
Loading: rbxasset://textures/ui/NetworkPause/no connection.png
Status: Success
As you can see it loads in pictures, thumbnails too and even module scripts.
Side note: “rbxassetid://4965945816” is the ring for the loading screen I used. As you can see it does not get loaded instantly. So, if you want an instant loading screen try to not use pictures and just use UI elements.
After you will wait for eveything else to be streamed in. You can either do that by using the: Player.GamePlay Paused. (If you use streaming enabled)
Otherwise use
if not game:IsLoaded() then
game.Loaded:Wait()
end
One last thing: If you want to know how to count the time it takes to load your game up you can use
local clock = os.clock()
-- Code
print(("Preloading complete, took %.2f seconds"):format(os.clock() - clock))]]
To check how fast your game loads
There are some more readables on Game Content