The id of Creator Store image changes when pasted in Decal

Hello, i have a funny issue
We’re making in our game the possibility of setting images by id
aka user can go on creator store and chooses the image id what he wants to display

fun thing is that if you paste the id via script with formatting like
rbxasset://...
or
http://www.roblox.com/asset/?id=...

it doesnt work (the image is not displayed)
when i paste in by hand in the decal the id is totally changing

e.g
https://create.roblox.com/store/asset/137072407447109/Cute-Chibi-Eyes-Head-Mask?pagePosition=3
turns into
http://www.roblox.com/asset/?id=92298625139567

i have no idea how does work and i tried getting product info from MarketPlaceService
but there was no matching id in the result at all

does anyone has idea how to get the real image id from asset id?
137072407447109 → 92298625139567

There are topics on how you can convert decal to image ids, what you see in Studio “by hand” is Studio’s own converter

apparently it doesnt work when i set the raw id or even with formatting.
Can we find how the studio converter works?

Made by tnavarts:

local InsertService = game:GetService("InsertService")

-- Takes in a user input containing the assetId of either a decal
-- or image and returns an image assetId string ready for use or an
-- empty string if no assetId could be found.
function getImageFromUserInputAsync(decalOrImageAssetUri: string): string
	local a, b = decalOrImageAssetUri:find("%d+")
	if not a then
		-- Return an empty assetId in the case of no id in input.
		return ""
	end
	
	local assetId = tonumber(decalOrImageAssetUri:sub(a, b))
	local st, result = pcall(InsertService.LoadAsset, InsertService, assetId)
	if st then
		local decal = result:FindFirstChildWhichIsA("Decal", true)
		if decal then
			-- Note: Do not directly parent the found Decal to avoid
			-- security issues if untrusted Instances somehow ended up
			-- underneath it. Instead, extract the id.
			return decal.Texture
		end
	end
	
	return `rbxassetid://{assetId}`	
end
2 Likes

Try using rbxthumb.
rbxthumb://type=Asset&id=137072407447109&w=150&h=150

1 Like

Thank you very much, it worked!

The find i would replace with match(“%d+”)

and as well, can you add the check for AssetTypeId

since they can give any asset and the server prob gonna load the gigantic Instance

the Decal is 13 or Enum.AssetType.Decal.Value

wait this is even better, we dont need to load with InsertService

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.