ContentProvider failed

Ok so I tried to make a quick loading screen for a ui and load all these Decals so they wont load after they turn visible in the ui after. - this returns the error: ContentProvider:Preload() failed for rbxassetid://1898697410

Here is the script

local LoadList = {1900917820, 1900936460, 1898697193, 2026421985, 2026412081, 2026410356, 2026400927, 2026396483, 1950592925, 1950491565, 1898698884, 1898698700, 1898698518, 1898698351, 1898698161, 1898697964, 1898697825, 1898697667, 1898697545, 1898697410}
local ContentProvider = game:GetService('ContentProvider')

local function WaitForAssetsToLoad()
	while (ContentProvider.RequestQueueSize > 0) do
		wait()
	end
end

local function LoadAssets(AssetList)
	for _, AssetId in pairs(AssetList) do
		ContentProvider:Preload("rbxassetid://" .. AssetId)
		WaitForAssetsToLoad()
	end
end

LoadAssets(LoadList)
print("Loading finished")

Help me.

1 Like

ContentProvider::Preload is deprecated, please use ContentProvider::PreloadAsync instead.

Note that they are not equivalent in which parameters they take. Preload takes an array of asset IDs, while PreloadAsync takes an array of objects to preload. Just call PreloadAsync one time on the root (ScreenGui?) of your loading UI and it should preload all of the elements in there. (no need to loop or manually feed the IDs of the assets)

2 Likes

Ok thank you that helped. :smiley: