Is it possible to gather accessory ID's from an character in-game?

Hey everyone,

Right now, a colleague and I are attempting to design an in-game avatar customization system. Whilst some things are going smoothly, I would like to seek some assistance with gathering accessory ID’s from an in-game character (for example, someone who has used our customization system to customize their character to their liking and then wants to save it).

Some solutions I have already tried aren’t producing the best results, including:

local players = game:GetService("Players")

local function playerAdded(player)
	player.CharacterAppearanceLoaded:Connect(function(char)
		local humanoid = char:WaitForChild("Humanoid")
		print(players:GetHumanoidDescriptionFromUserId(player.UserId):GetAccessories(true)) -- this should print the accessories, which it does, but it does so for the website avatar.
	end)
end

players.PlayerAdded:Connect(playerAdded)

This results in the script printing the accessory ID’s as intended, however they come from the website avatar, which is what I’m trying to avoid.

Along with this code attempt, I have attempted to dig deeper into the functions of the HumanoidDescription with no luck.

Any assistance on this matter would be greatly appreciated, thank you!

3 Likes

Have you tried Humanoid:GetAccessories()? It gets the accessories currently adorned on the character, not what the player is wearing on the website. Note that this returns an array of the accessories, so you’ll have to get the id from that.

local ids = {}

for _, accessory in pairs(Humanoid:GetAccessories()) do
    if accessory:IsA("Accessory") then
        table.insert(ids, accessory.SourceAssetId)
    end
end
2 Likes

Hi, I get error “The current identity (2) cannot SourceAssetId (lacking permission 5)” when I try to get the SourceAssetId. It seems only core script can use this from what I read? Do you know what the issue could be?

1 Like

Unfortunately, there is no official API for this. You will need to manually store all accessories equipped to the player and then fetch the accessory ID from there.

1 Like

I have the same issue. How I can fetch the Asset ID (like on the catalog) using only the in-game Accessory?

1 Like