Trying to get Accessory instance from HumanoidDescription

I have a list of Accessories that the player is wearing (HumanoidDescription.HatAccessory), but I don’t know how to get the name of the Accessory itself (that is in the Player’s Character) from the Accessory’s ID since GetProductInfo just returns the website name of the Accessory and not the actual Accessory instance name. I might just be being stupid, could someone help me out here?

You can use InsertService:LoadAsset(). This method creates a Model that holds the asset with the provided ID.
InsertService:LoadAsset(--[[Asset ID here]]):FindFirstChildOfClass("Accessory").Name is how you can get the name of the object. Obviously that is a long line of code, so you should probably break it up in the script:

local accessoryModel = InsertService:LoadAsset(--[[ID here]])
local accessoryName = accessoryModel:FindFirstChildOfClass("Accessory").Name

accessoryModel:Destroy() -- We don't need the model anymore, right?

I don’t know why you’re not accessing the Accessory’s Name from the character, instead of using the HumanoidDescription. I am assuming you’re intentionally not doing that for a reason.

If there’s no easier way than that then I’m just gonna go with another method I made, thanks for the help though

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