Loading screen showing how many assets are left to load

Hello developers,

I’m currently looking on how to make a loading screen for my game. But i was wondering how could i make a loading screen that shows how many assets are left to load. And how could i do this in a script?

Thanks in advance!

1 Like

There is a function to preload assets (then they work immediately) called ContentProvider:PreloadAsync(). :hugs:

Could i show you an example on what i mean with my topic?

1 Like

As stated from @Wixonic_FR 's post, use ContentProvider’s preloadasync function, then insert your callback function to tell you how many assets left to load

local assets = {
  --put the assets 

local TotalAssets = #assets
local AssetsRemaining = TotalAssets

function TellRemainingAssets()
   AssetsRemaining = TotalAssets - 1

ContentProvider:PreloadAsync(assets, TellRemainingAssets)

Untested but according to documentation it should work


Unfortunately you have to put manually all the assets you want to load, otherwise it won’t work.

local ContentProvider = game:GetService("ContentProvider")

local AssetsToLoad = {
    -- And all assets...

local AssetsLeft = #AssetsToLoad

for _, Asset in pairs(AssetsToLoad) do
    ContentProvider:PreloadAsync({"rbxassetid://" .. Asset})
    AssetsLeft -= 1

I found a old topic about this, could this also work?

local WorkspaceAssets = workspace:GetDescendants()
local PlayerGuiAssets = localPlayer.PlayerGui:GetDescendants()

for Id,Asset in pairs(WorkspaceAssets) do
	local AssetsLeft = #WorkspaceAssets - Id + 1
	if AssetsLeft == 1 then
		new.Container.AssetsProgress.Text = "Loading... (1 Asset Left)"
		new.Container.AssetsProgress.Text = "Loading... ("..AssetsLeft.." Assets Left"
1 Like
  1. I don’t think this works
  2. I’m sure it doesn’t work for images and sounds