How do I convert a decal ID to an image ID?

I’m making a game where players are able to enter any decal ID to display an image of their choosing on a brick. It is very important to the game’s purpose that this image is clearly visible and of a high detail - so I do not think a 420x420 image will work for this, so I don’t want to resort to using asset thumbnail.

I tried initially entering decal ID, without realising that this wouldn’t work. Next I tried using insert service, and getting the texture - but I got the error ‘Asset not trusted for this place’.

I’m a bit lost in how I can achieve what I want now, could someone help me?

4 Likes

I believe it is quite system, but, did you use properly the TextBox input properly?

Yes, all inputs are fine, and I confirm that the game successfully gathers the decal ID, it is just getting the decal onto a brick using a script.

Did you put print() to know where the script is breaking or failing?

It isn’t the script breaking, it is simply that I can’t find a method of getting an image ID from a decal ID - all the ways I have tried have failed.

Try puting the decal main asset and not the ID of the decal. I mean, this;

https://gyazo.com/7db469bcd95d7285a51e5151fdc70e05

I have decided to settle for having a 420x420 thumbnail if a decal ID has been entered, but if a user has entered an image ID directly then allow the user to use the image ID entered.

I don’t think there is any other solution to this, but I wonder if ROBLOX could change this - seems a bit silly to not trust decals, but trust images, when you can get the thumbnail (even though of lesser quality), or you can just paste any decal into studio and get the image ID, then use it in the same way in my game.

It just ends up being a hurdle that can be bypassed, but give worse quality?

2 Likes

You could add this as a feature request if you’d like to.

1 Like

The best method, although hacky, I can think of is by subtracting the decal’s ID by 1, then use GetProductInfo to find if it is the image correlating with the decal. You will have to subtract 1 every time until you get the image and it may take a while to get it:

local mps = game:GetService("MarketplaceService")
local decalInfo = mps:GetProductInfo(decalId)
local ID = tonumber(decalInfo:match("%d+"))

for i = ID - 10, ID + 1 do
   local info = mps:GetProductInfo(i)
   if info.Creator.Name == decalInfo.Creator.Name and info.Name == decalInfo.Name and info.AssetTypeId == 1 then
        print(i) -- found the image
    end
end

This does not guarantee success, though

4 Likes

This was very helpful.Thx a lot

1 Like

Sorry for the necropost, but this solution seems to’ve been included inside Basic Admin’s donor cape command. Enter in a decal ID and it will convert it into an image. Very great idea, thanks!