Skip to main content
TRACK B·FRAMEWORK INTEGRATION·Verified June 2026 · Lua 5.4 · ox_lib 3.x
Learning with an AI assistant?
Copies this lesson plus 2026 ground rules (no lua54 'yes', Cfx.re Portal, correct callback signatures) as a ready-to-paste mentor prompt.
ESX

ESX: how the framework works

ESX (the resource is named es_extended, the modern build is called ESX Legacy) is the framework that sits under a roleplay server. A framework is the shared engine your other scripts build on. ESX handles who is logged in, their money, their job, and their items. Other scripts ask ESX for that data instead of inventing their own. This lesson explains how ESX itself works, one piece at a time.

You'll do
Learn how es_extended (ESX Legacy) works: the shared object, the client/server split, xPlayer data, money, jobs, items, usable items, notifications, commands, and callbacks. Then build a small /drinkwater script.
Time
~30 minutes to read and try the example.
You need
A running ESX Legacy server and a code editor. You should be able to add a resource and restart it.
Result
You can read and write basic ESX scripts and know where player money, jobs, and items live.
BEFORE YOU START

What is ESX

ESX is a framework for FiveM roleplay servers. Think of it as the foundation underneath all of your roleplay scripts.

ESX itself handles:

  • Players who is logged in, their character, money, job, and more.
  • Jobs police, mechanic, ambulance, and so on. Jobs live in the database, not in a file.
  • Money cash, plus accounts like bank and black_money (dirty money).
  • Items the things a player carries in their inventory.
  • Commands the things you type in chat with a slash, like /car.

Other scripts (an inventory, a gas station, a car dealership) build on top of ESX and ask it for help: who is this player, how much money do they have, take 500 from their bank.

The one thing to remember: the framework resource is es_extended. Everything else is a separate script that depends on it.

Keep reading the full lesson

Sign in to start, then unlock every step of this lesson and the full FiveM School with a membership.

Still ahead in this lesson
  • Client and server: the two sides
  • Getting the shared object
  • xPlayer: everything about a player
  • Server functions: money, jobs, items
  • Client functions: notify and player data
  • Commands: built-in and your own
  • Callbacks: ask the server a question
  • Jobs live in the database, not a file
  • A complete mini example
  • Common mistakes

The remainder of ESX: how the framework works is available to FiveM School members.