# Weapon durability in FiveM

> How ox_inventory weapon durability works: the per-weapon value, metadata.durability from 100 to 0, what happens at zero, and building repair kits.

Source: https://fam-tools.com/guides/fivem-weapon-durability · FAM Tools · published 2026-09-11 · updated 2026-09-11 · about 10 min

**Short answer.** In ox_inventory a weapon item starts with `metadata.durability = 100`, and each shot lowers it by the weapon’s `durability` value from `data/weapons.lua` (for example 0.1 for pistols, 0.03 for rifles). At 0 the weapon is broken and cannot be used until repaired. Tune the per-weapon value for how many shots a gun should last, and add repair through a script that sets the durability back.

## Key points

- New weapons get `metadata.durability = 100`.
- Each shot subtracts the weapon’s `durability` value from `data/weapons.lua`.
- At 0 the weapon is unusable until repaired.
- `durability = 0.1` ≈ 1,000 shots; `0.03` ≈ 3,300 shots.
- Repair is a script that updates the item’s metadata on the server.

Durability turns weapons from permanent trophies into equipment that wears out — which gives gunsmiths a job, makes cheap guns feel cheap and slows the flood of weapons on a roleplay economy. ox_inventory has durability built in; the numbers just need to fit your server.

## How ox_inventory durability works

When ox_inventory creates a weapon item it sets `metadata.durability` to 100 if the weapon defines a durability value. As the weapon is fired, durability falls by that value per shot. The weapon item displays its condition in the inventory, and at zero the inventory will not let the player use it.

*ox_inventory/data/weapons.lua (default values)*

```lua
['WEAPON_PISTOL'] = {
    label = 'Pistol',
    weight = 1130,
    durability = 0.1,
    ammoname = 'ammo-9',
},
['WEAPON_ASSAULTRIFLE'] = {
    label = 'Assault Rifle',
    weight = 4500,
    durability = 0.03,
    ammoname = 'ammo-rifle2',
},
```

## Tuning: how many shots should a gun last?

| durability value | Shots from 100 to 0 | Feel |
| --- | --- | --- |
| 0.3 | ≈ 330 | Cheap, breaks quickly — street guns |
| 0.1 | ≈ 1,000 | Default pistols |
| 0.05 | ≈ 2,000 | Well-kept sidearm |
| 0.03 | ≈ 3,300 | Default rifles |
| 0.01 | ≈ 10,000 | Almost never breaks — police issue |

Think in magazines: at 0.1 a 12-round pistol lasts about 80 magazines. On a serious roleplay server where shootouts are rare, that is effectively forever; on a gang-heavy server it is a few busy evenings. Adjust per weapon rather than globally, so a rare rifle does not wear as fast as a street pistol.

## Repair kits and gunsmiths

Repair means setting `metadata.durability` back up on the server. A repair-kit item can do it for the weapon in the player’s hands:

*server.lua (ox_inventory)*

```lua
RegisterNetEvent('gunsmith:repairCurrent', function(slot)
    local src = source
    local weapon = exports.ox_inventory:GetSlot(src, slot)
    if not weapon or not weapon.name:find('^WEAPON_') then return end

    -- consume one repair kit first
    if not exports.ox_inventory:RemoveItem(src, 'weapon_repairkit', 1) then return end

    weapon.metadata.durability = 100
    exports.ox_inventory:SetMetadata(src, slot, weapon.metadata)
end)
```

- Validate on the server: the slot must hold a weapon and the kit must actually be removed.
- Consider partial repairs (+40) so kits are a resource, not a reset button.
- A gunsmith job that repairs for money creates a real roleplay role.

Metadata editing in general is covered in [ox_inventory metadata](https://fam-tools.com/guides/ox-inventory-metadata).

## Durability on QBCore

qb-weapons tracks weapon quality in the item’s info and lowers it as the weapon is used, with a repair location configured in its config. The idea is the same; the field names and config differ, so check your qb-weapons version.

## Questions

### How does weapon durability work in ox_inventory?

Weapons start at `metadata.durability = 100` and lose the weapon’s `durability` value from `data/weapons.lua` with each shot. At 0 they are broken.

### How do I make weapons last longer?

Lower the `durability` value for that weapon in `data/weapons.lua`, for example from 0.1 to 0.05.

### How do I repair a weapon in ox_inventory?

On the server, set the item’s `metadata.durability` back to a higher value with `exports.ox_inventory:SetMetadata`, usually after removing a repair-kit item.

### Can I turn durability off?

Remove the `durability` field from the weapon in `data/weapons.lua`; new items of that weapon will not degrade.

## Related

- https://fam-tools.com/guides/ox-inventory-metadata
- https://fam-tools.com/guides/ox-inventory-weapons-data
- https://fam-tools.com/guides/fivem-ammo-types-and-items
- https://fam-tools.com/guides/fivem-weapon-balance-roleplay
