Natives and how to read the docs
A native is a built-in function the game hands you for free. Want to spawn a car, read where a player is standing, or draw text on the screen? There is a native for that, and there are thousands of them. Nobody memorizes the list. The real skill, the one this lesson teaches, is finding the native you need and reading its docs so you know exactly how to call it. This is an awareness lesson: you will learn to recognize and read natives here, then wire them into real features later in the paid Tracks.
Watch
What a native is
A native is a function built into GTA V and FiveM that you call to do something in the game world. Spawn a car. Get a player's position. Draw text on the screen. Heal a character. Each of those is one native call.
Think of it like this. GTA V is a giant machine with thousands of buttons on it. Rockstar built the machine and wired every button to an action. FiveM exposes those buttons to your Lua code, so when you write a line that calls a native, you are pressing one of those buttons from your script. You did not build the action behind the button. You just learned its name and pressed it.
So your job is rarely "invent how to spawn a car." The car-spawning logic already exists inside the game. Your job is to know that the button is called CreateVehicle, know what to hand it, and call it at the right moment.
Vocabulary
- native
- A function the game already wrote and FiveM lets your script call. You do not see its inside; you call it by name and it does its job.
- parameter
- A value you hand a native so it knows what to act on. CreateVehicle needs to know which car and where, so those are its parameters.
- return value
- What a native hands back to you after it runs. GetEntityCoords returns a position; some natives return nothing and just do a thing.
- hash
- A number the game uses as a name. Some natives want a hash instead of a word, for example to pick which car model to spawn. The docs tell you when a parameter is a hash.
Why natives matter
Here is the part that reframes everything. When you write a FiveM feature, most of your Lua is not clever logic you invented. It is a sequence of native calls, arranged in the right order, with a little of your own logic gluing them together.
Picture a "heal me" command. In plain words it is: find the player's character, then set its health to full. Both of those are natives. Your Lua does almost nothing on its own. It calls one native to get the character, calls another native to set the health, and that is the feature. The natives do the heavy lifting in the game world. Your code arranges the calls.
That is why natives matter so much. They are the actual tools that make things happen on screen. Lua is the language you speak, but natives are the verbs. A developer who knows how to find and read natives can build almost anything, because the game already contains the action. They just have to call it correctly.
How to read the docs
Every native lives in one searchable place: the official native reference at docs.fivem.net/natives. This is the page you will keep open in a browser tab forever. You do not learn natives by memorizing them. You learn natives by getting fast at looking them up.
Say you want to read where a player is standing. You search the native database for a word like GetEntityCoords. When you open a native's page, read three things before you ever use it:
The parameters
The page shows a signature, which is the native's name followed by the values it expects, in order. For GetEntityCoords it looks like Vector3 GetEntityCoords(Entity entity). The part inside the parentheses, Entity entity, is the one parameter: a reference to the entity whose position you want. Order and type matter. Hand a native the wrong thing and it will fail.
The return value
The bit before the name, Vector3, is what the native hands back. Here it is a Vector3, which is one value that packs three numbers together: an x, a y, and a z position. Some natives return nothing because they just perform an action. The docs always tell you which.
The side badge
Near the top, the docs mark a native as client, server, or shared. We will explain what that means in the next section. For now, just know the badge is there and you must read it.
Now look at one tiny example that calls a native, so you see the shape:
local ped = PlayerPedId()
local pos = GetEntityCoords(ped)
print(pos.x, pos.y, pos.z)Line one calls PlayerPedId, a native that hands back a reference to the local player's character. We store that reference in ped. Line two calls GetEntityCoords and hands it ped as its parameter, and the native returns the position, which we store in pos. Line three reads the three numbers out of that position with pos.x, pos.y, and pos.z and prints them. Two native calls, one small piece of your own glue. That is what almost all FiveM code looks like up close.
Client side vs server side natives
FiveM code runs in two places. The client is each player's own game, running on their PC. The server is the one machine everyone connects to. Some natives only exist on one side, and that is the single most important thing the docs tell you.
GetEntityCoords and PlayerPedId are client natives, because each player's character lives on their own machine. A native like DropPlayer, which kicks someone off the server, is a server native, because only the server can decide who stays connected. Call a client native from server code, or the other way around, and it will not work. It either errors or quietly does nothing.
You will build with these in Track B
Start Here is about recognizing natives and reading their docs with confidence. That is a real skill on its own, and it is enough for this lesson. You are not expected to build a working feature out of natives yet. The deep, hands-on part, where you wire PlayerPedId, GetEntityCoords, CreateVehicle, and friends into a real command that does something a player can see, happens in the paid Track B (Write scripts). By the time you arrive there, opening the native docs and reading a signature will already feel normal, so the building goes faster.
Common beginner mistakes
| Symptom | Fix |
|---|---|
attempt to call a nil value (global 'SetPedArmour') | You called a client-only native from server code, so on the server it does not exist and reads as nil. Check the client / server / shared badge in the docs and move the call to the correct side. |
You copied a native call from a forum and the value you needed is empty. | You used the native without reading what it returns. Open its docs page, confirm it actually returns the thing you want, and confirm you are reading the return value into a variable. |
You guessed a native's name or argument order and it threw an error. | Do not guess. Search docs.fivem.net/natives for the exact name, then copy its signature so the parameters are in the right order with the right types. |
Before using an unfamiliar native, what is the first thing you should do?
Look it up in the official native reference at docs.fivem.net/natives. Read its three key parts before you write the call: the parameters it expects (and their order), the value it returns, and the client / server / shared side badge. Guessing the name or the argument order is what causes most beginner native errors, and a ten-second search prevents all of them.
Try it yourself
What you can do now
- Explain that a native is a built-in game function FiveM lets your script call, and that there are thousands of them.
- Say why most FiveM features are really just native calls arranged in order, with a little of your own logic between them.
- Open docs.fivem.net/natives, search a native, and read its three key parts: parameters, return value, and the client / server / shared side badge.
- Spot the most common native mistakes: calling a native on the wrong side, ignoring what it returns, and guessing instead of searching the docs.
You now know what natives are and how to read them, which is the foundation under every script. Next you will meet the tools real servers are built on, in "The ox stack: ox_lib, ox_target, ox_inventory", where these natives get wrapped into ready-made building blocks you call by name.