Hello, im having trouble with a script that is supposed to preload pictures so that all pictures in my game will be loaded. However it's not working for me and it gives me one error evry time i run the script.
Error: "ContentProvider:Preload() failed"
It only gives me this error once however for one of the pictures and not the others. I don't know why, i tested changing the pictureId but it still gave me the error for that soundId.
I have looked around a lot on the internet about this but i haven't found anything that has made this work. The code is inside a script and not in a local script.
wait(0.5) local ContentProvider = game:GetService("ContentProvider") local function LoadAssets(AssetList) wait() for _, AssetId in ipairs(AssetList) do print(AssetId) ContentProvider:Preload("http://www.roblox.com/asset/?id=" .. AssetId) end end local Pics={} for i,v in pairs(script.Parent:GetChildren())do if v:IsA("NumberValue")then table.insert(Pics,v.Value) end end LoadAssets(Pics)
I don't know what i have done wrong so help with this would be really appreciated, thanks.
EDIT:
I made this script:
wait(0.5) print("DO") local ContentProvider = game:GetService("ContentProvider") local function LoadAssets(AssetList) wait() for _, AssetId in ipairs(AssetList) do print(AssetId) ContentProvider:PreloadAsync("http://www.roblox.com/asset/?id=" .. AssetId) end end local Pics={} for i,v in pairs(game.Workspace.Values.MPics:GetChildren())do if v:IsA("StringValue")then table.insert(Pics,v.Value) end end LoadAssets(Pics) repeat wait() until ContentProvider.RequestQueueSize <= 0 script:Remove()
But now it gives me the error: "unable to cast array".
I still don't know how this works..