IconImageAssetId not loading images

local productInfo = MarketplaceService:GetProductInfo(tonumber(cash.Name), Enum.InfoType.Product)
				
cash.IconHolder.Icon.Image = productInfo.IconImageAssetId

[Image "3023076866" failed to load in "Players.NinjoOnline.PlayerGui.Core.Shop.Holder.Sections.Cash.470753027.IconHolder.Icon.Image": Unexpected URL]

And this just ended up resulting in an infinite yield

cash.IconHolder.Icon.Image = 'rbxassetid://' .. productInfo.IconImageAssetId

Have you tried using PreloadAsync on the “rbxassetid://”…productInfo.IconImageAssetId?

2 Likes

What is the object cash? What is it’s name? (Just want to know to fully answer)

It should work, as I’ve done productInfo.Name, productInfo.Description and productInfo.PriceInRobux and they have all returned the correct stuff. Just images aren’t working

See if you get the same value from just inputting the link to the decal into a imageLabel’s image property. If you get a different value, you are not grabbing the image from product info properly. If they are the same, then try preloading the asset.

Preloading an asset that isn’t loading is not going to load the asset (as it isn’t loading in the first place).

Is there some kind of misunderstanding or something about the function of PreloadAsync? It doesn’t download assets and it’s not a magic fix to a problem involving assets. It places assets at the front of the download queue.

cc @REALTimothy0812

1 Like

I am not misunderstanding it, I am asking for him to do it so the game actually tries to download the asset. Then you can see if it is just failing to download, or the problem lies elsewhere.

As suggested above, if it doesn’t work in-game perhaps try and use this endpoint instead:

https://www.roblox.com/Thumbs/Asset.ashx?format=png&width=420&height=420&assetId=[assetid]

If this doesn’t work I’ll be happy to further investigate into the issue!

2 Likes

This wouldn’t make a difference. PreloadAsync will throw the same warning that an invalid asset was supplied. Even if PreloadAsync manages to pass the asset into the download queue and it is downloaded, that doesn’t mean that the image automatically fixes itself.

1 Like

He didn’t say there was an invalid asset involved. He said there was an infinite yield.

1 Like

PreloadAsync is completely irrelevant in this scenario, is what I’m saying.

No, you can obviously see that below that, he appends rbxassetid:// before the id, and he stills has the same problem. The initial fail to load happened because there was no rbxassetid:// prefix before the id.

1 Like

I’m failing to understand what you’re saying. PreloadAsync is irrelevant still. The supposed issue seemed to have been that an invalid asset was supplied, meaning that the formatting of the string was the problem, not the method or the implementation.

PreloadAsync doesn’t magically fix things. That is the point I am making. Whether the use of PreloadAsync was applied here or not, a malformed asset link would return a load error.

1 Like

I think he means to say that in the first code snippet, OP directly supplies the asset ID to the Image property:

cash.IconHolder.Icon.Image = productInfo.IconImageAssetId -- produces aforementioned load error

and in the second snippet, he does supply the prefix:

cash.IconHolder.Icon.Image = 'rbxassetid://' .. productInfo.IconImageAssetId -- infinite yield?

though I have no idea why that would infinite yield, unless metatables are at play.

3 Likes