Decal not loading

Change that to:

game:GetService(‘ContentProvider’):PreloadAsync([iconMap])

Those settings were there since the start of the game.

Are you from Java Script background or something. That doesn’t work.

1 Like

I mean can you try a code the guy above sent you which said that works for him. Create a blank script and add things he did in it and starts a game. If it works then something has to be wrong with your script you are trying to implement this function to it if not then it might be a bug for you.

1 Like

Players.StrategicPlayZ.PlayerGui.AdminExplorer.ExplorerPanel.LocalScript:471: Expected identifier when parsing expression, got ‘[’

Something is wrong in AdminExplorer —> ExplorerPanel ----> LocalScript on line 471.

You can see the underline. That means the code he sent is wrong.

Exactly the guy above said wrong. Make sure to re-script it back.

Well the script works when I do:

local MAP_ID = "rbxgameasset://Images/Explorer7"

So it is a Roblox bug. I will just use that. This question is now solved(even though it is not)

I would still appreciate further help.

Try editing the top to

local iconMap = "rbxassetid://" .. MAP_ID
game:GetService('ContentProvider'):PreloadAsync({iconMap})

No clue why you are getting an error, this may be why.

EDIT: Make sure you are using PreloadAsync

@VegetationBush: Please don’t try to “assist” if you are going to give them wrong code. :confused:

2 Likes

It doesn’t work. I am just tired of this nonsense. I will just do:

local MAP_ID = "rbxgameasset://Images/Explorer7"

1 Like

no, he did {} and that signifies a list or an array, and I thought that the whole thing was one thing, so I changed it to [], sorry about that

Square brackets “[]” are used for indexing tables.

We also use them in normal scripting:

game[Workspace]

Is equals to:

game.Workspace

@VegetationBush So using PreloadAsync([iconMap]) is completly incorrect, it makes no sense to the script.

1 Like

You are getting this error because 4525569838 is the id for a decal. Decals cannot be used in game, you need to use the image id. Change the id you’re working with to 4525569834 and it will work. Decal assets are used to display asset information on the website, while images are what you use in-game.

Alternatively, you can use the new ContentId format rbxthumb to avoid weird id issues or needing to get the image id from the decal id. Entering rbxthumb://type=Asset&id=4525569838&w=420&h=420 as your image will work as well. This fetches the image (or rather the thumbnail of the decal asset) without needing to do any manual decal-to-image conversion.

Now the fun part is to address attempted solutions here.

  • PreloadAsync has nothing to do with the error you’re receiving. You attempted to mass a malformed ContentId to PreloadAsync to download, thus download failed. @PMGDesigns

  • The script has nothing to do with assets failing to load, never does. The current script is fine. The error message comes from a malformed id attempting to download. Breakpoints are pointless for working code. @ArticGamerTV

  • API Services are for connecting to services such as DataStores from within Studio. With them disabled, you cannot use various services that internally need to interact with web endpoints. Images aren’t affected by this option. @ArticGamerTV

5 Likes

I don’t know how to get the image though. You just subtract 4 from the decal id? Anyways thanks for the help. I will use the rbxthumb method.

Aren’t Preload and PreloadAsync functions the reference of API?

@StrategicPlayZ When you upload an image to the website, two assets are uploaded: a decal asset and an image asset. The decal asset is used for displaying data about the image while the image asset is for use in-game. It’s a strange process and I don’t know why this is. How much you have to subtract depends on how many assets are uploaded while your image is split into two assets. Sometimes it can be just one number behind, sometimes it’s many tens of numbers.

@ArticGamerTV You work with API all around you when you’re working with things such as service methods. This option specifically toggles your ability to use certain API while in Studio mode. AFAIK, only DataStores are tied to this option at the moment. ContentProvider can function with this off.

1 Like

I think we misunderstood both. So if we would have API feature disabled and we call the Preload API reference, it’s going to work? That’s what you said above. We are talking about the code that preloads the decal and not an image. :thinking:

I’m not really understanding what you’re saying because the wording you’re using is extremely confusing, or you’re trying to prove some mute point that’s already been covered. I don’t know.

The Enable Studio Access to API Services option does not have any affect on whether ContentProvider functions properly or not. You are still able to use it with Studio API access disabled. The original issue was that ContentProvider was attempting to parse an invalid asset for download.

2 Likes