How to wait until Image is loaded?

IsLoaded dont work for that. How could i wait until Image is loaded? I heared about preload but dont know how that works

local timeout = 0
repeat task.wait(0.1) timeout += 1 until image.IsLoaded == true or timeout > 100

This script will do the job. Timeout is required incase the image wont load, it will just skip it in 10 seconds.

IsLoaded dont work for Image, i checked it multiple Times if its loaded isLoaded will not work for Image

IsLoaded does work for images. Check to see if your asset has actually been approved yet.
Also, while I don’t think this will solve your issue, you can also use PreloadAsync to pre-load assets early, even if they haven’t been made visible yet to that specific client.

The Asset is approved, every Image i tried is approved but its not working u can also try it in Studio

local Image = script.ScreenGui.ImageLabel -- Edit
local DoFunctionChanged = false
if DoFunctionChanged == true then
Image:GetPropertyChangedSignal("Image"):Connect(function()
game:GetService("ContentProvider"):PreloadAsync({Image.Image})
wait(0.2)
if Image.Visible == true and Image.IsLoaded == true then
print("Image loaded.")
		else
			print("Image is not loaded.")
		end
end)
else
	game:GetService("ContentProvider"):PreloadAsync({Image.Image})
	wait(0.2)
	if Image.Visible == true and Image.IsLoaded == true then
	print("Image loaded")
	else
		print("Image is not loaded.")
	end
end
1 Like

So if i dont use Preloadasync the Image would not load until i make Image visible true?

Not exacly it wont load but it will instantly load after you make it visible

1 Like

Yes, content is only loaded when visible to the client. Preload will force it to load anyway. It’s important to note that “Loaded” means that the content is successfully cached and in memory. If the content is already cached, it will be loaded by default.

Actually, after further testing, Preloading won’t trigger IsLoaded. The ImageLabel will have to be visible first. Then it will remain loaded, even if made hidden again, until it leaves the cache.

4 Likes

Do i need to put the Id into Preload or the Image Instance

So is loaded will never fire?


It doesn’t seem to until you make it visible at least once. Now I’m a little bit confused on the purpose of preloading if it doesn’t preload in this context. But you’d use either the object or the asset id rbxassetid://123.

U swiped “Preload will force it to load anyway” out so would preload not force it?

Okay thanks