FiveM resmon Guide: Find Laggy Scripts on Your Server

Published on | Updated

How to use FiveM resmon: type resmon 1 or resmon true in F8, fix Access denied for command resmon, read CPU msec and run the profiler to find the laggy script.

Two players standing between their cars on a night street in GTA V, with the Vinewood sign lit on the hill behind them

When a FiveM server lags, most owners blame the host or the framework. Sometimes that is true. But very often, one resource is doing something expensive and dragging everything down.

resmon is the fastest way to find that resource. This guide covers the exact command (including resmon 1), the "Access denied" error, what every column in the window means, and how to go one level deeper with the profiler.

Quick answer: Press F8 in FiveM and type resmon true to open the resource monitor. resmon 1 does the same, and resmon false or resmon 0 closes it. Sort by CPU msec: a resource that stays at 1 ms or more while nothing special is happening is your first suspect. If the console answers "Access denied for command resmon", your client is not in developer mode, and the fix is below.

The resmon command: how to open and close it

resmon is a client command. You type it in the F8 console inside the game; the server console has the profiler instead (further down). The Cfx.re console commands page documents it like this:

resmon <true|false>

Most players type resmon 1, and that works too. In the FiveM source code, the console reads a true/false setting as the word true or false (capitals do not matter) and otherwise as a number, where anything other than 0 means on. Other words, such as on or yes, are not recognised and count as off.

You typeWhat happens
resmon trueOpens the resource monitor (the form in the docs)
resmon 1Opens it too: a number other than 0 counts as true
resmon falseCloses it
resmon 0Closes it too

Measure during real player load, not on an empty server. Many resources only do real work when players trigger them, so a quiet resource on an empty server tells you little.

"Access denied for command resmon": how to fix it

The docs list resmon under developer commands and say: "Developer commands require the client to run in a developer mode, or they'll show an error like Access denied for command resmon". When you get that error, developer mode is what is missing. How you switch it on depends on which FiveM you run.

FiveM LegacyFiveM for GTAV Enhanced
Launch argument +set moo 31337Enables developer mode on any update channelRemoved
Beta or Latest update channelAlso enables developer modeNot mentioned in the docs
Server settingNot neededThe server must set sv_devMode true in server.cfg

On Legacy, add +set moo 31337 to the end of the Target field of your FiveM shortcut (right-click the shortcut, Properties) and start FiveM from that shortcut. The docs warn that non-production channels can be unstable, up to the game not launching, so the launch argument is the safer route.

On Enhanced, a player cannot switch developer mode on alone. The server owner adds this line to server.cfg and restarts the server:

sv_devMode true

Enhanced also has two tools the docs list only for that build: cl_drawResTimeGraphs true shows the Resource Time Graphs tool and cl_drawResTimeWarnings true shows the Resource Time Warnings tool. Our GTA V Enhanced guide for server owners covers what else changed.

What resmon shows: every column

The docs describe resmon as monitoring "the CPU usage and memory usage for each resource". The window itself, as written in the FiveM source code, has six columns, and you can click a column header to sort by it:

ColumnWhat it measures
ResourceThe resource name
CPU msecAverage time the resource's own code takes per tick, in milliseconds, with a small graph of recent ticks next to it
Time %That resource's share of all script time
CPU (inclusive)Like CPU msec, but also counting time spent in other resources it calls
MemoryMemory the resource's script runtimes report, shown with a + after the size, or "?" when unknown
StreamingMemory of the game assets the resource streams, or "-" when it streams none

The top row, [Total CPU], adds up all script time per tick and shows what share of the whole game frame that is.

The number you care about most is CPU msec. On the client, ticks follow the frame rate: the docs give one tick every 16.6 ms at 60 FPS and every 5.5 ms at 180 FPS. Time a resource spends in that tick is time the rest of the frame cannot use.

What "laggy" looks like in resmon

resmon colours the CPU msec numbers itself. In the source code, a value under 1 ms is green, it shades to yellow towards 4.5 ms and is red from 8 ms. While resmon is on, the client also checks each resource's average and shows a small /!\ Resource time warning box in the lower right corner when one averages more than 6 ms per tick. The box names the resource and its time, and tells players to contact the server owner.

For finer steps below those colours, this is our rule of thumb, not an official scale:

CPU msec while idleRule of thumb
0.0-0.2clean
0.2-0.5normal for active resources
0.5-1.0worth watching
1.0-3.0investigate this one first
3.0+very likely the lag

The biggest red flag is a resource that spikes when nothing special is happening. Another red flag is a resource that slowly gets worse over time. If it is the Memory column that keeps climbing, read our FiveM memory leak guide.

Small numbers add up. At 60 FPS a tick has 16.6 ms. Eight resources at 1 ms each already take 8 ms of that, about half, which leaves little room for player-driven events.

Common expensive patterns

Resource patternWhy it's expensive
while true do ... end without Waitthe loop never hands control back; the docs say it "will crash the clients game"
Heavy natives every tickthe docs name START_EXPENSIVE_SYNCHRONOUS_SHAPE_TEST_LOS_PROBE as one to avoid per tick
PlayerPedId() and similar called every tickthe docs suggest caching natives that rarely change in a thread that runs less often
Database query in a per-tick loopa query every tick where a timer or an event would do
GetEntityCoords on every player every framethe work grows with player count
Drawing 3D markers every frame for everythingcap the distance and draw only what is near
Polling instead of event-drivenwatch for missing event handlers

Fixing the most common cause: missing Wait

-- BAD: no Wait, the loop never yields and the game freezes
CreateThread(function()
    while true do
        UpdatePlayerStats()
    end
end)

-- GOOD: runs every 5 seconds
CreateThread(function()
    while true do
        UpdatePlayerStats()
        Wait(5000)
    end
end)

The Citizen.Wait docs put it plainly: a while true do loop without a Wait "will crash the clients game". In the FiveM source, a watchdog notices when the game window has not responded for more than 45 seconds while a script is running, and closes the game with "FiveM has stopped responding (script deadloop)" plus the script stack, which names the resource.

Two more rules from the same docs page. Code that really has to run every frame should use Wait(0), because Wait(5) or Wait(10) skips ticks at high frame rates. Code that only matters some of the time can change its own Wait value, so the loop runs every frame only when it has to.

Per-frame draw cost

-- BAD: draws a marker every frame for every ped in the pool
for _, ped in ipairs(GetGamePool('CPed')) do
    DrawMarker(...)
end

-- BETTER: cap distance, cache the list, only draw when needed

When the lag is server-side, not client-side

resmon measures the resources running in your own game. If it shows nothing that stands out but the server still feels laggy, look at the server. In the public FXServer source, the server prints server thread hitch warning: timer interval of N milliseconds when two ticks of its main thread are more than 150 ms apart. The same check exists for the network thread (also 150 ms) and the sync thread (100 ms).

Profile a resource with the profiler

The profiler works in the F8 console and in the server console, and shows the exact thread, file and line that costs the time. The steps below come from the profiler guide on the Cfx.re docs (a community guide). You need an up to date client, the latest server artifacts and Google Chrome.

profiler record 500
profiler status
profiler view
profiler saveJSON resmon-check.json
  1. profiler record 500 starts a capture. The guide calls 500 frames "a good starting point".
  2. profiler status shows whether it is still recording and how many frames it has.
  3. profiler view opens the capture. On the client it opens Google Chrome. On the server it does not: copy the link it gives you into Chrome. Keep the game or the server running while you view a capture you have not saved.
  4. profiler saveJSON resmon-check.json saves the capture into the folder where your run.bat lives. Copy it to your PC, open a new Chrome tab, open the developer tools (Ctrl+Shift+I), go to the Performance tab, right-click the panel and choose to load the profile.

In the capture, the green graph is FPS and the yellow graph is CPU time. Spikes in the yellow graph line up with frame drops on the client or hitches on the server. Scroll to zoom in on one frame, then hover a resource tick event: it shows how many ms that thread took, and the file and line numbers it runs.

Workflow for fixing a slow server

  1. Open F8 and type resmon true on a player client during peak hours. Note any resource that is not green (1 ms or more).
  2. Disable that resource and test again. Do not delete random files.
  3. If the server becomes stable, replace the resource or update it.
  4. If lag persists, run profiler record 500 in the server console, check profiler status, then profiler view or profiler saveJSON.
  5. Inspect the hottest function. Add Wait, cache, or replace polling with event-driven code.
  6. Repeat until no resource stays yellow or red while the server is idle.

Change one resource at a time and measure again after each change, so you know which fix actually made the difference. Performance is a routine, not a one-time fix; for a broader stability guide, read why your FiveM server keeps crashing.

If resmon and the profiler show your scripts are already lean and the server still struggles, look at the hardware underneath. Our FiveM server hosting runs on the Ryzen 9 9950X in Europe, the Ryzen 9 7950X3D in the USA, the Ryzen 9 5950X in Singapore and Australia, and Ryzen 9 3900X-class hardware in India, with the CPU shared with other servers on the node.

FAQ

What does resmon 1 do in FiveM?

It opens the resource monitor: a window that lists every running resource with its CPU time per tick, its share of script time, its memory and its streaming memory. The documented form is resmon true; resmon 1 works because the console counts any number other than 0 as true. Type it in the F8 console.

Why does resmon say access denied?

resmon is a developer command, and the docs say developer commands show "Access denied for command resmon" when the client is not in developer mode. On FiveM Legacy, start FiveM with +set moo 31337 or use the Beta or Latest channel. On FiveM for GTAV Enhanced that argument was removed, and the server must set sv_devMode true in server.cfg.

How do I enable resmon in FiveM?

Press F8 to open the client console, type resmon true (or resmon 1) and press Enter. If the console says access denied, switch on developer mode first as described above. resmon is documented as a client console command; on the server, use the profiler.

How do I close resmon?

Type resmon false or resmon 0 in the F8 console.

Does resmon show server lag?

No, it shows the script time of the resources running in your own game. For the server, watch the server console for hitch warnings and run profiler record 500 there.

What is a good CPU msec in resmon?

resmon colours it for you: green under 1 ms, yellow around 4.5 ms and red from 8 ms. A resource that stays above 1 ms while the server is idle is worth a closer look.

Sources

All opened on 4 November 2026: