Accessories inserted by InsertService are always Enum.AccessoryType.Unknown

I’m creating a GUI which allows you to insert and wear accessories from the roblox catalog, but I only want certain accessory types to be usable in game. The code below gets the accessory from the inserted model but I’m having a hard time getting the accessory’s type. The accessory type is always returning Enum.AccessoryType.Unknown no matter what accessory is inserted. I’m assuming this is normal behavior with InsertService?

Is there another method of checking the accessory’s type that I’m not aware of?

local function getAssetFromModel(assetId, assetType)
	local model = InsertService:LoadAsset(assetId);
	local asset = model:GetChildren()[1];
	if asset:IsA(assetType) then
		-- asset.AccessoryType is always Enum.AccessoryType.Unknown!!!
		if asset.AccessoryType == Enum.AccessoryType.Hat or asset.AccessoryType == Enum.AccessoryType.Back then
			return asset;
		end
	end
	game.Debris:AddItem(model, 1);
end

local accessoryToPutOnCharacter = getAssetFromModel(69937560, "Accessory");
-- insert code below to put above accessory on character if it's one of the allowed accessories
1 Like

Update 1:
Since my game uses custom spawning I can’t rely on the normal spawning process to get the type. But I think I found a hack for this. I could get the accessory type by first putting the accessory into a HumanoidDescription, applying that description to a temporary character, then getting the accessory type from the applied accessory. Really wonky but going to test it now and see if it works.