# Adding real recoil to FiveM weapons

> Make FiveM weapons kick: scripted recoil with IsPedShooting and SetGameplayCamRelativePitch, a per-weapon recoil table and first-person handling.

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

**Short answer.** While the player is armed, check `IsPedShooting(ped)` every frame; when they fire, raise the camera with `SetGameplayCamRelativePitch(GetGameplayCamRelativePitch() + kick, 0.2)` using a per-weapon kick value. Skip the loop entirely when unarmed, handle first person and vehicles separately, and keep kick values small. weapons.meta recoil shake is visual only; the script changes where the player aims.

## Key points

- Recoil is **client-side** camera movement after each shot.
- Run the per-frame check **only while armed**; sleep otherwise.
- A per-weapon table makes a rifle kick harder than a pistol.
- Keep values small — 0.3 to 1.5 degrees per shot feels real without being unplayable.
- weapons.meta `RecoilShake*` fields only shake the view; they do not move aim.

Vanilla GTA V guns barely move the aim, which makes sustained automatic fire a laser beam. Roleplay servers add recoil so a firefight takes skill and a rifle feels different from a pistol. Recoil in FiveM is a client script that nudges the camera upward every time the player fires. Done well it is subtle and weapon-specific; done badly it costs frames and fights the player’s mouse.

## How scripted recoil works

The game tells you each frame whether the ped fired (`IsPedShooting`). When it did, you tilt the gameplay camera up by a small amount. Because the bullet goes where the camera points, the next shot lands higher unless the player pulls down — which is recoil control.

## A clean recoil script

*client.lua*

```lua
local KICK = {
    [`WEAPON_PISTOL`]         = 0.35,
    [`WEAPON_COMBATPISTOL`]   = 0.40,
    [`WEAPON_PISTOL50`]       = 0.90,
    [`WEAPON_SMG`]            = 0.35,
    [`WEAPON_CARBINERIFLE`]   = 0.55,
    [`WEAPON_ASSAULTRIFLE`]   = 0.65,
    [`WEAPON_PUMPSHOTGUN`]    = 1.40,
}
local DEFAULT_KICK = 0.45

CreateThread(function()
    while true do
        local ped = PlayerPedId()
        local _, weapon = GetCurrentPedWeapon(ped, true)

        if weapon == `WEAPON_UNARMED` or IsPedInAnyVehicle(ped, false) then
            Wait(500) -- nothing to do: check rarely
        else
            if IsPedShooting(ped) then
                local kick = KICK[weapon] or DEFAULT_KICK
                if GetFollowPedCamViewMode() == 4 then -- first person
                    kick = kick * 0.8
                end
                SetGameplayCamRelativePitch(GetGameplayCamRelativePitch() + kick, 0.2)
            end
            Wait(0)
        end
    end
end)
```

- Backtick hashes make the table keys match `GetCurrentPedWeapon` directly.
- The loop sleeps 500 ms when unarmed, so the cost is only paid while holding a gun.
- View mode 4 is first person; the example reduces kick there because the view is closer.
- Addon weapons fall back to `DEFAULT_KICK` unless you add them.

## Tuning by class

| Class | Kick per shot (degrees) | Feel |
| --- | --- | --- |
| Pistols | 0.3 – 0.5 | Quick, controllable |
| Heavy pistols / revolvers | 0.8 – 1.2 | One strong kick per shot |
| SMGs | 0.3 – 0.45 | Low per shot, adds up fast |
| Rifles | 0.5 – 0.7 | Needs pulling down on full auto |
| Shotguns | 1.2 – 2.0 | Big kick, low fire rate |
| Snipers | 1.5 – 2.5 | Scope jumps after each shot |

Recoil interacts with damage and accuracy: a server with high recoil can afford higher damage because hits are harder. See [weapon balance for roleplay](https://fam-tools.com/guides/fivem-weapon-balance-roleplay).

## Vehicles and drive-bys

The example skips vehicles. Shooting from a car uses different cameras, and adding pitch there tends to feel wrong. Servers that want drive-by recoil usually use a smaller value and apply it only while aiming in a vehicle.

## Script recoil vs weapons.meta shake

weapons.meta has `RecoilShakeHash`, `RecoilShakeHashFirstPerson` and `RecoilShakeAmplitude`. Those produce a camera shake for feel, but the aim returns to where it was. A recoil script moves the aim itself. Many servers use both: meta shake for feel, script for control. The fields are explained in [weapons.meta explained](https://fam-tools.com/guides/fivem-weapons-meta-explained). The recoil fields themselves live in weapons.meta, and [FAM Tools has an editor for it](https://fam-tools.com/free-tools/weapons-meta-editor).

## Questions

### How do I add recoil in FiveM?

Run a client loop while armed that checks `IsPedShooting(ped)` and raises the camera with `SetGameplayCamRelativePitch` by a small per-weapon amount.

### Does a recoil script lower performance?

Only if it runs every frame while unarmed. Sleep the loop when the player has no weapon out, and the cost is negligible.

### Is recoil server-side?

No, it is client-side camera movement. That also means cheats can remove it, so do not rely on it for fairness alone.

### What is the difference between recoil and camera shake?

Shake is visual and the aim returns; recoil moves the aim so the player must compensate.

## Related

- https://fam-tools.com/guides/fivem-fire-mode-selector
- https://fam-tools.com/guides/fivem-weapons-meta-explained
- https://fam-tools.com/guides/fivem-weapon-damage-modifier
- https://fam-tools.com/guides/fivem-weapon-camera-shake-sway
- https://fam-tools.com/guides/fivem-weapon-balance-roleplay
