Unable to cast dictionary to content

I am trying to preload all the images in two modules using one function to keep this script clean and optimized. But whenever I attempt to do so, it gives me the error:
10:48:01.985 Unable to cast Dictionary to Content - Client - Loading:100
Here is the code:

local a = 0.0
local b = {Images, SpriteSheets}
for _, image in pairs(b) do
	ContentProvider:PreloadAsync({image},PreloadFailed)
	a = a + 1.0 StatusLabel.Text = ("Loading Images... ("..a..")")
end

What am I doing wrong? And how can I make this work and preload all the assets in both modules using only one function?

at b, what is Images or SpriteSheets? arcording to the code you provided they should be rbxassetid s

if Images and SpriteSheets is a table you have to unpack them

local b = {table.unpack(Images),table.unpack(SpriteSheets)}

Yes they are modules filled with data I want to preload, and like I said my goal is to preload everything in both modules using one function.

after you unpack like @karbis says put b directly into ContentProvider:PreloadAsync() no neeed to loop,
that

can be put into a callback where PreloadFailed is

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.