How fxmanifests Work with FiveM
An fxmanifest.lua
is the backbone of any FiveM resource. It tells the server which files to load, what they do, and how they should be handled—whether that's on the client, server, or both.
__resource.lua
In older resources, you might come across a file named __resource.lua
. Before fxmanifest.lua
existed, this was used to define how a resource behaves. It serves the same purpose but is now outdated and replaced by the fxmanifest system.
How to Start an fxmanifest
When setting up an fxmanifest.lua
, make sure the file is named exactly that—fxmanifest.lua—and is located in your resource folder. Here’s a quick look at what that should look like:
At a minimum, you need to define two things:
fx_version
game
fx_version
options:
cerulean
– Newest and most secure (recommended)bodacious
– Olderadamant
– Legacy version
game
options:
gta5
– For FiveM (use this for Qbox)gta4
– For LibertyM (rarely used)rdr3
– For RedMcommon
– Works across games, but lacks access to game-specific natives (not recommended)
Here’s a basic example:
Specifics of the Manifest
Defining Client and Server Scripts
The fxmanifest.lua
lets you define which scripts run on the client (the player’s game) and which run on the server (the host environment).
Client Script Example:
client_script 'client.lua'
If your script is inside a folder:
client_script 'foldername/client.lua'
Server Script Example:
server_script 'server.lua'
Defining Multiple Scripts
If you want to load multiple files:
client_scripts {
'client.lua',
'client2.lua'
}
Or use a wildcard to include everything in a folder:
client_scripts {
'clientfolder/*.lua'
}
- The
*
wildcard includes all.lua
files in a folder. - You can use wildcards with folders too.
- More details in the Resource Manifest documentation
Shared Scripts
Shared scripts are loaded by both the client and the server. These are typically used for configs or utility files.
shared_script 'config.lua'
-- Or multiple files:
shared_scripts {
'config.lua',
'shared_utils.lua'
}
Dependencies
Hard Dependencies
Hard dependencies ensure a resource won't start unless certain conditions or resources are met.
dependencies {
'/server:4500', -- Requires server build 4500 or higher
'/policy:subdir_file_mapping', -- Requires server key permission
'/onesync', -- Requires OneSync
'/gameBuild:h4', -- Requires game build 2189 or higher
'/native:0xE27C97A0', -- Requires support for this native
'ox_lib' -- Requires ox_lib to be started
}
If any of these are missing, the resource will not start.
Soft Dependencies
Soft dependencies are optional—if the resource is missing, your script might throw an error, but it will still run.
Defined like this:
shared_script '@ox_lib/init.lua'
Files
Use the files
section to include additional files like JSON, images, or configs:
files {
'data/main.json',
'config.ts'
}
Vehicles in a Manifest
To define vehicle-related files, just tell the manifest what each file does:
fx_version 'cerulean'
game 'gta5'
data_file 'HANDLING_FILE' 'data/**/handling.meta'
data_file 'VEHICLE_METADATA_FILE' 'data/**/vehicles.meta'
data_file 'CARCOLS_FILE' 'data/**/carcols.meta'
data_file 'VEHICLE_VARIATION_FILE' 'data/**/carvariations.meta'
files {
'data/**/*.meta'
}
Wildcards like **
allow you to include files across subdirectories.
Other Options
You can also define extra metadata for documentation or internal use:
author 'John Doe <j.doe@example.com>'
description 'Example resource'
version '1.0.0'
-- Scripts to run
client_scripts {
'client.lua',
'client_two.lua'
}
server_script 'server.lua'
-- Custom metadata
my_data 'one' { two = 42 }
my_data 'three' { four = 69 }
-- Alternate syntax
my_data('nine')({ ninety = "nein" })
-- Arbitrary metadata keys are allowed
pizza_topping 'pineapple'