Grand opening25% off everything with FAM-261023-261025-UL4B9this weekendAdded for you at checkout Halloween Edition36 maps, limited runlimited runShop the drop
Performanceintermediate11 min readupdated 11 Sept 2026

Traffic and pedestrian density on a FiveM server

The 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.

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.

Traffic and pedestrian density on a FiveM server — illustrated with a FiveM-compatible minimap render

#The density natives

client.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
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.

#Server-side control with OneSync

server.cfg — no ambient population at all
set onesync_population false
server.lua — block specific models
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

ServerTrafficPedsNotes
Serious RP, many players0.2–0.40.3–0.5Players create the life; AI fills gaps
Casual RP, few players0.5–0.80.6–0.9Keeps the city alive
Racing / drift0.0–0.20.2–0.5Clear roads matter more than realism
PvP / redzone0.00.0–0.2Every 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 and helps against desync.

Share this guideXRedditFacebook

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.

Ready to pick a map?

Twelve themes on three base map styles, $8 each, instant download.

Relevant to what you just read

Look it up while you work

The reference tables this guide leans on, free and without an account.