Write your own scripts
Start with Lua, then build, test, and debug your own FiveM resources.
Work toward: Your own working FiveM resources.
Start with free introductory lessons. Membership unlocks the full library, guides, and standard support. Explore Membership
Your learning path
Follow the modules in order. Optional lessons are there when you need them.
Written lessons and reference material are currently in English.
Developer setup
Tooling and version control before you write a line.
- Start here: building FiveM scriptsWho this track is for, the two-world rule, and the path from your first line of Lua to a sellable resource.
- Choose a runtime: Lua, JS, or C#Why Lua is the default, and when JavaScript or C# fit instead.
- Set up VS Code for FiveMEditor, Lua language server, and Cfx native autocomplete.
- Git and GitHub for FiveM developersGit without a terminal. The safety net every pro uses.
- Deploy changes from localhost to your serverCode on your PC, push, pull on the VPS, restart, with a rollback path.
Lua fundamentals
Read and write Lua.
- Your first line of LuaPrint to the server console. Variables, strings, the most-used function in Lua.
- Variables, numbers, stringsStore, change, combine. The three data types you use 95% of the time.
- If, else, elseifConditions, comparison operators, and nil vs false.
- Loops: for, while, when to stopRepeat actions and why a loop without Wait freezes the server.
- FunctionsReuse logic instead of copy-paste. Arguments and return values.
- TablesArrays, dictionaries, nesting. Lua's everything structure.
- Read errors and debug your first scriptWhat nil, missing exports, and SQL errors actually mean. Optional, useful again later.
Your first resource
Turn Lua into a real FiveM resource.
- Anatomy of a resourcefxmanifest.lua line by line.
- Client, server, sharedWhy the split exists and the one rule you never break.
- Your first FiveM script: an in-game commandBuild a /bananas command that prints to the F8 console in-game. Client vs server, your first real resource.
- Create a basic FiveM script from zeroThe minimum files, a thread, a chat command, and a key-press detector.
- Start, restart, stop: the dev loopensure vs restart, reading the console as feedback.
FiveM fundamentals
Natives, threads, events, and the trust boundary.
- FiveM natives: the toolboxWhat a native is and how to find one in the docs.
- Players, peds, and idsPlayerId vs PlayerPedId vs server id vs network id, and the source variable.
- Coordinates, vectors, and distancevector3, GetEntityCoords, heading, and #(a - b) distance checks.
- Reading player input: controls and keysControl IDs, IsControlJustPressed, disabling keys, RegisterKeyMapping.
- Two worlds, one resourceClient vs server. They cannot read each other's variables.
- CreateThread and WaitBackground loops without freezing the server.
- Trust and authorityThe server must stay in charge, or cheaters win.
- TriggerEvent: same-sideA one-line pattern that keeps code clean.
- TriggerServer and TriggerClientEventCrossing the wall, plus the source variable.
- CallbacksAsk and wait for an answer with lib.callback.
- ox_lib: notifications and UINotifications, inputs, progress bars, and context menus.
- State bags: concepts and basic usageShared state without events.
- How to use State BagsSet, get, and react to State Bag changes - share data between resources without events.
- Latent eventsStreaming big payloads without overflow.
- Cancelling eventsStop an event before other handlers see it.
- Built-in resources: chat, spawnmanager, baseeventsThe stock resources every server runs and their hooks.
Data and persistence
JSON, KVS, oxmysql, and data that survives a restart.
- Using JSON in FiveMjson.encode/decode, SaveResourceFile, LoadResourceFile, and multi-player data patterns.
- Persistence without a database: the KVSSetResourceKvp/GetResourceKvp for small state with no SQL.
- SQL fundamentals and your first queriesParameterized queries, remember data safely.
- CRUD and prepared queries with oxmysqlCRUD without footguns, prepared statements, transactions.
- Persistence: cache and write-backSurvive restarts without smashing the DB.
Framework integration
Standalone vs frameworks, and the QBCore, Qbox, and ESX paths.
- Framework integration: QBCore, Qbox, ESXPlayer objects, money, jobs, shared patterns.
- QBCore: how the framework worksThe Core object, PlayerData, server and client functions, commands, and callbacks.
- ESX: how the framework worksThe shared object, xPlayer, money and jobs and items, commands, and callbacks.
- Qbox: how the framework worksThe ox-based fork: direct exports, ox_inventory, ox_lib notify, commands, callbacks.
- Multi-character and identity systemsLicense vs character id, and why everything keys off it.
- Inventory migration: QB, ESX, oxMove to ox_inventory without losing player items.
- QBCore to Qbox migrationThe ox stack, the bridge, and a staged cutover.
Build real products
Ship jobs, menus, trades, and a banking feature end to end.
- /heal command: your first buildPlan before coding. A command with a cooldown.
- Jobs frameworkClock-in, grades, a payroll loop that never double-pays.
- Mini banking capstoneBalance checks, server validation, safe writes.
- Server-only banking and auditPersist balances, audit-log every transaction.
- Cleanup disciplineDelete on stop, drop, and timeout. No leaks.
- ox_target: interact with anythingEye targeting on props, peds, vehicles.
- Spawning entities safelyModel loading, handles, a registry for objects, props, peds.
- Teleport menu with ox_libLocations, permission checks, cooldowns.
- Player-to-player trade systemBuild a server-authoritative trade with ox_inventory: ownership + proximity checks, both-confirm, anti-dupe lock.
- Player survey form with ox_libA /survey command that draws a free NUI form, then re-validates every answer server-side.
- Vehicles: spawn, modify, storeSpawn patterns, network ownership, cleanup on timeout.
- Vehicles and garagesPlate as key, the spawn-store-retrieve loop.
- Blips, markers, and checkpointsMap icons, world markers, and standing-in-it detection.
- Draw on screen: text, 3D text, and markersDrawText, a DrawText3D helper, DrawMarker, and gating the draw loop by distance.
- Animations and scenariosRequestAnimDict, TaskPlayAnim flags, scenarios, and ClearPedTasks.
Interfaces (NUI)
Build in-game HTML/CSS/JS interfaces.
- Build your first NUI with HTML, CSS, and JavaScriptA Chromium overlay with two-way messages.
- NUI accessibility and performanceFocus traps, resolution scaling, render cost, readability.
- NUI advanced: React and ViteSetNuiFocus, callbacks, the production React setup.
- Build FiveM UIs faster with fivem-ui-libNUI simplified: .send() and .on() for Lua↔JS, built-in notifications, no boilerplate.
- DUI: render HTML on 3D surfacesPaint a live webpage onto a prop or screen with CreateDui.
- Reskin a script's UI colorsChange NUI colors safely: find the CSS, edit values not structure, refresh.
- Custom loading screen with musicBranded loading screen with logo, background, progress bar, rotating tips, and background music.
Production engineering
Exports, performance, OneSync, security, and production debugging.
- Exports across resourcesexports(name, fn), server vs client.
- HTTP requests and webhooksPerformHttpRequest, Discord webhooks, JSON.
- Promises and asyncpromise.new, resolve, Citizen.Await.
- Measure performance with resmon and the profilerresmon, threads, the 0.5ms hot path.
- Optimize client, server, network, and database performanceDistance checks, throttled loops, Wait tuning, and verifying your fix with resmon.
- Systematic debugging for production resourcesStructured logging, pcall, the stop-and-collect checklist.
- Anti-cheat patternsServer-authority, rate limits, integrity.
- OneSync fundamentals and entity ownershipCull distance, instancing, population.
- Migrating legacy resources to OneSyncEntity ownership checks, scoped events, and the patterns that changed with OneSync.
- OOP via metatablessetmetatable, __index, the class pattern.
- Multi-threading for advanced scriptsOffload heavy computation to separate threads, use Citizen.SetTimeout for deferred work.
- Voice scripting: proximity, channels, radioThe mumble natives that build voice features, beyond config.
- Setting up C# for FiveM resourcesWhen C# beats Lua, the .NET project setup, BaseScript lifecycle, and calling natives from C#.
- Handling basics and safe editshandling.meta with a Git revert path.
- Add Discord rich presence to your serverShow player count, server name, and custom art in Discord with a Join button.
Test and release
Sell and support
License, sell on Tebex, and support paying customers.
- Resource licensing and escrowOpen vs escrowed, buyer editing rights, protect your core.
- Build and grow a trustworthy Tebex storeStore setup, package pages, test delivery, offers, growth tools, and a measured launch plan.
- Tebex compliance and refundsRefund policy, chargebacks, records, platform rules.
- Paid script support workflowIntake template, reproduction, triage, fix-and-release.
