Luacrash
attempt to call a nil value
Also seen as: attempt to call a nil value (global 'require') attempt to call a nil value (method 'X') attempt to call a nil value (field 'X')
What causes it
Your code tried to call something as a function that isn't one — it's nil. Usually the function belongs to a resource that isn't loaded, a framework object that hasn't initialized, or it's a typo. The special case (global 'require') means the script uses require, which FiveM's Lua runtime doesn't support by default.
How to fix it
Identify the function name in parentheses and confirm the resource or object that provides it is actually loaded before this line runs.
- Read the function name in the parentheses — that's what's nil.
- If it's
require: FiveM Lua doesn't supportrequireby default. The resource is likely built for a different environment or needs the correct fx_version and a compatible loader. Use the resource's intended version. - If it's a framework method: make sure the framework object (ESX/QBCore) is initialized before you call it.
- If it's an export: confirm the providing resource is
ensured before this one in server.cfg. - Check for a simple typo in the function name.
Related errors
Related guides
Still stuck? We can help.
Optimized, dual-framework scripts for QBCore and ESX from Viper Development — escrow protected, delivered instantly to your Cfx portal.