Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

'Unable to cast to Array?', I'm looping through everything in the game and preloading it.

I'm making a loading screen that loops through everything in the game and preloads it.

for i, thing in pairs(game:GetDescendants()) do
	game.ContentProvider:PreloadAsync(thing)
	print("loading.." .. thing.Name)
end
print("Done")

1 comment

0

I'm pretty sure that you have to use a table, game:GetService("ContentProvider"):PreloadAsync({thing})

1 answer

✓ Accepted answer

You don't need a generic loop in order to use PreloadAsync. You just need to give it a table, for example, game:GetService('ContentProvider'):PreloadAsync(game:GetDescendants()).

A cleaner example would be something like:


game:GetService('ContentProvider'):PreloadAsync({workspace.Decal, workspace.OtherDecal});

repeat until game:GetService('ContentProvider'):GetPropertyChangedSignal("RequestQueueSize"):Wait() <= 0

This discussion is preserved as it was. New answers, comments, and votes are closed.