Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do you create a loading bar that waits for all of workspace to load?

I have a game I want to add a loading bar to. It is just the map in workspace with normal roblox game streaming. I can’t figure out how to make it work all the tutorials I see use PreloadAsync on a replicated storage model. I can’t find any way to get a percentage or number of assets loaded from standard roblox loading. I don’t want to do that since it makes development hard and and empty void makes it annoying to mess with.

1 answer

https://web.roblox.com/library/3648837674

You can calculate the percent like this:

local ContentProvider = game:GetService("ContentProvider")
local ItemsToLoad = game:GetDescendants()
local TotalItems = #ItemsToLoad
local Percent

wait(5) --Wait for the game to load up the assets, there are better methods, this is for testing
for Number,Object in pairs(ItemsToLoad) do

	Percent = math.floor((Number / TotalItems) * 100 + 0.5)
	ContentProvider:PreloadAsync({Object})	
	print(tostring(Percent) .. "%")
	--Set the loading bar size, make a label with the percent, blah blah blah

end

This discussion is preserved as it was. New answers, comments, and votes are closed.