How to get an image from an accessory, Bots?

Hello, I can’t seem to get an image from an accessory I know you could go to and manually find one image but I’m trying to make something that scans your whole character, gets accessories and puts them on image labels i Really have no idea wear to find an image


Thankyou for your time, Joesiuh

2 Likes

Please excuse me if I have this wrong but isn’t the ‘image’ contained in the associated Mesh or SpecialMesh?

4 Likes

You can either use MarketplaceService’s GetProductInfo or create viewport frames and clone copies of the accessories inside of each viewport.

@RamJoT He wants an icon for the accessory, not the texture.

3 Likes

The Texture and the Mesh id is in there but I’m talking about the like picture on a catalog

2 Likes

Thanks but do you happen know how to get the id from the accessory

game.Players.PlayerAdded:Connect(function(player)
	wait(5)
	local children = player.Character:GetChildren()
	for i, v in pairs(children) do
		if v.ClassName == "Accessory" then
			
			local asset = game:GetService("MarketplaceService"):GetProductInfo(v)
			print(asset.Name)
		end
	end
end)

when i do this it says i need an integer so idk how to do it

2 Likes

GetCharacterAppearanceInfoAsync can help you get the ids of those accessories for the images. I’d recommend caching the images for hats you already got previously so it reduces calls to GetProductInfo.

-- Example of caching
local imageCache = {} -- where [accessoryId] = image link

function GetImage(itemId)
   if imageCache[itemId] then
	  return imageCache[itemId]
   else
	  -- call some function to get the image link from GetProductInfo
   end
end
2 Likes

NOTE: You can avoid dealing with all of this and just use viewport frames.

2 Likes

Oh, are viewport frames like 3d images?

1 Like

There’s a brief overview on what they are, how to use them, and an example on the release thread.

2 Likes