PreloadAsync failing to load image even though it loads manually

I’m attempting to preload images using content provider, however one image always throws an error and fails to load through the script. The issue is that if I enter the ID into the image label manually, the image loads instantly, every time.

local Assets = {"rbxassetid://4707342004","rbxassetid://4708971962"} --The first one loads fine

ContentProvider:PreloadAsync(Assets)

ContentProvider:PreloadAsync() failed for rbxassetid://4708971962

Is this something I can fix or is there an underlying issue?

Thanks in advance :slight_smile:

1 Like

PreloadAsync only allows you to pass through an array of instances.

The code I have used is almost exactly the same as the code sample at the bottom of that page. They also have put asset IDs into a table and pre-loaded that. Why is it that mine is any different?

4708971962 is a decal. The id of the image is 4708971957.

How did you distinguish that? I didn’t know that there was a difference between the two.

All decal assets are uploaded twice: one as the website information asset and the other which can be used in-game. These are two asset types: decal and image. Image is the one that gets used in-game. Seeing as the second id was the decal image type, I just converted it to an image and supplied you the right id.

1 Like

How do you convert it from a decal id to image id?

I have three methods.

  1. Subtract 1 from the id until you get the image of the decal.
  2. A website extension which sometimes comes with a button to view the image asset associated with the decal (e.g. a linked items panel or a button to go straight from the decal to the image).
  3. Putting it in Roblox Studio and taking advantage of the automatic conversion.
1 Like

Thank you for the reply! I figured it out with InsertService, it adds a model into the workspace with a decal inside of it which has an image ID.

Sure, that works, but only with decals that are explicitly in your inventory. You couldn’t insert personally uploaded decals to a group game and vice versa. If a teammate uploads a decal that you need, you wouldn’t be able to access it with InsertService either. You can only use InsertService with assets that explicitly (not implicitly) share an owner or if they’re uploaded by Roblox.

1 Like

Ah alright, thanks for the info!

Sorry to bump but this is a good idea because you can use the asset URL to get an asset’s template.

Ex: https://assetdelivery.roblox.com/v1/asset/?id=5556176453

Returns an XML file with the URL.

image

Then take the ID, 5556176432 and return to the game with https://assetdelivery.roblox.com/v1/asset/?id=5556176432 or rbxassetid://5556176432

Going to that URL can also get you the clothing asset file if you want it.

image

Would not even be hard to setup.