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