FiveM Weapon Components: How to Add Attachments
FiveM weapon components explained: where to find COMPONENT_ names, attachment item names for ox_inventory, QBCore and ESX, give commands and usable items.

- Applies to
- FiveM Legacy and FiveM for GTAV Enhanced (stock components; notes for addon components); ox_inventory v2.48.1 (October 24, 2026) on Qbox and ESX Legacy 1.16.4 (October 18, 2026); ESX Legacy with its own inventory; QBCore with qb-weapons (as of August 24, 2026) and qb-inventory; vMenu Enhanced v1.0.22 (November 17, 2026) on servers without a framework
- Last verified
On this page
- Direct Answer
- What a weapon component is in FiveM
- FiveM weapon components list: where to find the names
- Weapon attachment spawn names by framework
- How to give weapon attachments with a command
- How to make weapon attachments usable
- Addon weapon components: weaponcomponents.meta
- FiveM Legacy and FiveM for GTAV Enhanced
- Troubleshooting
- Next Steps
Direct Answer
FiveM weapon components are the game’s weapon attachments: flashlights, suppressors, grips, scopes, magazines and finishes, each with a name such as COMPONENT_AT_PI_FLSH. The Cfx.re Weapon Models page lists the components of each stock weapon. A script attaches one with the native GIVE_WEAPON_COMPONENT_TO_PED; on a framework server you give an attachment item instead. With ox_inventory (Qbox, ESX), run /giveitem <id> at_flashlight 1 and use the item while holding the weapon. On QBCore, give and use flashlight_attachment. ESX’s own inventory uses /giveweaponcomponent <id> WEAPON_PISTOL flashlight on a player who has the weapon. vMenu offers components in Weapon Options. Addon components also need weaponcomponents.meta loaded with WEAPONCOMPONENTSINFO_FILE.
What a weapon component is in FiveM
A component is a part the game fits onto a weapon. Every component has a name, and the natives that handle components take the hash of that name (Hash componentHash) together with the hash of the weapon.
Four natives from the WEAPON namespace handle components, and ox_inventory calls all four:
| Native | What it does |
|---|---|
GIVE_WEAPON_COMPONENT_TO_PED(ped, weaponHash, componentHash) | Adds a component to one of the ped’s weapons |
REMOVE_WEAPON_COMPONENT_FROM_PED(ped, weaponHash, componentHash) | Removes it again |
HAS_PED_GOT_WEAPON_COMPONENT(ped, weaponHash, componentHash) | Returns a BOOL: is the component on that weapon |
DOES_WEAPON_TAKE_WEAPON_COMPONENT(weaponHash, componentHash) | Returns a BOOL: does the weapon accept the component |
In Lua you usually write a component hash with backticks, `COMPONENT_AT_PI_FLSH`. FiveM’s Lua runtime turns backtick names into hashes at compile time, “similar to GET_HASH_KEY, however with zero runtime overhead”. That is why the inventory files below list components in backticks. A name known only at run time is hashed with joaat, as es_extended does with joaat(weaponName).
A component is not an inventory item. Frameworks wrap components in items so players can carry and use them, and each framework names those items differently. The rest of this guide maps the two.
FiveM weapon components list: where to find the names
The official list is the Weapon Models page of the Cfx.re docs. It groups weapons by type (Pistol group, Rifle group and so on) and shows each weapon’s Name, Hash, Model Hash Key, DLC and Description, followed by its Components and Tints. The Pistol entry, WEAPON_PISTOL, lists five components:
COMPONENT_AT_PI_FLSHCOMPONENT_AT_PI_SUPP_02COMPONENT_PISTOL_VARMOD_LUXECOMPONENT_PISTOL_CLIP_02COMPONENT_PISTOL_CLIP_01
The Carbine Rifle, WEAPON_CARBINERIFLE, lists ten, among them COMPONENT_AT_AR_AFGRIP, COMPONENT_AT_AR_FLSH, COMPONENT_AT_AR_SUPP, COMPONENT_AT_SCOPE_MEDIUM and COMPONENT_CARBINERIFLE_CLIP_03. The Pistol Mk II entry is much longer and includes camo finishes and special magazines such as COMPONENT_PISTOL_MK2_CLIP_TRACER.
The page lists names, not descriptions. To learn what a name is, look at how the inventory resources label it: ox_inventory files COMPONENT_AT_PI_FLSH under Tactical Flashlight, COMPONENT_AT_PI_SUPP_02 under Suppressor and COMPONENT_PISTOL_CLIP_02 under Extended Pistol Clip.
An addon weapon’s components are not on that page. Their names come from the weapon’s own weaponcomponents.meta, the file covered in the addon section below.
Weapon attachment spawn names by framework
On ox_inventory and QBCore servers, the spawn name or spawn code of an attachment is its item name, not its COMPONENT_ name. These are the stock item names, from ox_inventory v2.48.1 (released October 24, 2026) and from qb-weapons and qb-core:
| Attachment | ox_inventory item (type) | QBCore item | Example stock components |
|---|---|---|---|
| Flashlight | at_flashlight (flashlight) | flashlight_attachment | COMPONENT_AT_PI_FLSH, COMPONENT_AT_AR_FLSH |
| Suppressor, pistols | at_suppressor_light (muzzle) | suppressor_attachment | COMPONENT_AT_PI_SUPP, COMPONENT_AT_PI_SUPP_02 |
| Suppressor, rifles and snipers | at_suppressor_heavy (muzzle) | suppressor_attachment | COMPONENT_AT_AR_SUPP, COMPONENT_AT_SR_SUPP |
| Grip | at_grip (grip) | grip_attachment | COMPONENT_AT_AR_AFGRIP |
| Heavy barrel | at_barrel (barrel) | barrel_attachment | COMPONENT_AT_AR_BARREL_02 |
| Extended magazine | at_clip_extended_pistol, _smg, _shotgun, _rifle, _mg, _sniper (magazine) | clip_attachment | COMPONENT_PISTOL_CLIP_02, COMPONENT_CARBINERIFLE_CLIP_02 |
| Drum magazine | at_clip_drum_smg, _shotgun, _rifle (magazine) | drum_attachment | COMPONENT_SMG_CLIP_03, COMPONENT_CARBINERIFLE_CLIP_03 |
| Compensator | at_compensator (muzzle) | comp_attachment | COMPONENT_AT_PI_COMP |
| Scopes and sights | at_scope_macro, _small, _medium, _large, _advanced, _nv, _thermal, _holo (sight) | smallscope_attachment, medscope_attachment, largescope_attachment, holoscope_attachment, advscope_attachment, nvscope_attachment, thermalscope_attachment | COMPONENT_AT_SCOPE_MEDIUM, COMPONENT_AT_SCOPE_MAX |
| Muzzle brakes | at_muzzle_flat, _tactical, _fat, _precision, _heavy, _slanted, _split, _squared, _bell (muzzle) | flat_muzzle_brake, tactical_muzzle_brake and seven more | COMPONENT_AT_MUZZLE_01 to COMPONENT_AT_MUZZLE_09 |
| Finishes and camos | at_skin_luxe, at_skin_camo and other at_skin_* kits (skin) | luxuryfinish_attachment, digicamo_attachment and other camo items | COMPONENT_PISTOL_VARMOD_LUXE |
Two design differences matter when you move between frameworks:
- ox_inventory uses one item for many weapons. Each item lists several component hashes, and the inventory attaches the first one the held weapon accepts.
at_flashlightlists five flashlight components. - QBCore uses one item and a per-weapon table.
WeaponAttachmentsinqb-weapons/config.luamaps each item to exactly one component per weapon name, for examplesuppressor_attachmenttoCOMPONENT_AT_PI_SUPP_02forweapon_pistol.
Finishes are components too. The gun skins guide covers them together with tints.
How to give weapon attachments with a command
Each inventory has its own give command. All of them take the player’s server ID first.
| Server | Command | Who may run it |
|---|---|---|
| Qbox, or ESX with ox_inventory | /giveitem <id> at_flashlight 1 | group.admin |
| QBCore with qb-inventory | /giveitem <id> flashlight_attachment 1 | admin |
| ESX Legacy with its own inventory | /giveweaponcomponent <id> WEAPON_PISTOL flashlight | owner and admin groups |
| vMenu, no framework | No command: Weapon Options menu | vMenu.Enhanced.Menus.WeaponOptions.Modify |
- ox_inventory: the command is registered as both
additemandgiveitem, with the parameters target, item, an optional count and an optionaltype. The item name is the key indata/weapons.lua. If ox_inventory cannot give the item, the server console prints a line starting withFailed to give. - QBCore: qb-inventory’s
/giveitemtakes “Name of the item (not a label)” and an amount, and looks the name up in lowercase. - ESX without ox_inventory: the player must already have the weapon, and the component argument is the short name from that weapon’s entry in
Config.Weapons(flashlight,suppressor,clip_extended), not theCOMPONENT_name. es_extended only registers this command when no custom inventory is active.
Granting group.admin and ESX groups is covered in the admin permissions guide.
How to make weapon attachments usable
ox_inventory on Qbox and ESX
The stock attachment items are already defined in data/weapons.lua. The player equips the weapon, then uses the attachment item. ox_inventory then:
- Refuses without a weapon in hand: “You must have a weapon in hand”.
- Checks the slot. A weapon takes one component per
type, so a second muzzle item fails with “This weapon’s muzzle slot is already occupied”. - Tries each listed hash with
DOES_WEAPON_TAKE_WEAPON_COMPONENTand attaches the first the weapon accepts. If none fits, the player sees “This weapon is incompatible with” and the item label. - Moves the item onto the weapon. The server removes the item from the inventory and stores its name in the weapon’s
componentsmetadata, which also adds the attachment’s weight to the weapon.
To take an attachment off, right-click the weapon in the inventory and open Remove attachments. The item goes back into the inventory. When a weapon is equipped, ox_inventory re-applies every component stored in its metadata.
A script can hand out a weapon with attachments already fitted. The ox_inventory metadata guide shows this metadata for AddItem:
local metadataExample = {
ammo = 30,
components = {
'at_flashlight',
'at_suppressor_heavy'
}
}
exports.ox_inventory:AddItem(inv, item, count, metadataExample, slot, cb)
The list holds item names from data/weapons.lua, not COMPONENT_ names. When an inventory loads, ox_inventory removes any name from that list that is not a known item.
Adding a component to ox_inventory. Open ox_inventory/data/weapons.lua and find the Components table. Either add the new hash to the component list of an existing item, or copy an entry and give it a new key, label and hash. This is the stock flashlight entry in v2.48.1:
['at_flashlight'] = {
label = 'Tactical Flashlight',
weight = 120,
type = 'flashlight',
client = {
component = {
`COMPONENT_AT_AR_FLSH`,
`COMPONENT_AT_AR_FLSH_REH`,
`COMPONENT_AT_PI_FLSH`,
`COMPONENT_AT_PI_FLSH_02`,
`COMPONENT_AT_PI_FLSH_03`,
},
usetime = 2500
}
},
ox_inventory sets each entry’s item name to its key, so the key is the name you pass to /giveitem. The type decides which slot the attachment fills. Restart the server after editing the file. The item picture and the weapon entry are covered in the addon weapons guide, and ox_inventory’s item fields in how to add items to ox_inventory. ox_inventory’s docs list the frameworks it supports as ox, esx, qbx and nd; QBCore is not among them.
QBCore with qb-weapons and qb-inventory
QBCore’s site says it “has withdrawn from other platforms” and keeps its FiveM docs as a reference, but existing QBCore servers still run qb-weapons. There, an attachment needs two entries:
- The item in
qb-core/shared/items.lua. The stock entries are useable, for exampleflashlight_attachmentwith the label Flashlight,weight = 1000andimage = 'flashlight_attachment.png'. - The mapping in
WeaponAttachmentsinqb-weapons/config.lua, with one line per weapon:
flashlight_attachment = {
weapon_pistol = `COMPONENT_AT_PI_FLSH`,
weapon_pistol_mk2 = `COMPONENT_AT_PI_FLSH_02`,
weapon_combatpistol = `COMPONENT_AT_PI_FLSH`,
},
The stock table is longer; this excerpt shows the format. qb-weapons makes every key of WeaponAttachments a usable item when it starts, so a new attachment item needs its line here as well as in items.lua. To support another weapon, add a line with its lowercase name, the way weapon_pistol is written.
In game, the player holds the weapon and uses the item. qb-weapons looks up the held weapon’s name in qb-core’s shared weapon list, finds the component for that name, attaches it, saves it in the weapon’s attachments info and removes the item. A weapon without a line for that item gets “This attachment is not valid for the selected weapon.” Using the same item again while that attachment is on removes the component from the weapon. In qb-inventory, open your inventory with no other inventory beside it (with a stash or trunk open, a right-click moves the item instead), right-click the weapon, choose Attachments and click an attachment to take it off; the item comes back with the notice “You removed … from your weapon!”.
ESX Legacy with its own inventory
Without ox_inventory, es_extended keeps components inside each weapon’s entry in Config.Weapons (es_extended/shared/config/weapons.lua). The stock Pistol:
components = {
{ name = "clip_default", label = TranslateCap("component_clip_default"), hash = `COMPONENT_PISTOL_CLIP_01` },
{ name = "clip_extended", label = TranslateCap("component_clip_extended"), hash = `COMPONENT_PISTOL_CLIP_02` },
{ name = "flashlight", label = TranslateCap("component_flashlight"), hash = `COMPONENT_AT_PI_FLSH` },
{ name = "suppressor", label = TranslateCap("component_suppressor"), hash = `COMPONENT_AT_PI_SUPP_02` },
{ name = "luxary_finish", label = TranslateCap("component_luxary_finish"), hash = `COMPONENT_PISTOL_VARMOD_LUXE` },
},
Scripts call xPlayer.addWeaponComponent(weaponName, weaponComponent), xPlayer.removeWeaponComponent and xPlayer.hasWeaponComponent with the short name. addWeaponComponent only works when the player owns the weapon and the name exists in that weapon’s list; it then saves the component in the loadout and attaches it. To allow a new component, add a line with a name, a label and a hash.
With ox_inventory installed, es_extended sets Config.CustomInventory = "ox" by itself and replaces these player methods with empty functions (hasWeaponComponent always returns false). On such a server, use the ox_inventory items above.
vMenu, no framework
Servers that run vMenu without an inventory resource, whatever their game mode, attach components from the Weapon Options menu. vMenu Enhanced reads the component names from config/weapon-components.json, “Names for weapon attachments, such as magazines, scopes and finishes”. The docs’ example:
{
"COMPONENT_PISTOL_CLIP_01": "WCT_CLIP1",
"COMPONENT_PISTOL_CLIP_02": "WCT_CLIP2",
"COMPONENT_MYADDONRIFLE_SCOPE": "Holographic Sight"
}
You never say which weapon takes which component: vMenu asks the game when a weapon’s menu opens and offers only the components that weapon accepts. “A component that is not in this file is never offered.” Components have no permissions of their own; vMenu.Enhanced.Menus.WeaponOptions.Modify “covers attaching, removing and tints”. Installing vMenu is in the vMenu guide.
Standalone scripts without an inventory
A script without an inventory calls the native itself with the ped, the weapon hash and the component hash, the same call ox_inventory makes: GiveWeaponComponentToPed(playerPed, currentWeapon.hash, component). ox_inventory first checks the pair with DoesWeaponTakeWeaponComponent, and a script can do the same.
On a server with an inventory, attach components through the inventory’s items. ox_inventory re-applies only the components saved in a weapon’s metadata, and qb-weapons only those in its attachments info, so a component added by another script is not part of the saved weapon. ox_inventory also disarms a player who holds a weapon that did not come from a weapon item while inventory:weaponmismatch is on; its docs describe the convar as “Disarm the player if an unexpected weapon is in use (i.e. did not use the weapon item)”.
GIVE_WEAPON_COMPONENT_TO_PED and REMOVE_WEAPON_COMPONENT_FROM_PED also appear in FiveM’s list of RPC natives (ext/natives/rpc_spec_natives.lua), and server code calls them on a player’s ped: es_extended’s addWeaponComponent runs GiveWeaponComponentToPed(GetPlayerPed(self.source), ...) on the server, and qb-weapons attaches components from its server script the same way.
Addon weapon components: weaponcomponents.meta
Stock components ship with the game. Components that come with an addon weapon are defined in its weaponcomponents.meta, which a resource loads with the WEAPONCOMPONENTSINFO_FILE data file type. The Cfx.re Data Files page gives its mounter as CWeaponComponentDataFileMounter, with dlc_mpbikercrc:/common/data/ai/weaponcomponents.meta as the game’s own example. In fxmanifest.lua, list the file under files and add a data_file line, the pattern the resource manifest reference shows for other data files:
files {
'meta/weaponcomponents.meta',
}
data_file 'WEAPONCOMPONENTSINFO_FILE' 'meta/weaponcomponents.meta'
Three points connect the component file to the weapon:
- Load order: the Data Files page gives no order for weapon data files, and FiveM’s loader keeps the order of your manifest, with a stable sort so that entries “retain equivalent order”. Keep the order of the pack’s own manifest.
- Attach points: the weapon’s
weapons.metalists its components under AttachPoints, each with aDefaultvalue. In qb-weapons’weaponsnspistol.meta,COMPONENT_SNSPISTOL_CLIP_01istrueandCOMPONENT_SNSPISTOL_CLIP_02false. - Magazine size: a Pistol replacement posted on the Cfx.re forum changes the magazine from 12 to 17 rounds through an edited
weaponcomponents.meta.
The full streaming setup, with the other meta files and the stream folder, is in the addon weapons guide. Once the weapon loads, register its components as items with the steps above. FiveCrate also lists fivem weapon attachments as a catalogue category.
FiveM Legacy and FiveM for GTAV Enhanced
As of December 3, 2026, Cfx.re’s page on what changed in Enhanced says nothing about weapon components, weapon natives or data_file entries, so none of the steps above is documented as different on Enhanced. The documented change that touches addon components is the stream_enhanced folder: when it is present, “its contents are loaded instead of the stream folder” on Enhanced, and stream alone is deprecated there. Test an addon component on an Enhanced test server before you rely on it.
Troubleshooting
“This weapon is incompatible with” an attachment in ox_inventory
None of the hashes in the item’s component list fits the held weapon. Check the weapon’s components on the Weapon Models page, then use a matching item, for example at_suppressor_heavy instead of at_suppressor_light on a rifle, or add the weapon’s hash to the item’s list.
“This weapon’s … slot is already occupied”
The weapon already carries an attachment of the same type. Remove it with Remove attachments, then use the new item.
“This weapon already has a …”
ox_inventory found the component already on the weapon, so it does not use the item. The component is on the weapon without being recorded in the weapon item, for example because another script attached it with the native. Use the item on a weapon that does not have that component yet.
“This attachment is not valid for the selected weapon.” on QBCore
WeaponAttachments has no line for the held weapon under that item. Add the weapon’s lowercase name with the right component hash, and make sure the weapon exists in qb-core’s shared weapon list.
“Invalid weapon component” or “Player does not have this weapon” on ESX
These are /giveweaponcomponent errors. The first means the component name is not in that weapon’s components list in Config.Weapons; use the short name such as suppressor. The second means the target player does not have the weapon. “Player already has this weapon component” means it is already attached.
Addon attachments do not show on the weapon
Check that weaponcomponents.meta is listed under files and loaded with WEAPONCOMPONENTSINFO_FILE, and that the weapon’s AttachPoints name the component. Then confirm the weapon accepts it with DoesWeaponTakeWeaponComponent before you look at the inventory configuration.
Next Steps
- Stream the weapon and its meta files with the addon weapons guide.
- Set up the inventory itself with how to install ox_inventory.
- Add finishes, tints and replacement skins with the gun skins guide.
- Compare how Qbox, ESX and QBCore handle items in QBCore vs Qbox vs ESX.
Weapons & attachments: first releases coming soon
Join the FiveCrate Discord to hear when the first releases go live.
Official documentation and repository references
- Cfx.re Docs: Weapon Models
- Cfx.re Docs: Data Files
- citizenfx/natives: GIVE_WEAPON_COMPONENT_TO_PED
- ox_inventory source: data/weapons.lua (v2.48.1)
- Overextended Docs: ox_inventory item metadata
- Overextended Docs: ox_inventory
- qb-weapons source: config.lua (WeaponAttachments)
- vMenu Enhanced Docs: Peds, Vehicles and Weapons
Related guides
How to Install Gun Skins in FiveM: Replace and Tint Weapons
How to install gun skins in FiveM: stream replacement gun models, add tints and finishes in ox_inventory, ESX or QBCore, and block player packs via pure mode.
How to Install ox_inventory on Qbox, ESX or QBCore
How to install ox_inventory: dependencies, the release zip, convars and start order for Qbox and ESX, why QBCore is unsupported, and first-start error fixes.
How to Add Items to ox_inventory (Qbox, ESX, QBCore)
How to add items to ox_inventory: define them in data/items.lua, add PNG images, make them usable, and what changes on Qbox, ESX and QBCore servers.
How to Add Addon Weapons to FiveM (ox_inventory)
How to add addon weapons to FiveM: stream folder, data_file lines for weapons.meta, ox_inventory weapons.lua, images, attachments, QBCore and ESX steps.
QBCore vs ESX vs Qbox: Which FiveM Framework in 2026?
QBCore vs ESX vs Qbox in 2026, from official sources: what QBCore leaving FiveM means, how Qbox and ESX Legacy differ, and which framework fits your scripts.


