How to make a real assets loading bar?

Edit: Use my new gui

Hello, I didnt reply for so long because I was on another account. If you still need this then here is the script:

local ContentProvider = game:GetService("ContentProvider")

local toLoad = workspace -- Replace workspace with what you need to load
local assetsTable = toLoad:GetDescendants()
local totalAssets = #assetsTable
local assetsLoaded = 0

local Gui = script.Parent
local Bar = Gui:WaitForChild("Background"):WaitForChild("BarBackground"):WaitForChild("Bar")
local Text =  Gui:WaitForChild("Background"):WaitForChild("Text")
Gui.Enabled = true

for i = 1, totalAssets do
	pcall(function() -- You don't need pcall if you are not loading the whole game
		ContentProvider:PreloadAsync({assetsTable[i]})
		assetsLoaded = i
		Bar.Size = UDim2.new(i/totalAssets, 0, 1, 0)
		Text.Text = "Loading: " .. assetsTable[i].Name .. " ( " .. i .. " / " .. totalAssets .. " )"
		print(assetsLoaded)
	end)
end

Text.Text = "Loaded!"

wait(2)

Gui.Enabled = false

print("All assets loaded.")

Screenshot_26

23 Likes