local loadables = {
game.Workspace.Assets
} -- your loadable array.
local ContentProvider = game:GetService("ContentProvider")
local PlayerGui = game.Players.LocalPlayer.PlayerGui:WaitForChild("ScreenGui")
local amount_loaded = 0
local loading_text = PlayerGui.Frame.TextLabel
local bar = PlayerGui.Frame.Bar
for i = 1, #loadables do
ContentProvider:PreloadAsync({loadables[i]})
amount_loaded = i
loading_text.Text = i.."/"..#loadables
bar.Size = UDim2.new(amount_loaded/#loadables,0,1,0)
end
GetChildren returns a table, with that table loop through it and preload it.
local loadables = game.Workspace.Assets:GetChildren()
local ContentProvider = game:GetService("ContentProvider")
local PlayerGui = game.Players.LocalPlayer.PlayerGui:WaitForChild("ScreenGui")
local amount_loaded = 0
local loading_text = PlayerGui.Frame.TextLabel
local bar = PlayerGui.Frame.Bar
for i = 1, #loadables do
ContentProvider:PreloadAsync({loadables[i]})
amount_loaded = i
loading_text.Text = i.."/"..#loadables
bar.Size = UDim2.new(amount_loaded/#loadables,0,1,0)
end
I don’t really know how to use ContentProvider service, so I don’t really know.