Hello i am trying to preload pictures in my game. I have four image ID's in string values. However only two of the pictures are working and the others are just white and giving an error saying they couldn't be loaded. So heres my script and it gives me this error:
My error: Unable to cast to Array Script 'Players.bondhemlig.PlayerGui.PictureLoading', Line 12 - local LoadAssets Script 'Players.bondhemlig.PlayerGui.PictureLoading', Line 24
I don't know what this error means so help would be appreciated.
Local Script:
repeat
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)
until ContentProvider.RequestQueueSize <= 0
script:Remove()
Help would be appreciated thanks!

8 comments
PreloadAsync takes instances, not strings.
ok, but how do i do that, do i like need to create my values in the script?
http://wiki.roblox.com/index.php?title=API:Class/ContentProvider/PreloadAsync
?
I still don't get it..
something like PreloadAsync(Player.PlayerGui.ImageLabel)
oh, ok.
ok, but i have like a gui where i have made two imagebuttons does this mean i need to instance them and like also change their properties as well? Can't you just preload the ID with like a string?