# Traffic and pedestrian density on a FiveM server

> What pedestrian density means in GTA 5 and how to change it in FiveM: the per-frame density multipliers, onesync_population, and blocking models server-side.

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

**Short answer.** Density natives such as `SetVehicleDensityMultiplierThisFrame`, `SetPedDensityMultiplierThisFrame`, `SetRandomVehicleDensityMultiplierThisFrame`, `SetParkedVehicleDensityMultiplierThisFrame` and `SetScenarioPedDensityMultiplierThisFrame` take a 0.0–1.0 multiplier and must be called every frame. To remove ambient population entirely with OneSync, set the `onesync_population` convar to false. Block specific models server-side by cancelling `entityCreating`.

## Key points

- The `…ThisFrame` density natives only last one frame — call them in a `Wait(0)` loop.
- 0.0 removes, 1.0 is vanilla; 0.2–0.5 suits most roleplay servers.
- `set onesync_population false` disables ambient population server-wide.
- Random cops, garbage trucks and boats have their own toggles.
- Fewer AI entities means fewer network entities and smoother sync.

Pedestrian density in GTA 5 is a multiplier between 0.0 and 1.0 on how many ambient pedestrians the game spawns around the player, and traffic density is the same idea for cars. On a busy roleplay server the default can mean dozens of AI vehicles clogging roads, extra network entities and a lower frame rate — while on an empty map the city feels dead. FiveM lets you dial both to exactly what your server needs.

## The density natives

*client.lua*

```lua
local TRAFFIC = 0.4   -- moving cars
local PARKED  = 0.4   -- parked cars
local PEDS    = 0.5   -- walking pedestrians

CreateThread(function()
    while true do
        SetVehicleDensityMultiplierThisFrame(TRAFFIC)
        SetRandomVehicleDensityMultiplierThisFrame(TRAFFIC)
        SetParkedVehicleDensityMultiplierThisFrame(PARKED)
        SetPedDensityMultiplierThisFrame(PEDS)
        SetScenarioPedDensityMultiplierThisFrame(PEDS, PEDS)
        Wait(0)
    end
end)
```

These natives are named “ThisFrame” for a reason: the value applies to one frame only. This is one of the few places where a permanent `Wait(0)` loop is correct — the cost is a handful of native calls per frame.

## Other population toggles

*client.lua — run once*

```lua
SetCreateRandomCops(false)                 -- no random police cars
SetCreateRandomCopsNotOnScenarios(false)
SetCreateRandomCopsOnScenarios(false)
SetGarbageTrucks(false)                    -- no ambient garbage trucks
SetRandomBoats(false)                      -- no ambient boats
```

Random cops matter on roleplay servers: AI police cars chasing players undermine real officers. Disabling the wanted system itself is covered in [disabling wanted levels and dispatch](https://fam-tools.com/guides/fivem-disable-wanted-level-dispatch).

## Server-side control with OneSync

*server.cfg — no ambient population at all*

```cfg
set onesync_population false
```

*server.lua — block specific models*

```lua
local BLOCKED = {
    [`police`] = true, [`police2`] = true, [`policeb`] = true,
    [`rhino`] = true, [`lazer`] = true,
}

AddEventHandler('entityCreating', function(entity)
    if BLOCKED[GetEntityModel(entity)] then
        CancelEvent()
    end
end)
```

`entityCreating` fires on the server before an entity is created, so cancelling it stops the entity from existing for anyone. It is also a light anti-abuse tool for blocking military vehicles that should never appear.

## Choosing a density

| Server | Traffic | Peds | Notes |
| --- | --- | --- | --- |
| Serious RP, many players | 0.2–0.4 | 0.3–0.5 | Players create the life; AI fills gaps |
| Casual RP, few players | 0.5–0.8 | 0.6–0.9 | Keeps the city alive |
| Racing / drift | 0.0–0.2 | 0.2–0.5 | Clear roads matter more than realism |
| PvP / redzone | 0.0 | 0.0–0.2 | Every AI entity is noise |

## Performance effect

Every AI car and ped is an entity the game simulates and, with OneSync, may sync across players. Lower density means fewer entities, less network traffic and higher frame rates in dense areas. It is one of the cheapest wins in [client FPS optimisation](https://fam-tools.com/guides/fivem-client-fps-optimization) and helps against [desync](https://fam-tools.com/guides/fivem-desync-network-issues).

## Questions

### How do I remove NPC traffic in FiveM?

Call `SetVehicleDensityMultiplierThisFrame(0.0)` and `SetRandomVehicleDensityMultiplierThisFrame(0.0)` every frame in a client loop, or disable ambient population with `set onesync_population false`.

### Why does my density script not work?

The `…ThisFrame` natives must be called every frame. A loop with `Wait(1000)` resets the density to vanilla between calls.

### How do I stop AI police from spawning?

Call `SetCreateRandomCops(false)` and its two scenario variants on the client, and block police models with `entityCreating` on the server if needed.

### Does lower density improve FPS?

Yes, especially in dense city areas: fewer AI entities to simulate, render and sync.

## Related

- https://fam-tools.com/guides/fivem-disable-wanted-level-dispatch
- https://fam-tools.com/guides/fivem-client-fps-optimization
- https://fam-tools.com/guides/fivem-entity-limits-cleanup
- https://fam-tools.com/guides/fivem-onesync-infinity
