so pretty much the script goes through and finds a whole bunch of textures through the game then starts to preload them, but I keep getting this error: Unable to cast Instance to Content | Script 'Players.Player.PlayerScripts.IntroMain', Line 22
local assets = {}
local loaded = false
function descendants(model, list)
list = list or {}
for _, child in pairs(model:GetChildren()) do
table.insert(list, child)
descendants(child, list)
end
return list
end
for _, thing in pairs( descendants(workspace) ) do
if thing:IsA("Decal") then
table.insert(assets, thing)
end
end
loadtext.LoadingAssetsLabel.Text = "Found assets: "..#assets wait(1)
loadtext.LoadingAssetsLabel.Text = "We're loading your assets, hold tight." wait(1)
content = game:GetService("ContentProvider")
for _, asset in ipairs(assets) do
game:GetService("ContentProvider"):Preload(asset)
repeat wait() until content.RequestQueueSize == 0
loadtext.LoadingAssetsLabel.Text = asset
end
loaded = true
loadtext.LoadingAssetsLabel.Text = "Finished"

1 comment
Line 14 - table.insert(assets, thing.Texture)