PreloadAsync not working

I’m trying to force a PreloadAsync to only pass when it’s successfull,

  1. They’re all failing,
    and
  2. the Pcall isn’t working and is allowing the script to continue on.
local Player = game:GetService("Players").LocalPlayer
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ContentProvider = game:GetService("ContentProvider")
local Assets = require(ReplicatedStorage:WaitForChild("Assets", 60))
local LoadingGui = Player.PlayerGui:WaitForChild("LoadingGui", 60)
local LoadingBar = LoadingGui.Background.Loading.Main.Bar
local AssetCountLabel = LoadingGui.Background.Loading.AssetCount

local TotalAssetsLoaded = 0
AssetCountLabel.Text = "Loaded Assets: " .. TotalAssetsLoaded .. "/" .. #Assets.Ids
for _, Asset in ipairs(Assets.Ids) do
	local Success
	while not Success do
		Success = pcall(function()
			ContentProvider:PreloadAsync({Asset})
		end)
		wait()
	end
	if Success then
		TotalAssetsLoaded = TotalAssetsLoaded + 1
	
		LoadingBar.Size = UDim2.fromScale(TotalAssetsLoaded/#Assets.Ids)
		AssetCountLabel.Text = "Loaded Assets: " .. TotalAssetsLoaded .. "/" .. #Assets.Ids
	end
end
1 Like

Roblox changed the way PreloadAsync works a while back. The only assets you can preload by id are images, while others have to be parsed as instances.

Sorry, what do you mean by “parsed as instances”

I mean you have to create an instance which can hold the value in question like a SpecialMesh for meshes and then put it into the table.