How to Add a Script to Your FiveM Server
A practical add script FiveM guide for uploading resources, updating server.cfg, importing SQL, and verifying ESX, QBCore, and QBox installs before players join.
This guide is written for server owners who need a repeatable, low-risk script install process. It focuses on file placement, dependency order, database changes, rollback planning, and the checks that catch broken resources before players join.
If you manage a live roleplay community, treat every script install like a small release: back up the database, note the previous resource version, test with a staff account, and keep the rollback command ready. Most launch incidents come from skipped dependency order, mismatched item names, or SQL changes applied to the wrong database, not from the script files themselves.
Adding a script to a FiveM server is straightforward once you understand the resource structure. Whether you're adding a police job, inventory, phone, garage, HUD, or economy system, the core process is the same: upload the correct resource folder, start dependencies first, then tell your server to load the script.
This guide covers the full workflow: resource folder checks,server.cfg load order, SQL imports, framework-specific notes, live testing, and rollback. Follow the steps in order, especially if you are installing your first FiveM script on a public server.
Prerequisites
Before You Start
Server Requirements
- A running FiveM server (Windows or Linux)
- FTP, SFTP, or direct file access to your server
- txAdmin or console access to run
refresh,ensure,restart, and log checks - A framework installed: ESX, QBCore, or QBox (check script compatibility)
- oxmysql or mysql-async installed for database-dependent scripts
- A fresh backup of your
resourcesfolder, database, andserver.cfg
Database Setup
Many scripts require database tables. If the script includes a .sql file, import it into your FiveM database before starting the resource. Read the SQL first and confirm it targets the correct database, especially when it changes existing jobs, items, owned vehicles, or inventory tables.
-- Example SQL import for ESX
CREATE DATABASE fivem_server;
USE fivem_server;
-- Import your framework SQL files
SOURCE es_extended.sql;
SOURCE essentialmode.sql;Script and Resource Anatomy
In FiveM, a script is a resource. The folder you upload must be the resource folder itself, not an extra wrapper folder from a ZIP download. The fastest preflight check is simple: open the folder and confirm the manifest file is at the top level.
resources/
|-- my-police-script/
| |-- fxmanifest.lua
| |-- config.lua
| |-- client/
| | |-- main.lua
| |-- server/
| | |-- main.lua
| |-- html/
| |-- index.htmlClient-Side Scripts
Run entirely in the player's game client. These handle visual effects, UI overlays, and HUD elements β no database required.
Server-Side Scripts
Run on your server and manage game logic, player data, economy, and jobs. These typically require a database and framework.
Framework Scripts
Built specifically for ESX, QBCore, or QBox. These extend the framework's core features and must match your installed framework version.
Script Dependencies
Libraries, database connectors, target systems, inventories, and UI resources that another script expects to be running first.
How to Add a Script to FiveM
Download, Extract, and Inspect the Script
Download scripts only from a source you trust, then extract the archive locally before uploading anything. Confirm the resource folder contains fxmanifest.lua or a legacy __resource.lua, read the included install notes, and check whether the author lists dependencies such as ox_lib, oxmysql, qb-core, or es_extended.
# Good
my-police-script/fxmanifest.lua
# Bad: extra wrapper folder uploaded by mistake
my-police-script-main/my-police-script/fxmanifest.luaUpload the Resource Folder
Upload the actual resource folder into your server's resources directory. SFTP works for most hosts, panel file managers are fine for smaller archives, and SSH is useful when you are pulling from a Git repository. Keep the folder name simple: lowercase letters, numbers, dashes, and no spaces.
# Common server-data layout
server-data/resources/my-police-script
# Optional category grouping
server-data/resources/[jobs]/my-police-script
server-data/resources/[standalone]/ox_libTip
[jobs], [vehicles], or [standalone]. You can still ensure individual resources, or ensure the whole bracket group when the load order is intentionally managed inside that group.Import SQL Before the First Start
If the script includes .sql files, back up the database and import them into the database your server actually uses. Read the SQL first: job systems, inventories, garages, and housing scripts often add tables or rows that must match your framework's item and job names.
# Example only - adapt to your database host and file name
mysql -u fivem_user -p fivem_database < install.sqlConfigure Framework, Items, Jobs, and Permissions
Open the script's configuration files before starting it. Set the framework mode, locale, webhook URLs, permissions, job names, inventory item names, notification system, target system, and any coordinates. Most "script installed but nothing happens" issues come from a config value that does not match the server's existing data.
Config.Framework = "qbcore" -- qbcore, esx, qbox, standalone
Config.Inventory = "ox_inventory"
Config.Target = "qb-target"
Config.Locale = "en"
Config.RequiredJob = "police"
Config.RequiredItem = "police_badge"Add the Script to server.cfg in the Right Order
Open server.cfg and add an ensure line for the script after every dependency it uses. Database connector, libraries, framework core, inventory, target, and menu resources should load before gameplay scripts that call their exports.
# Database and shared libraries
ensure oxmysql
ensure ox_lib
# Framework core
ensure qb-core
ensure qb-target
ensure ox_inventory
# Jobs and gameplay scripts
ensure qb-policejob
ensure my-police-script
# Optional category folder, only when order inside the folder is safe
# ensure [standalone]Refresh, Ensure, or Restart During a Maintenance Window
For a simple standalone script, you can usually run refresh and then ensure resource-name. For scripts with SQL migrations, inventory changes, framework events, or many dependencies, a full restart during a maintenance window is safer.
Useful Console Commands
refresh- rescans the resources folder and manifestsensure [script-name]- starts the resource if stopped, or restarts it if runningrestart [script-name]- restarts a resource that is already loadedstop [script-name]- stops a running resource for rollback or isolation
Test Server Logs, F8 Console, Permissions, and Persistence
Join with at least one staff account and one normal player account. Watch the server console, the player's F8 console, and txAdmin logs. Confirm the script can save data, load after reconnect, respect permissions, and stay below your performance budget in resmon.
Do Not Skip Normal Player Testing
Document the Change and Keep a Rollback Path
Record the resource name, version, source, dependencies, SQL files, config files changed, and test result. If the script causes errors, stop the resource, remove or comment its ensure line, and restore the previous database or config backup before trying a second fix.
# Fast rollback example
stop my-police-script
# Then remove or comment this in server.cfg
# ensure my-police-scriptFramework Guides
The load order in server.cfg is critical. Always start your framework core before any scripts that depend on it.
LegacyESX Installation
The original roleplay framework with years of stability and the largest script library.
# ESX server.cfg order example
ensure oxmysql
ensure es_extended
ensure esx_menu_default
ensure esx_menu_dialog
ensure esx_menu_list
# Your ESX scripts
ensure esx_policejob
ensure esx_mechanicjob
ensure my-custom-esx-scriptPopularQBCore Installation
The most popular modern framework with excellent performance and beginner-friendly design.
# QBCore server.cfg order example
ensure oxmysql
ensure qb-core
ensure qb-target
# Your QBCore scripts
ensure qb-policejob
ensure qb-mechanicjob
ensure my-custom-qb-scriptModernQBox Installation
A modern QBCore-compatible framework with improved architecture and an actively maintained ecosystem.
# QBox server.cfg order example
ensure oxmysql
ensure qbx-core
ensure ox_lib
# Your QBox scripts
ensure qbx-police
ensure my-custom-qbox-scriptNot sure which framework to use?
Troubleshooting
Script Not Loading
The resource fails to start, or the server says it cannot find the resource.
- Check that the folder name in
server.cfgmatches the actual folder name exactly (case-sensitive on Linux) - Verify the folder contains a valid
fxmanifest.luafile - Run
refreshthenensure [name]in the server console and check for errors - Make sure you uploaded the actual resource folder, not a nested GitHub wrapper folder
Database Errors on Start
The server console shows SQL or database connection errors when the script starts.
- Import the script's
.sqlfile into your database if you haven't already - Ensure
oxmysqlis started before the script inserver.cfg - Confirm the connection string points at the same database where you imported the script tables
Script Starts But Does Not Work In-Game
The resource is running, but menus, commands, markers, items, or jobs do not behave as expected.
- Confirm the script is designed for your framework: ESX, QBCore, QBox, or standalone
- Check the script's documentation for minimum framework version requirements
- Verify job names, item names, ACE permissions, and Discord role settings against your actual server data
Performance Drops After Adding the Script
Players report stutter, hitch warnings, or high client resource time after the new script starts.
- Use
resmonto identify whether the new resource is consuming excessive client time - Disable expensive config options such as short polling intervals, long draw distances, or unnecessary markers
- Test conflicts by stopping recently added resources one at a time instead of changing several scripts at once
Check the Console First
ensure [script-name].Best Practices
Stay Organized
Group scripts by purpose and avoid duplicate systems. Two inventories, two phones, or two notification stacks usually create conflicts.
Backup First
Back up the database, resources, and server.cfg before every install that touches player data.
Load Order
Put dependencies first: database, libraries, framework core, inventory, target/menu, then jobs and gameplay scripts.
Test Thoroughly
Test with staff and normal player accounts, then watch txAdmin, server console, F8 console, and resmon.
Official References
The steps above are written for everyday server owners, but the low-level behavior comes from Cfx.re's own documentation. Use these pages when you need to verify manifest syntax, console commands, or txAdmin behavior.
Cfx.re resource manifest
Official documentation for fxmanifest.lua, resource metadata, client scripts, server scripts, and files loaded by a FiveM resource.
Cfx.re server commands
Official command reference for refresh, exec, and other server console commands used when loading resources.
Cfx.re txAdmin
Official txAdmin overview for managing, monitoring, restarting, and inspecting a FiveM server instance.
Turn this tutorial into a launch-ready script stack
Once the install flow is clear, move into the framework hub or commercial path that matches your server build.
Framework hub
Start with the QBCore script stack
If you're launching on a modern framework, move into the QBCore hub for install-ready scripts, compatibility context, and verified premium options.
Open QBCore hubFramework hub
Review the ESX path
Use the ESX landing page when your server depends on the legacy framework and you want scripts that fit its established ecosystem.
Open ESX hubPremium catalog
Compare premium scripts
Move from installation theory into the live catalog to compare real products, framework labels, and production-ready resources.
Open premium shopLaunch faster
See curated bundles
Bundles cut setup time when you want a working server foundation instead of choosing every script one at a time.
View bundlesNext Scripts to Add
Ready to add your first script? These are common next-step systems for roleplay servers. Check framework compatibility, dependencies, and SQL requirements before installing any of them.
Advanced Police Job
Full-featured police job with arrest system, evidence handling, MDT, and duty management. Supports ESX and QBCore.
Custom Vehicle Dealer
Modern vehicle dealership UI with test drive, financing, and inventory management. Fully configurable and framework-agnostic.
Mechanic Job Script
Complete mechanic job with repair system, parts inventory, and customer towing. Works with ESX, QBCore, and QBox.
Custom Interior MLO Pack
High-quality custom interior MLOs for police stations, hospitals, and shops. Drag-and-drop installation with no SQL required.
Need a complete server setup?
Don't have a server yet? Read how to create a FiveM server β a three-path guide that helps you choose between free, template, and manual approaches. Or browse our curated server template bundles:
View Server TemplatesFrequently Asked Questions
Do I need to restart the whole server to add a new script?
refresh in the server console, then ensure [script-name]. Use a full restart for scripts with database migrations, framework startup hooks, inventory changes, or complex dependencies.Can I run ESX and QBCore scripts on the same server?
What does "ensure" mean in server.cfg?
ensure starts a resource if it's not running, or restarts it if it is. It is preferred over start for most server.cfg entries because it is safe to run repeatedly. Put dependencies above scripts that use them.Why do some scripts require ox_lib?
How do I update a script to a newer version?
Why does FiveM say my script has no resource manifest?
fxmanifest.lua. Open the uploaded folder directly inside resources. The manifest file should be visible there, not hidden one or two folders deeper.Ready to Add Better Scripts?
Browse free and premium FiveM scripts with framework labels, install context, and launch-ready categories for ESX, QBCore, and QBox servers.