FiveM natives: the toolbox
Natives are the buttons that make the game do things, and your real skill is knowing how to look one up. A native is just a built-in game function. FiveM ships thousands of them, and they do the real stuff: move a ped (a character), draw text, spawn a car, read someone's health. Nobody memorizes the list. Good developers look them up. You already know some Lua and you know there's a client side and a server side. This lesson teaches you to read a native straight from the docs, then proves you can by building a script that reads your position and health and teleports you cleanly onto the ground.
Find a native
Here's the deal: you don't remember natives, you find them. A native is a built-in function the game (or Cfx) hands to your script, and there are thousands. Look the one you need up in the official native reference, then use the Lua manual for the plain language stuff around it.
When you open a native, read three things before you use it:
- The side badge. The docs call this the API set: a native is marked client, server, or shared (runs on both). A client-only native like
GetEntityCoordswill not run in aserver_script, and a server-only one will not run in aclient_script. Match the native's side to the file it lives in. - The arguments. The signature shows what to pass in and in what order, for example
GetEntityCoords(entity). Pass the wrong type and you getnilor a crash. - The return value. Some natives hand you something back (coords, health, a handle); some just do a thing and return nothing.
A native is marked CLIENT. Can you call it from your server.lua?
No. A client native only runs in client scripts (loaded with client_script), and a server native only runs in server scripts. (A shared native runs in both.) The API-set badge in the docs tells you which file the call belongs in. Calling across the line is the single most common beginner native error. Every native you use in this lesson is a client native, which is exactly why the file you build is a client_script and not a server_script.
Keep reading the full lesson
Sign in to start, then unlock every step of this lesson and the full FiveM School with a membership.
- Build it
- How it works
- If something went wrong
- What you can do now
- Try it yourself
The remainder of FiveM natives: the toolbox is available to FiveM School members.