client
GiveWeaponComponentToPed
FiveM client native documentation with a Lua example.
Summary
Attaches a component (suppressor, scope, extended mag, tint) to a weapon a ped holds. The native behind weapon attachment systems.
Returns
void
Parameters
pednumberThe ped.weaponHashHashThe weapon hash.componentHashHashThe component hash.Example
GiveWeaponComponentToPed(PlayerPedId(), `WEAPON_ASSAULTRIFLE`, `COMPONENT_AT_AR_FLSH`)Common pitfalls
- The ped must already have the weapon.
- Component hashes are weapon-specific; the wrong one silently does nothing.
Related natives
Related guides
FiveM scripts done right
Optimized, dual-framework scripts for QBCore and ESX from Viper Development — escrow protected, delivered instantly to your Cfx portal.
Browse Scripts →