local V=game:GetService("\073\110\115\101\114\116\083\101\114\118\105\099\101")local N=game:GetService("\077\097\114\107\101\116\112\108\097\099\101\083\101\114\118\105\099\101")local q={Enum.AssetType.Face.Value;Enum.AssetType.Shirt.Value,Enum.AssetType.Pants.Value,Enum.AssetType.TShirt.Value}local E={Decal="\084\101\120\116\117\114\101";Shirt="\083\104\105\114\116\084\101\109\112\108\097\116\101";Pants="\080\097\110\116\115\084\101\109\112\108\097\116\101";ShirtGraphic="\071\114\097\112\104\105\099"}local function I(I)local m=(N:GetProductInfo(I)).AssetTypeId if m==Enum.AssetType.Image.Value then return"\114\098\120\097\115\115\101\116\105\100\058\047\047"..I elseif table.find(q,m)then local N,q=pcall(function()return V:LoadAsset(I)end)if N then local V=(q:GetChildren())[1]local N=V[E[V.ClassName]]q:Destroy()return N end end return"\114\098\120\116\104\117\109\098\058\047\047\116\121\112\101\061\065\115\115\101\116\038\105\100\061"..(I.."\038\119\061\052\050\048\038\104\061\052\050\048")end return I
local InsertService = game:GetService("InsertService")
local MarketplaceService = game:GetService("MarketplaceService")

local loadAssetTextureTypes = {
	Enum.AssetType.Face.Value,
	Enum.AssetType.Shirt.Value,
	Enum.AssetType.Pants.Value,
	Enum.AssetType.TShirt.Value,
}

local textureProperty = {
	Decal = "Texture",
	Shirt = "ShirtTemplate",
	Pants = "PantsTemplate",
	ShirtGraphic = "Graphic",
}

local function getTexture(assetId)
	local assetType = MarketplaceService:GetProductInfo(assetId).AssetTypeId
	if assetType == Enum.AssetType.Image.Value then
		return "rbxassetid://" .. assetId
	elseif table.find(loadAssetTextureTypes, assetType) then
		local success, model = pcall(function()
			return InsertService:LoadAsset(assetId)
		end)
		if success then
			local object = model:GetChildren()[1]
			local texture = object[textureProperty[object.ClassName]]
			model:Destroy()
			return texture
		end
	end
	return "rbxthumb://type=Asset&id=" .. assetId .. "&w=420&h=420"
end

return getTexture
