Context:
I am trying to make a Acessory GUI where players can unequip and equip back whenever they want their accessories.
The first thing I’ve tried was get all characther childrens and check if it is an Accessory, if so, create a button (on the GUI) to allow this Accessory for be unequipped.
for _, accessory in ipairs(char:GetChildren()) do
if accessory:IsA("Accessory") then
local new = Sample:Clone()
new.Name = accessory.Name
new.Parent = Scrolling
new.Image = ???
end
end
A simple way to unequip the items, is change the parent of the Accessory Instance to a Folder anywhere, like inside the Character itself. And to equip back, look for a Accessory with the same name as the Button and change the Parent back to the Character.
Problem:
I want that the buttons have the image of the Accessory. However, the Accessory Instance doesn’t have an Icon property or the ID of the item on the catalog (so we could simply get the Icon image using a link to the API with the ID on the catalog).
To get the Icon of an Accessory, we need to put a link like this on the ImageButton.Image:
local AssetID = 120756377
ImageButton.Image = "https://www.roblox.com/asset-thumbnail/image?assetId="..AssetID.."&width=180&height=180&format=png"
Question:
How can I get the Asset ID of the Accessory using the Item Instance in-game to get the Icon?
If using HumanoidDescription, how can I make the in-game Accessory Instance match to the HumanoidDescription.Accessory? (the name of the Item is not always the same name of the in-game Accessory instance)
Also, using viewport frames to show them doesn’t seems to be the best option to show the Icon.