Guide for FiveM server owners
Living NPCs and AI in FiveM Roleplay: What Works and What It Costs
Busy streets and NPCs that react make a roleplay city feel real. Here is how to do it on GTA V FiveM, from free tweaks to AI dialogue, and what each step costs.
The GTA 6 (GTA VI) trailers sell one idea above all: a city full of people. Roleplay players want that too. Nobody enjoys running a shop on an empty street. But NPCs are also one of the fastest ways to make a FiveM server stutter, desync or feel strange.
This guide goes from the cheapest changes to the most ambitious ones, with the cost of each. It is written for GTA V FiveM servers on QBCore, QBox, ESX or standalone.
Four levels of "living"
It helps to be precise about what you want. There are four levels, and each one costs more than the last.
- Background life. Pedestrians and traffic that make the city look busy.
- Ambient scenes. NPCs doing believable things in specific places.
- Interactive NPCs. NPCs players can talk to, trade with or hire.
- AI-driven NPCs. NPCs that respond with generated dialogue, remember players or change their behaviour.
Most servers get the biggest gain from levels 1 and 2, which are cheap. Level 4 is where the excitement is, and where the risks are.
Level 1: background life
GTA V already fills the world with pedestrians and traffic. Servers often turn this down to save performance or to stop NPC cars from crashing into roleplay scenes.
What works:
- Tune density, don’t kill it. Density multipliers for peds, parked cars and traffic have to be set every frame by one resource. Pick a value per area instead of one global number: busy downtown and on the beach, quiet in the hills.
- Remove the wrong NPCs. NPC police, military and gang responses clash with player-run factions. Turn off dispatch and wanted levels for AI police if you have a player police force.
- Keep one owner. Only one resource should set density. Two resources setting different values every frame is a classic source of flicker.
Cost: low, if done in one place. The main effect is on client FPS in busy areas, so test with players, not alone.
Level 2: ambient scenes
GTA V has hundreds of built-in scenarios: smoking, drinking coffee, fishing, playing music, taking photos, leaning on a wall. A ped playing a scenario is cheap and looks alive.
Ideas that fit a GTA 6 inspired, Vice City style server:
- a crowd outside the club at night,
- joggers and sunbathers on the beach in the morning,
- fishermen on the pier,
- a photographer outside the car dealership,
- workers at the docks during the day.
Two tips:
- Spawn locally, near players. Scene peds only need to exist for players who are close. Creating them client-side when a player enters an area, and removing them when they leave, keeps the cost near zero elsewhere.
- Use time of day. A beach full of sunbathers at 3 a.m. breaks the illusion faster than an empty beach.
Cost: low to medium, depending on how many scenes are active at once.
Level 3: interactive NPCs
These are NPCs that do something for players: a shop clerk, a bank teller, a job manager, an informant, a mechanic’s assistant.
Things to decide:
- Local or networked? A clerk that only needs to stand there and open a menu can be a local ped on each client. A ped that moves, fights or is shared in a scene between players needs to be networked, so everyone sees the same thing. With OneSync, networked peds can be created and owned by the server.
- Target or keypress? Use the same target system as the rest of your server, so players interact with NPCs the same way they interact with everything else.
- Invincible and frozen? Most service NPCs should not react to being shot or pushed. It prevents griefing and saves you from half your support tickets.
Cost: medium. Each networked ped adds sync traffic, and badly written interaction loops add CPU time on every client.
Level 4: AI-driven NPCs
This is the level people mean when they talk about "AI NPCs". Roughly, there are two kinds.
Rule-based behaviour
NPCs that follow schedules, react to events (a shooting, a siren, a player in a suit) or remember simple facts ("this player robbed me"). This is classic game AI. It runs locally, costs little and is predictable.
Good examples for roleplay:
- a shopkeeper who refuses to serve someone who robbed the store this week,
- witnesses who call the police after a crime, giving player police a reason to investigate,
- street vendors who move between spots during the day.
Generated dialogue
Some scripts connect NPCs to a large language model, so players can talk to them in free text and get an answer in character. It can be impressive. It also brings real questions:
- Cost. Most language model services charge per request. A busy server can send a lot of requests. Know your pricing and set limits.
- Latency. Answers take time to generate. A two-second pause is fine for a conversation, not for a gunfight.
- Moderation. Players will try to make the NPC say terrible things. You need filters, and a way to log and review what happens.
- Privacy. Player messages are sent to a third-party service. Your privacy policy should say so, and players should know when they talk to an AI.
- Security. API keys belong on the server, never in client files. A client-side key will be found and misused.
- Consistency. A generated NPC can invent facts about your city. Give it clear lore and limits.
AI dialogue works best for a few special characters, like an informant or a talk-show host, not for every pedestrian.
Performance: measure every step
NPC scripts are some of the most expensive resources on many servers. A few habits:
- Know your baseline. Open the resource monitor before you add anything and write the numbers down.
- Test in the busiest place on your map, at peak time, with other players around.
- Look for loops that run every frame when they do not have to. A ped that checks the distance to every player every frame is a common problem.
- Check the server side too. Networked entities and their owners show up in server performance, not only in client resmon.
FiveM resmon basics walks through the tools and what the numbers mean.
A sensible order
If you want a city that feels alive, do it in this order:
- Tune density per area and remove AI police.
- Add ten ambient scenes in places players visit most.
- Replace menu-only shops with a few interactive NPCs.
- Add one rule-based system that creates roleplay, such as witnesses.
- Only then consider AI dialogue, for one or two characters.
Stop at any step where the server feels right. More is not better if it costs frames.
Choosing NPC and AI scripts
When you look at a script, ask:
- Does it support your framework and your target system? Our pages list support per framework: QBCore, QBox, ESX.
- What does it cost at idle and in a busy area?
- If it uses an external AI service, where does the API key live, and what gets sent?
- Can you read and change the code? NPC behaviour is something you will want to tune. See escrow vs open source FiveM scripts.
For the bigger picture of a GTA 6 inspired server, read GTA 6 features you can already add and the Vice City checklist. If you want to see how we approach it: the FiveM NPC script lets players talk to any pedestrian, with memory, gossip and witnesses; the FiveM AI police script covers the police side; and the FiveM NPC dialogue script is for placed characters with written conversations. All our scripts are under FiveM scripts, with free scripts to try and bundles for several at once. Questions about a specific setup go to support.
Questions
How do I make my FiveM city feel busier?
Tune pedestrian and traffic density per area instead of turning it down everywhere, and add scenario peds in places players visit most. Measure performance before and after.
Do NPCs cause lag on FiveM servers?
They can. Many peds in one area cost client FPS, networked peds add sync traffic, and badly written loops add CPU time. Spawn scene peds locally and only near players.
Are AI NPCs with chatbot-style dialogue worth it?
For a few special characters, they can be. They cost money per request, add latency, need moderation, and send player messages to a third party. Use them sparingly and tell players.
Should service NPCs be networked?
Only if players need to see the same movement or state. A clerk who stands still and opens a menu can be a local ped on each client, which is cheaper.
Why do my NPC settings keep changing?
Usually because two resources set density or wanted levels every frame. Make one resource responsible for it and remove the setting from the others.
Read next
Best QBCore and QBox Script Setup for a GTA 6 Style Server
Which framework to pick, which core resources you need, how to layer GTA 6 style scripts on top, and a server.cfg order that stays maintainable.How to Make a FiveM Roleplay Server Feel Like GTA 6: A Vice City Checklist
A step-by-step checklist for giving your FiveM roleplay server a GTA 6 inspired Vice City feel, using only what GTA V and FiveM can do today.How to Install a FiveM Script on QBCore, QBox or ESX (Step by Step)
A step-by-step install guide for FiveM scripts on QBCore, QBox and ESX, from the zip file to a clean console, including SQL, items and load order.Scripts for your FiveM server
GTA 6 inspired scripts for GTA V FiveM, with the full source and no escrow. Pick your framework and see what runs on it.
