ImageLabel keeps flickering after updating image id

Can you try this and see what it prints?

local preloadIDTable = {}

local instanceTable = {}

for _, id in ipairs(preloadIDTable) do
    local instance = Instance.new("ImageLabel")
    instance.Image = "rbxassetid://"..id
    table.insert(instanceTable, instance)
end

local contentprovider = game:GetService("ContentProvider")
local success = contentprovider:PreloadAsync(instanceTable)

if success then
    print("They're all loaded")
else
    warn("Image preload failed.")
end

It says “Image preload failed.”

Update the last bit to this:

local contentprovider = game:GetService("ContentProvider")
local success, errorMsg = contentprovider:PreloadAsync(instanceTable)

if success then
    print("They're all loaded")
else
    warn("Image preload failed.",errorMsg)
end

What does it print?

“Image preload failed. nil”

How do I fix this?

I assume you added your roblox ids to the table right?

Yes, I am.

There, the table I am using.

local preloadIDTable = {15155878931,15155878775,15155878627,15155878476,15155878186,15155877918,15155877678,15155877510,15155880841,15155880635,
	15155880502,15155880374,15155880168,15155880025,15155879813,15155879610,15155879477,15155879346,15155879164,15155882850,
	15155882651,15155882341,15155882156,15155881878,15155881576,15155881401,15155881172,15155880983,15155883237,15155883016,
	15155885884,15155885644,15155885384,15155885133,15155884953,15155884781,15155884483,15155884200,15155884038,15155883887,
	15155883603,15155888031,15155887806,15155887609,15155887413,15155887245,15155887106,15155886885,15155886691,15155886524,
	15155886083,15155890200,15155889946,15155889781,15155889593,15155889425,15155889205,15155889028,15155888868,15155888570,15155888327,15155890385,15155978828
}

Could you try just this code and see if they even load at all?

for i,v in pairs(preloadIDTable) do
	local succ, errFail = pcall(function()
		game:GetService("ContentProvider"):PreloadAsync({asset})
	end)
	if succ then
		print("finished loading "..v..".")
	else
		warn("ID"..v.." could not load due to "..errFail)
	end
end
print("done")

Every assets can’t be loaded with the same error.

“ID… could not load due to Unable to cast double to Content”

I am starting to get it now.
Does it need to be string?

I’m not sure, but you could try that.

EDIT:
Or maybe add rbxasset in front of it.

for _, assetID in ipairs(preloadIDTable) do
    local assetString = "rbxassetid://" .. tostring(assetID)
    local success, errorMsg = pcall(function()
        game:GetService("ContentProvider"):PreloadAsync({assetString})
    end)
    
    if success then
        print("Finished loading " .. assetID .. ".")
    else
        warn("ID " .. assetID .. " could not load due to " .. errorMsg)
    end
end

print("Done")

Every assets are printed as finished loading, however it’s still flickering.

Did you try my edit code? With the rbxasset in front?

Yep, I tried. But it’s still flickering.

Maybe add a wait?
Like 10 seconds or 15 seconds after the done is printed, then use them ingame

Still not working, I wonder why.

Here’s the video of it.
https://streamable.com/6za7r2

Thats very weird, i don’t really have an idea anymore. Sorry :+1:

I suggest you create some type of loading screen, that way while the game is loading you can make all of your images visible for a short period of time. (0.2 each maybe) This means it should render for the player in the future

Just make sure you have enough ZIndex so they don’t show up

I noticed that EVERY time the image still flickers even after the images have been ever loaded or used for the 2nd time.

you don’t need to create an ImageLabel to load the image, you can just do rbxassetid://id

local preloadIDTable = {} -- asset ids here

for i, id in ipairs(preloadIDTable) do
	preloadIDTable[i] = "rbxassetid://" .. id
end

contentprovider:PreloadAsync(preloadIDTable)

I’ve found a solution, here is the link for it.

VideoPlayer by iceeburr

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