ContentProvider just doesnt preload assets

I have been trying this code recently but it just does not load images early. It still needs time to “Download” the image before u can actually work with it.


for _,v in playerGui:WaitForChild("OnScreenGui"):GetDescendants() do
	if not v:IsA("ImageButton") and not v:IsA("ImageLabel") then continue end
	if v.Image == "" then continue end
	table.insert(PreloadingMaterials, v)
end

ContentProvider:PreloadAsync(PreloadingMaterials, function(a)
		if a == "" then return end
		currentProgress += 1
		assetPercentage = math.round(currentProgress/AmountToLoad) * contentLoading
		
	end)

Is there something i am doing wrong? I would love to know the solution to this. I also tried searching many many posts and saw only others who shared a similar issue but no solutions.

1 Like

Instead of inserting the instance into the table, insert the asset ID.

1 Like

I have already tried that, sadly same thing happens.

1 Like

Like this?

"rbxassetid://IDHere"
1 Like

Yep, i tried that. I also tried adding the “ImageLabel.Image” as well

1 Like

That’s strange, it works fine for me. I use PreloadAsync to load animations, UI and effects.

1 Like

Thats what im trying to do but it has issues loading. Sometimes it skips loading completely. Im mostly having issues with images i tween from 1 transparency to 0 transparency for the first time.

1 Like

If you have an intro that can cover the display, under that you can load your images for a moment. Images are manually preloaded/prebuffered. It’s a bit old school but it still works… Will cure GUI image backgrounds also not being loaded and blinking in the first time they are shown.

As far as the start up…
There are other tricks. Like a task.wait(3) on top of some of the intro scripts to stall for that program loading time. You’re not going to see this as that’s about how long it takes anyways to start being able to show any graphics. This way you’re not forcing it before the fact. A bit hit and miss the other way depending on the connection at the time.

Here is a trick I use to get a black background going before I can get a black image background up.

local rns=game:GetService("RunService")
local Lighting=game:GetService("Lighting")
Lighting.ExposureCompensation= -100 rns.Stepped:Wait()
--then after I'm ready to fade to my intro with a set black background up.
Lighting.ExposureCompensation=0

This is seamless swap to the fade black background and gives you a way to get things set up without it being noticed. Cost you a moment of the screen still black on load…

1 Like