Frameworks & scripts

Lua

Also called Lua 5.4, lua54

The scripting language most FiveM resources are written in, running on both client and server with access to game natives.

Lua is the main scripting language for FiveM resources. FiveM also supports JavaScript and C#, but the frameworks, most community resources and most tutorials use Lua, so it is the language a server owner ends up reading most.

FiveM runs Lua 5.4 when the resource opts in with lua54 'yes' in its fxmanifest. Lua 5.4 adds integer types, <const> and <close> locals and better performance in some cases. Older resources without that line run on the legacy runtime, which still works but is worth migrating.

Scripts are split by side. Client scripts run on each player's machine, can call client natives, and must never be trusted with anything that matters. Server scripts run once on the server and are the authority for money, items and permissions. Most security bugs in FiveM are server events that accept whatever the client sends without checking.

Performance problems usually come from a few patterns: a while true do loop with Wait(0) that runs every frame when it only needs to run every second, distance checks across hundreds of objects each frame, and repeated native calls that could be cached. resmon shows which resource is responsible.

Server owners do not need to write Lua to run a server, but reading it is worth learning. Being able to open a script, find its config, spot an obvious infinite loop or an unchecked server event saves days of waiting on a developer.

Related terms

Trying to get your server seen?

The live leaderboard shows what the numbers look like at the top of the list, and the upvote calculator turns a target server into a campaign size. The full glossary is here.