MarketplaceService:GetProductInfo(assetid) returns some nice data about anything you want.
For clothes, aka Shirts/Pants/etc it has a field IconImageAssetId which is unused.
Couldn’t we use this (or a new) field to get the actual image, or vice versa?
Example:
Random shirt: Galaxy - Roblox
Linked decal image: Galaxy - Roblox
Both their IconImageAssetId is currently 0.
I want them to be each other: Galaxy - Roblox has 152266143 as IconImageAssetId Galaxy - Roblox has 152266142 as IconImageAssetId
This would make writing scripts that do something with clothes much easier.
Granted, we can just insert a Shirt/etc and get the decal url that way, but eh…
I just made a function that goes 15 assets back until the owner matches, but this would cut that out. Very useful for my mall which calls this function hundreds of thousands of times a day.
I was just gonna do the same, but the other way around.
I store the decal image and wanted a way to display it nicely in a GUI. (without showing the actual shirt/etc template instead of the catalog-ish version)
While writing this thread, I suddenly thought “hmm, can I LoadAsset the Shirt?”, hence the last sentence.
Updated my module to include shirts, pants, and t-shirts.
Soruce:
local m = {}
function m.getImageID(scanOrgin)
local result;
local getItemInfo, val = pcall(function() return string.sub(game:GetService("InsertService"):LoadAsset(scanOrgin):GetChildren()[1].Texture, 33) end)
if getItemInfo then
return val
else
return false
end
end
function m.getShirtImageID(scanOrgin)
local result;
local getItemInfo, val = pcall(function() return string.sub(game:GetService("InsertService"):LoadAsset(scanOrgin):GetChildren()[1].ShirtTemplate, 33) end)
if getItemInfo then
return val
else
return false
end
end
function m.getPantsImageID(scanOrgin)
local result;
local getItemInfo, val = pcall(function() return string.sub(game:GetService("InsertService"):LoadAsset(scanOrgin):GetChildren()[1].PantsTemplate, 33) end)
if getItemInfo then
return val
else
return false
end
end
function m.getTShirtImageID(scanOrgin)
local result;
local getItemInfo, val = pcall(function() return string.sub(game:GetService("InsertService"):LoadAsset(scanOrgin):GetChildren()[1].Graphic, 33) end)
if getItemInfo then
return val
else
return false
end
end
return m