How do I make a asset preloading loading bar?

So I’m here back again, and I’m a bit too rusty on scripting and forgot about random parts on how I’m supposed to do what I want.

Neighborhood war [OLD] [READ DESCRIPTION] - Roblox

Basically I’m making a game that uses a lot of assets and require them to run the game properly(horror game decals, audio, etc). I want to make a loading bar similar to that so the players can know that the assets are actually loading themselves and is not stuck. What I mean by stuck is sometimes roblox gives an output on the terminal saying it failed to load a particular asset. I don’t want that to happen.

My idea of making this is making a folder with subsections like

  • Assets
    • Audio
    • Decals
    • Meshes

then adding them to a table and call them out using a variable, but idk how to make the tweening animation to make it so that the bar tweens smoothly with the progress of the preloading of the assets.

Sometimes I think if I should even pursue this kind of thing because I usually ask here if I hit a wall on scripting.

2 Likes

Hey there the basic concept of making such a bar is using tween Size and Getchildren wisely.
This requires some basic knowledge of ratios as well. First you have to get children from the folder eg: audio folder, etc and then do a wait for child to check if the instance exists and then tween the size of the bar.

But i believe such a system would be useless since all items replicate really quick in roblox, many other games have this kind of a loading screen system, but it is used only during teleportation of players from game to game. If the loading screen is used for anything else other than teleportation it’s probably a fake one.

3 Likes

For this case I’d recommend using

game:GetService("ContentProvider")

Here you will need a table of your assets which you’d like to load i.e

local Assets = {"rbxassetid://123123"} -- This is jus an example

To be quite fair, you probably won’t need a loading bar, you could just make a frame or an image which is present while the assets load, since the method which I will show essentially yields your script.

Then you’d use:

ContentProvider:PreloadAsync(Assets)

This would literally preload all of your assets! To be quite honest, I believe you would be able to figure out how to apply a loading bar to this, but in all reality, you don’t really need it, since preloading will be really quick.

1 Like

Yes I am already using that line of codes, but I want to reapply it to a loading bar for aesthetics and to clarify that the game is actually loading and didn’t fail to load. There are some times where players complained to my past game that the game still didn’t load after couple of minutes in the game considering I have a lot of assets audios in game. I need the loading bar to clarify it’s loading to players.

Well that’s my problem since I’m bad at ratio’ing subfolders and I don’t know the math’s to do this.

Though you are right, this system would be somehow useless though not to those who have crappy internet connection like me. I really enjoy seeing loading screens that show the progress of how loaded the game is for me whilst knowing that it is still loading and not stuck.