Decal not loading

I am making a server side explorer for admins in my game but the problem is that the icons don’t load.

It says in the output:

ContentProvider:Preload() failed for rbxassetid://4525569838

Please tell me how to fix this. I have been trying to fix this for an hour and only getting a headache.

Here is the asset:

This is that part if the script:

local iconMap = MAP_ID
game:GetService('ContentProvider'):Preload(iconMap)

(I am aware that Preload() is deprecated. It doesn’t work with PreloadAsync() either.)

Screenshot_2

Thanks!

Edit: When I upload the image in Roblox Studio it works. If I upload it as a decal it errors.

1 Like

local MAP_ID = "rbxgameasset://Images/Explorer7" works, but if I put the asset id it doesn’t.

I think it is a bug?

I am unsure on what is causing it to be honest, however I used PreloadAsync and done this and it worked.

local provider = game:GetService("ContentProvider")
local iconMap = "rbxassetid://4525569838"
local asset = {iconMap}

provider:PreloadAsync(asset)

If you are still having problems, let me know.

For some reason it still errors for me…

Same error?
It works fine for me.

I am using the script above.

I am loading the icon in a image label. As a decal it works fine. When creating UI it also works fine but not in script.

This is that whole part of the script. Can you spot the error or is it Roblox bug?

local Icon do
	local iconMap = MAP_ID
	game:GetService('ContentProvider'):PreloadAsync({iconMap})
	local iconDehash do
		-- 14 x 14, 0-based input, 0-based output
		local f=math.floor
		function iconDehash(h)
			return f(h/14),f(h%14)
		end
	end

	function Icon(IconFrame,index)
		local row,col = iconDehash(index)
		local mapSize = Vector2.new(256,256)
		local pad,border = 2,1
		local iconSize = 16

		local class = 'Frame'
		if type(IconFrame) == 'string' then
			class = IconFrame
			IconFrame = nil
		end

		if not IconFrame then
			IconFrame = Create(class,{
				Name = "Icon";
				BackgroundTransparency = 1;
				ClipsDescendants = true;
				Create('ImageLabel',{
					Name = "IconMap";
					Active = false;
					BackgroundTransparency = 1;
					Image = iconMap;
					Size = UDim2.new(mapSize.x/iconSize,0,mapSize.y/iconSize,0);
				});
			})
		end

		IconFrame.IconMap.Position = UDim2.new(-col - (pad*(col+1) + border)/iconSize,0,-row - (pad*(row+1) + border)/iconSize,0)
		return IconFrame
	end
end

I mean can you use a breakpoint and check the code line by line. You will find out the error with that more easily, just say’n. If you never heard of breakpoint the thread about it is here.

The problem is at the 2nd and 3rd line

I mean it would be ironically that for someone else the same code is working and for you doesn’t. The programming is not an coincidence. There can be literally many reasons why it doesn’t work for you. Maybe you are just importing decal incorrectly then. So I’d use a breakpoint at this situation. I hope this helps. :herb:

It is a Roblox bug I think. If I upload it as an image in Roblox Studio it works. So I guess I will stick with that I don’t know what else to do:

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

Screenshot_3

So what about if you change the MAP_ID with an normal roblox decal URL? Does it work?

It errors for other decal too.

Also team create is enabled on my game. I don’t if that is the cause of this.

I mean many times this happens when you are not the owner of the game on team create or you are not the person that uploaded this decal/image. Do you have API turned ON?

  1. I am the owner of the Team Create.
  2. What do you mean by “Do you have API turned ON?”

You have option to turn on the API in ‘Game Settings’ in the studio.

These are my settings:
Screenshot_4

Well yes that’s what should work. Can you maybe re-open the studio and try again please?

Change that to:

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