Getting the accessory ID via client

Simple, how can I get the ID of an accessory from the client? I would have thought the Mesh would have something to do with it, but it just contains the meshID and textureID. I don’t want like a link ID either. I just want the ID on it’s own, example.

16630147 --- ID for Beautiful Hair for Beautiful People
3 Likes

I don’t understand what you’re trying to do, are you attempting to get the catalog ID from an input?

You’ll have to explain a bit more, what are you trying to get the ID from? If you have a model then that won’t tell you the ID of what asset it came from. If you’re trying to get the ID from some player’s accessories you can use GetCharacterAppearanceInfoAsync.

Confusing explanation of what you want. You can’t trace a mesh back to its accessory ID. You can get just the numbers of an asset link though if that’s what you were asking for.

local assetId = object.MeshId:match("%d+")

This will return the first match of a number up until the subsequent character is not a number and return that to the assetId variable.

Im trying to get the accessory ID from the accessory itself
cc @gullet @ashcide


So lets say this accessory for example. If I want to get the ID of it how can I? From the client

Unfortunately there isn’t an official API to do this. That said, it’s possible to achieve what you need here with a comparison between the inserted hats from the player’s appearance information and the accessory’s name present the character:

local InsertService = game:GetService("InsertService")
local Players = game:GetService("Players")

local function findCatalogAssetId(accessory, plr)
	local char = plr.Character
	local _,assets = pcall(function()return Players:GetCharacterAppearanceInfoAsync(plr.userId).assets end)
	
	if char and assets and type(assets) == "table" then
		
		for _,assetInfo in pairs(assets) do -- Recurse for accessory information.
			if string.find(assetInfo.assetType.name,"Accessory") or assetInfo.assetType.name == "Hat" then
				local attemptedId = assetInfo.id
				local foundHat = nil
				
				--Insert hat by assetId and link it to the accessory the player is currently wearing.
				local _,Hat = pcall(function()return InsertService:LoadAsset(attemptedId)end)
				local insertedHat = Hat and Hat:GetChildren()[1]
				
				foundHat = insertedHat and char:FindFirstChild(insertedHat.Name)

				if foundHat and foundHat.Name == accessory.Name then
					return attemptedId
				end
			end
		end
	end
end

print(findCatalogAssetId(workspace.Q_Q.Swordpack, game.Players.Q_Q)) > 19398258

4 Likes

So what I would do, if you wanted to find the ID from the hat, get the accessories’ ID from ROBLOX catalog, then inside of the accessory, create an intValue or String (Whichever one you need) then make all of the Values’ name the same, so it’s be easy to find them. Example Code:

local acc = game.Workspace.HarajukuHair
local accID = acc["Value"]
local ID = accID.Value
print(ID)

Then all you have to do is change the acc location and then the local client will be able to find the ID of the hat. If you’re looking for like some sort on an API to find it, I can’t help you there. Hope this Helps! :smile:

EDIT: This will only work with the NPC’s

No such way exists.

1 Like

I’m guessing when you say “the accessory itself” you mean the model? If so, you can’t. You can get the mesh id etc. but not the asset id.