Debugging FiveM Scripts: print, F8 and Error Logs
Where FiveM print output and Lua errors appear: the server console, the txAdmin live console and the F8 client console, plus how to read an error.
Short answer: use print() to log values from a script, then read the output where that script runs. Client scripts print to the F8 client console. Server scripts print to the server console, which txAdmin shows in its live console. A Lua error names the resource, the file and the line, so start there.
Last checked: 29 November 2026
Short answer
FiveM scripts have two sides. A client script runs on each player's game and writes to the F8 console. A server script runs on the FXServer process and writes to the server console. When something breaks, the first job is to work out which side failed, then open the console for that side.
Where errors and print output appear
- F8 client console: press F8 in the game. The official docs say a client
printshows here, and forum users report client script errors here too. - Server console: the window or terminal running FXServer. Server-side errors and start messages are reported here in forum threads.
- txAdmin live console: the Live Console in the txAdmin panel. Forum posts describe resource start errors and script messages appearing here, so check it first if you run txAdmin.
If you cannot see an error in one place, check the other. A client error will never appear in the server console, and a server error will not appear in F8.
Using print and the console in scripts
The official "Creating Scripts" guide uses a single client print:
print('helloWorld')
Paste it into client.lua, restart the resource, press F8, and helloWorld prints. Use the same call in a server file to print to the server console. The guide I checked does not spell out server output, so confirm it on your build.
Practical habits:
- Add a prefix, such as
print('[myres] reached shop'), so you can find your lines in a busy console. - Print one value per line, and remove the prints once the bug is fixed.
- Use the console commands from the docs when the problem is performance or NUI:
resmon trueopens the resource monitor for CPU and memory per resource.profiler record 500starts a profiler capture of 500 frames. Then useprofiler statusto check progress andprofiler viewto open the result in Google Chrome.nui_devtoolsopens NUI dev tools. Developer mode must be on. On the Enhanced client, the server needssv_devMode true.
How to read a Lua error
A typical resource load error from a forum thread looks like this:
Error loading script server/main.lua in resource esx_skin: @esx_skin/server/main.lua: 31: attempt to index a nil value (global 'ESX')
Break it into four parts:
- Resource:
esx_skin, the folder name of the resource that failed. - File:
server/main.lua, the file inside that resource. - Line:
31, the line where Lua stopped. - Message:
attempt to index a nil value (global 'ESX'), which means the code read a field fromESXwhileESXwasnil.
Open the file at that line and look at the variable named in the message. The usual cause is that a framework object was never loaded or started too late. One forum fix for an ESX Legacy setup was to add shared_script "@es_extended/imports.lua" to the manifest. Check your framework's own docs before copying that. The message itself tells you where to look, and the fix depends on your framework version.
Checking resource start errors
When a resource does not start, look at the console lines printed during startup, not the game. Forum threads report these messages:
Failed to load scriptafter anError loading scriptline. Read the first error line for the file and message.Could not start dependency ... for resource .... The dependency must be started before the resource inserver.cfg.Couldn't find resource. Forum answers point to a folder in the wrong place, or a folder name with spaces. Use a one-word folder name inside the server's resources folder.
If the whole server exits or restarts in a loop instead of printing a Lua error, the cause may be outside your script. See FiveM crash codes explained.
Debug checklist
- Open the server console or txAdmin live console before you start the resource.
- Open F8 in the game to see client output.
- Find the first error line, since later errors are often knock-on effects.
- Note the resource, file and line from that error.
- Open that line and check each variable used on it.
- Confirm the resource folder name and its manifest, and that dependencies start first in
server.cfg. - Restart the resource and test again, adding one
printat a time. - If the problem is lag rather than an error, use the profiler. See how to fix FiveM server lag with the profiler.
Common mistakes
- Looking for a client
printin the server console. Client output goes to F8. - Reading only the last error. The first line usually names the real problem.
- Editing a file and not restarting the resource, then assuming the fix failed.
- Using folder names with spaces, which cause "Couldn't find resource" errors in forum reports.
- Leaving debug prints in a live server, where they clutter the console.
FAQ
Why does my print() not show in F8?
Check that the code runs on the client. A print in a server file goes to the server console. Also check that the resource started. If startup failed, the script may never run, so nothing prints.
Where do server-side errors appear?
In the server console, and in the txAdmin live console if you use txAdmin. Forum threads describe both places. Start messages and load errors usually appear there.
Does FiveM have a built-in debugger?
I did not find a step-through debugger in the docs I checked. The documented tools are print output, the F8 and server consoles, the resource monitor and the profiler. Treat any claim of a separate debugger as unverified until you see it in the official docs.
Sources
- FiveM docs: Console Commands
- FiveM docs: Using the Profiler
- FiveM docs: Creating Scripts
- FiveM docs: Server Debugging
- Cfx.re forum: catch script errors from console or F8
- Cfx.re forum: Lua error starting my FiveM server
- Cfx.re forum: attempt to index a nil value (global 'ESX')
Not confirmed: the docs I checked do not state where server-side print() output appears, so that is expected behavior to verify. The resource/file:line error format comes from forum posts, not an official reference page. The txAdmin live console behavior is from forum threads, not docs. I did not check whether newer artifacts change these outputs, and I did not find an official page listing every console message.
FiveM.tools was founded with sponsorship from Nyru.