Skip to content
Vice Drip
Guide

How to Debug a FiveM Script: A Playbook

New Origins Studio engineering · published 2026-09-02 · updated 2026-09-02 · 12 min

The short answer

Debugging a FiveM script is mostly about narrowing where the problem lives before reading a single line of logic: which console actually logged the error, what the stack trace's nearest frame names, and whether txAdmin's console history shows the same failure on every restart or only once. Most "random" FiveM bugs are deterministic bugs whose exact trigger just hasn't been identified yet — the playbook below is how to find it.

Read the console like a structured log, not a wall of text

The F8 client console and the server console are two different logs for two different sides of the resource — an error raised on the client will never appear in the server console, and vice versa. The first triage question is always which console printed it, because that alone tells you whether to start reading client-side or server-side code.

Console output is also channel-tagged at the source (messages are commonly prefixed with the origin, like a script or resource name in brackets), which is often the fastest way to identify the true origin of a message even when its text doesn't name the resource directly.

Reading a Lua stack trace

A generic, illustrative example of the shape you'll see: a line naming a file path inside a resource, a line number, and a message such as attempt to index a nil value (global 'Config'). The actionable part is almost always that file-and-line pair closest to the actual message — it pinpoints exactly where execution failed, even when the resource that surfaced the symptom isn't the one actually at fault.

The message itself tells you what kind of mistake it is: "attempt to index a nil value" naming Config generally means something that was supposed to set up that value — often a shared script — either never ran or ran after the file that needed it, which is a start-order question as much as a code question.

Isolating client vs. server, and one resource vs. several

A bug affecting one player but not others points at something client-local; a bug affecting everyone at once points at the server. A bug appearing immediately on join narrows further than one that only appears after a specific interaction. Where the architecture allows it, testing with only server scripts active versus only client scripts active can binary-search which side actually owns the fault. When more than one resource might be involved, this shades into a conflict-diagnosis problem rather than a straightforward debugging one — our guide to diagnosing FiveM script conflicts covers the bisection method for that case in full.

txAdmin as a debugging log, not just a dashboard

txAdmin ships bundled with FXServer — no separate download required — and its Live Console keeps a searchable log history across restarts, alongside a Server Activity log covering connections, disconnections, and custom commands. The practical use for debugging: when a bug is intermittent, search that history for the same error text and check whether it correlates with restarts, specific players, or specific times, instead of relying on memory for whether "it happened last night too."

Common error signatures and what they actually mean

  • attempt to call a nil value (global/field 'X') — code tried to call something that doesn't exist yet at that point. Almost always a load-order problem (see our start-order guide) or a typo in an export or global name.
  • attempt to index a nil value (X) — code tried to read a property of something that doesn't exist yet. Commonly a config table or framework object read before it was populated.
  • bad argument #N to 'function' — a native or function received the wrong type. Check what's actually being passed against what the function expects.
  • Couldn't find resource X — server.cfg (or a dependency) names a resource that isn't installed, or is nested or misnamed. See our installation guide.
  • You lack the required entitlement — per the official asset escrow documentation, this means an escrowed resource's license check failed on this server. It's an account or purchase issue, not a code bug.
  • A resource that starts clean but does nothing in-game — usually a client script that never actually loaded (check that client_scripts in the manifest matches the real files) or an event/keybind being silently intercepted by another resource — see our conflicts guide.

Questions, answered directly

What does "attempt to index a nil value" mean in FiveM?

The code tried to read a property or field of something that doesn't exist at that point in execution — commonly a config table or framework object that hasn't been set up yet. It's frequently a start-order problem: the thing being indexed is defined by a resource or script that hasn't run yet.

How do I know if a FiveM error is client-side or server-side?

Check where it was actually printed — the F8 client console and the server console are separate logs, and an error on one side never appears on the other. Whichever console shows the error tells you which side of the resource to start reading.

Can txAdmin show me past server errors?

Yes — txAdmin's Live Console keeps a searchable log with history across restarts, and its Server Activity log tracks connections, disconnections, and custom commands. Searching for the exact error text is the fastest way to see whether a bug is a one-off or a recurring pattern.

What does "You lack the required entitlement" mean in FiveM?

Per the official asset escrow documentation, it means an escrowed resource's license check failed for this server — the server owner hasn't purchased or activated access to that resource. It's a purchase or account problem, not a bug in the resource's code.

Every question we answer →

Read next

More from performance — What a script actually costs your server, how to measure it, and how to audit a seller's number before you pay it.

Built to this standard
Full catalog →