How can I make a loading screen that actually loads assets, and returns what percentage of loading the assets its at?
Get a list of all instances in the game
local instances = game:GetDescendants()
Then cycle through each instance and preload it using the ContentProvider service
for i= 1, #instances do
local current = instances[i]
ContentProvider:PreloadAsync({current})
--Here you would probably want to update your loading screen's progress bar
Inside the loop, you can calculate the progress/percentage like this. You would use that to set the length of your loading bar, and maybe display a text showing the percentage.
local progress = i / #instances
this works exactly, however i recommend making a table to put important assets only you want to load and not getting everything in game because its going to take way too long to load that all
This might be needed for games with A LOT of assets. But I use this in my game with not too few assets and it the loading speed is definitely not an issue.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.