for index, value in pairs(game:GetDescendants()) do
repeat
local success = pcall(function()
contentProvider:PreloadAsync({value})
end)
until success
end
or something like this i saw somewhere:
local function preload(asset, status)
-- if loading was a success then status will be Enum.AssetFetchStatus.Success
end
for index, value in pairs(game:GetDescendants()) do
repeat
contentProvider:PreloadAsync({value})
until value.Enum.AssetFetchStatus == "Success"
-- Or
until value.IsLoaded == true
end
Tally up your assets before preload, then just check by making sure your tally matches the number of assets that loaded, or add to a counter during preload and compare with that value!
PreloadAsync has a second argument for a Callback function.
local function Callback(Id: string, Status: Enum.AssetFetchStatus)
if Status == Enum.AssetFetchStatus.Failure then
end
end
ContentProvider:PreloadAsync(IdList, Callback)
It’s not pausing because the callback function runs on different thread.
It’s like you did task.spawn().
Pausing the loop is not a good idea, especially because most of the time when PreloadAsync fails, it means Roblox deleted the resource so you won’t preload it anyway.
I would rather recommend waiting a few seconds and repeating the request once after the first one fails.