How to get asset ID from accessory

I’m trying to find the asset ID from an accessory that the character spawns with through the client, and I’ve tried multiple different ways but none are working. I’ve tried things like humanoid:GetAccessories() and sorting through the “HatAccessories” in the humanoid, but neither worked for me. Games like Catalog Avatar Creator do this when you join the game, so I’m guessing its possible.

Basically I need to get the product info from a players avatar items.

I need this so I can get the asset cost, image, and name using :GetProductInfo().

What I have so far:

local player = game.Players.LocalPlayer
local char = player.Character

char.ChildAdded:Connect(function(acc)
	if acc:IsA("Accessory") then
		local itemID
		if acc:FindFirstChild("Added") then
			itemID = acc.Added.Value --Holds the item ID for when I create an accessory
		else
			
		end
	end
end)
1 Like

You can use the Humanoid Description system.

Start by retrieving the current HumanoidDescription with Humanoid:GetAppliedDescription. On that instance, you will find a property called “HairAccessories”, which is a CSV (Comma-separated Values) string that contains all of the asset IDs of the user’s hats. You can deserialize this information into a traversable array with the string.split function.

Finally, iterate over that array and make a call to MarketplaceService:GetProductInfo for each asset ID.

4 Likes

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