Creating a Loading Bar based off of number of assets loaded

I’m using PreloadAsync to load assets in a GUI upon the LocalPlayer’s entry.

I’d like to create a Loading Bar (literally just a frame) that loads in equal increments depending on the number of assets there are to load (Lets say 30). How would I go about doing this?

bar.Size =, 0, 1, 0)

Put a frame inside your frame that’s sized with scale and use this on that frame


As far as I know, If you wanted to have an exactly accurate progress bar, you’d have to call PreloadAsync 1 by 1 through your array, as such:

local loadables = {} -- your loadable array.

local amount_loaded = 0
for i = 1, #loadables do
	amount_loaded = i
	loading_text.Text = i.."/"..#loadables
	bar.Size =,0,1,0)

local loadables = {} -- your loadable array.

local thread = coroutine.running()
local amount_loaded = 0
for i = 1, #loadables do
        amount_loaded = amount_loaded + 1

while amount_loaded ~= #loadables do
    loading_text.Text = amount_loaded .."/"..#loadables
    bar.Size =,0,1,0)

I’ve quit games that tried force me to stare at their fancy loading bar. The best loading bar is no loading bar. Working around it will be different for every game, but if you have a waiting room for the next round, a consistent starting area, or a starting customization gui, you know which assets need to be loaded first. Just load those, then let Roblox do its thing and stream in the rest in the background.


Subjective. Some games simply do not look swell with missing assets, or possibly can’t run without such assets. There’s a reason that most or all games use loading screens or bars and don’t run the game assuming that they can be loaded in later; having such on Roblox games is no different.

The one thing I can agree with here is that every game has a way to workaround starting people off with a loading bar though. It’s good to preload assets that need to be seen immediately first before anything else, that way when people are preoccupied with things they can see, what they can’t see is streamed in the background.


I’ve also removed the default loading screen so I mean, it doesn’t make that much of a difference. I’ve tested it and it’s as quick if not quicker than the loading screen Roblox has.

IMO It’s better to sacrifice some of the aesthetic of a game by allowing players to load in assets as they play rather than risk giving a bad first impression with a long loading screen


Now, if your game has lots of assets, inserting them into it will be a pain


Also, your code isn’t very flexible for other users to use. You must take that into consideration and also provide neat and properly presentable code (with indents and formatted :persevere:). (Talking about that workspace.HangoutFloor1:GetDescendants())
Instead of use elseif’s, you could have just used a basic if statement with or.

And I don’t mean to be rude randomly judging code, just looking to fix other’s code and improve scripting community.

1 Like

PreloadAsync automatically takes in the related asset ids of descendant instances, so there’s no need for a developer to manually push an instance’s descendants into a table for PreloadAsync. Additionally, the table which PreloadAsync operates on only takes instances, not strings.

It’s not recommended that you do this anyhow because this isn’t proper use of PreloadAsync but for developers that insist on doing it, then there’s a different way to get this done which is… just using the array that GetDescendants returns, lol. It wouldn’t preload the ancestor instance though and inserting it would be redundant because then the ancestor’s descendants would be preloaded twice.

local assetCache = workspace.HangoutFloor1:GetDescendants()

Loadables in Fiery’s code sample is just a placeholder to represent the assets that you’re passing into PreloadAsync. Realistically you should never be passing a large amount of assets to PreloadAsync because that’s the same as passing nothing and you’re thus not getting the full benefits of PreloadAsync other than a long loading screen which is bad for UX. Only assets the player should be seeing immediately (e.g. main menu content) should be through PreloadAsync.


Anyone know if there’s a way to do this but instead of having loading_text.Text = amount_loaded .."/"..#loadables you have it tell you which assets are being loaded?

loading_text.Text = 'Loading ' .. loadables[i].Name

where loadables[i] is the object currently being loaded and we’re taking it’s Name property.

1 Like

Something I wrote for my game

local count = 0
for i = 1, #assets do
	count = i
	script.Parent.tell.Text = i.."/"..#assets
	bar.Size =,0,bar.Size.Y.Scale,0)

Assets is a table with all the things I want to load, it goes through each table item and loads it, the PreloadAsync yeilds until the thing is loaded

I forgot the reason why I even made the count variable but this never failed to work so uhhhh

Realistically you should never be passing a large amount of assets to PreloadAsync because that’s the same as passing nothing and you’re thus not getting the full benefits of PreloadAsync other than a long loading screen which is bad for UX.

Very True. Just Bumped into that Issue trying to Load a Map with Around 5K Assets. Taking 2 Game Rounds to Finish. Guess Ill let Roblox Handle that And Use the Loading for UI and Instant Sight type of Stuff!