PreloadAsync does not work whatsoever on images

I’m tried a million different things to get 150 images to be preloaded.

I’ve got them in a list:
image

ContentProvider:PreloadAsync({List})

I’ve tried creating them all manually
image

ContentProvider:PreloadAsync({LoadingUI.Animation})
-- and
ContentProvider:PreloadAsync({LoadingUI.Animation:GetChildren()})

None of these work. When I play the game, and I try to loop through all the images, they do not appear

local AllImages = {}
for _, v in pairs(LoadingUI.Animation:GetChildren()) do
	AllImages[tonumber(v.Name)] = v
end

ContentProvider:PreloadAsync({LoadingUI.Animation})

for i, image in ipairs(AllImages) do
	image.Position = UDim2.fromScale(0.5, 0.5)
	
	-- Hide Last Frame
	if PrevImage then
		PrevImage:Destroy()
	end
	
	PrevImage = image
	
	task.wait(1 / 42)
end

It’s supposed to work as a slideshow, but instead I see nothing. The images ARE NOT loading in. I NEED them to be fully loaded and visible, before this loop runs, so when it loops through them, you can actually see them. Instead, depending how fast the game loads, I either get a screen with nothing showing (images haven’t loaded) or I get glitching, where a handful of the images have loaded, but not all of them

2 Likes

Does this only run once? If it does it might run before your game is loaded. Also are you sure your images .Visible is true?

1 Like

Try a loop automatically making images from those IDs, putting all of them in a folder and preload the folder.

You are preloading only once, put it in a loop.

Try

ContentProvider:PreloadAsync(LoadingUI.Animation:GetChildren())

GetChildren() returns a table, so no need of them to be in a table,
also put PreloadAsync in a loop.

local AllImages = {}
for _, v in pairs(LoadingUI.Animation:GetChildren()) do
	AllImages[tonumber(v.Name)] = v
end

print('Preloading started')

for i,v in next, LoadingUI.Animation:GetChildren() do
   ContentProvider:PreloadAsync({v})
end

print('Preloading is now done!')

for i, image in ipairs(AllImages) do
	image.Position = UDim2.fromScale(0.5, 0.5)
	
	-- Hide Last Frame
	if PrevImage then
		PrevImage:Destroy()
	end
	
	PrevImage = image
	
	task.wait(1 / 42)
end
1 Like

This still does not work. Images are not loading 100% and there’s still a flickering

PreloadAsync doesnt load anything faster, it actually depends on our internet connection preloadasync actually make things that you want to load first, I think theres a property called “IsLoaded” in image you can check if the image is loaded or not by using it.

PreloadAsync() is only functional on client side, is this a local script?

Problem is, IsLoaded can take minutes to load


I was under the impression this is what PreloadAsync fixes and would make sure whatever’s inside it would be 100% fully loaded and ready before moving down the script

Yields until all of the assets associated with the given Instances have loaded and takes an array of Instances as a parameter.

1 Like

Hi, I apologize for reviving this old thread, but I’m curious if you ever found a solution?

We’re currently dealing with hundreds of frames to create on-screen animations, since using videos aren’t an option as RGBA is not yet supported. We also can’t use SpriteSheets because the resolution is far too small.

Our workaround has been to preload every frame and toggle visibility while keeping them hidden beneath other UI elements. It seems as though IsLoaded never fires unless the frame is visible.

Unfortunately, this approach is causing significant lag and is no longer sustainable for us.

Hey, where you able to find a solution?

Only way I was able to get it to work was by placing every image on a part in front of the player’s view when they join the game. Our game is 2D so this worked out fine because the screen is always covered with a UI but is not ideal and does not always work if a player has a poor connection.