# Weapon attachments in ox_inventory

> How ox_inventory handles attachments: the default component items, attachment types, attaching and removing, adding components for add-on weapons.

Source: https://fam-tools.com/guides/ox-inventory-weapon-attachments · FAM Tools · published 2026-09-11 · updated 2026-09-11 · about 11 min

**Short answer.** Attachments are items defined under `Components` in `ox_inventory/data/weapons.lua`. Each has a `type` (flashlight, muzzle, grip, barrel, magazine, sight, skin) and a `client.component` list of component hashes it can apply. Using the item on a weapon attaches the first compatible component and stores it in the weapon’s `metadata.components`; removing it gives the item back.

## Key points

- One item can represent several GTA components — the first compatible one is used.
- Types: flashlight, muzzle, grip, barrel, magazine, sight, skin.
- Attached components are saved in `metadata.components` and survive relogging.
- An item does nothing if none of its component hashes fit the weapon.
- Addon weapons: add their component hashes to an existing item, or create a new item.

ox_inventory turns weapon components into inventory items that players can buy, trade, craft and loot — then attach to a compatible weapon in a couple of seconds. The defaults cover every vanilla attachment family; addon weapons need a small addition. Here is how the system is put together.

## The default attachment items

*From ox_inventory’s default data/weapons.lua.*

| Item | Label | Type |
| --- | --- | --- |
| `at_flashlight` | Tactical Flashlight | flashlight |
| `at_suppressor_light` | Suppressor | muzzle |
| `at_suppressor_heavy` | Tactical Suppressor | muzzle |
| `at_compensator` | Compensator | muzzle |
| `at_muzzle_flat`, `…_tactical`, `…_fat`, `…_precision`, `…_heavy`, `…_slanted`, `…_split`, `…_squared`, `…_bell` | Mk II muzzle brakes | muzzle |
| `at_grip` | Grip | grip |
| `at_barrel` | Heavy Barrel | barrel |
| `at_clip_extended_pistol`, `…_smg`, `…_shotgun`, `…_rifle`, `…_mg`, `…_sniper` | Extended clips | magazine |
| `at_clip_drum_smg`, `…_shotgun`, `…_rifle` | Drum magazines | magazine |
| `at_scope_macro`, `…_small`, `…_medium`, `…_large`, `…_advanced`, `…_nv`, `…_thermal`, `at_scope_holo` | Scopes and sights | sight |
| `at_skin_luxe`, `at_skin_camo`, `at_skin_woodland` and others | Finish kits | skin |

## How an attachment item is defined

*ox_inventory/data/weapons.lua*

```lua
['at_suppressor_light'] = {
    label = 'Suppressor',
    weight = 280,
    type = 'muzzle',
    client = {
        image = 'at_suppressor.png',
        component = {
            `COMPONENT_AT_PI_SUPP`,
            `COMPONENT_AT_PI_SUPP_02`,
            `COMPONENT_CERAMICPISTOL_SUPP`,
            `COMPONENT_PISTOLXM3_SUPP`,
        },
        usetime = 2500,
    },
},
```

- `type` groups attachments; a weapon holds one attachment of each type.
- `client.component` lists every GTA component this item may apply. When used on a weapon, the first entry the weapon accepts is attached.
- `usetime` is how long attaching takes, in milliseconds.
- `client.image` lets several items share one icon.

## Attachments for addon weapons

An addon weapon usually has its own component names (for example `COMPONENT_MYRIFLE_CLIP_02`). The existing item will not attach them until you list them:

1. Find the component names in the weapon’s `weaponcomponents.meta` and its `AttachPoints` in weapons.meta.
2. Add each hash to the matching item’s `client.component` list (for example the extended clip to `at_clip_extended_rifle`).
3. Or create a new item if the attachment is unique to that weapon.
4. Restart ox_inventory.

*Adding an addon clip to an existing item*

```lua
['at_clip_extended_rifle'] = {
    label = 'Extended Rifle Clip',
    type = 'magazine',
    client = {
        component = {
            -- …existing vanilla hashes…
            `COMPONENT_MYRIFLE_CLIP_02`,
        },
        usetime = 2500,
    },
},
```

If the weapon’s own weapons.meta does not list the component in its `AttachPoints`, no item can attach it — see [weapons.meta explained](https://fam-tools.com/guides/fivem-weapons-meta-explained).

## When an attachment will not attach

| Symptom | Cause |
| --- | --- |
| “Not compatible” | None of the item’s component hashes are accepted by that weapon |
| Attaches but invisible | The component’s model is not streamed or not in weaponarchetypes.meta |
| Lost after relog | Attached with a native instead of the inventory |
| Wrong suppressor for a pistol | Pistols use the light suppressor; rifles use the heavy one |

The component system itself — natives and naming — is covered in [weapon components](https://fam-tools.com/guides/fivem-weapon-components-attachments).

## Questions

### How do attachments work in ox_inventory?

Attachments are items with a list of GTA component hashes. Using one on a compatible weapon attaches the component and saves it in the weapon’s `metadata.components`.

### What is the ox_inventory suppressor item called?

`at_suppressor_light` (pistols) and `at_suppressor_heavy` (rifles and other long guns).

### Why does the suppressor not fit my addon weapon?

The item’s component list does not include the addon’s suppressor component. Add its hash to the item, and make sure the weapon’s meta lists it.

### Do attachments stay after relogging?

Yes, ox_inventory stores them in the weapon’s metadata.

## Related

- https://fam-tools.com/guides/fivem-weapon-components-attachments
- https://fam-tools.com/guides/ox-inventory-weapons-data
- https://fam-tools.com/guides/fivem-weapons-meta-explained
- https://fam-tools.com/guides/ox-inventory-metadata
