Coordinates are everywhere in FiveM scripting — spawns, markers, blips, job points, teleports and distance checks. Getting them and working with them efficiently saves a lot of time. This guide covers how to get and use coordinates (vector3) in FiveM.
Getting your current coordinates
The quickest way in-game is to print your position:
local coords = GetEntityCoords(PlayerPedId())
print(coords.x, coords.y, coords.z)
-- heading:
print(GetEntityHeading(PlayerPedId()))
Many servers add a /coords command that copies this to your clipboard for placing props, blips and markers.
vector3 and vector4
FiveM uses vector3(x, y, z) for positions and vector4(x, y, z, w) when you also need a heading (w). Natives like SetEntityCoords, AddBlipForCoord and CreateObject take these. You can index them with .x, .y, .z or do vector maths directly (e.g. #(coordsA - coordsB) for distance).
Distance and heading
Common needs: the distance between a player and a point (for an interaction range), and the heading to face from one point to another (for spawns). You can compute these with vector subtraction and atan2, or skip the maths entirely with our free Vector3 / coordinates tool — paste two coordinates and get the 3D/2D distance, heading and midpoint, plus conversion between vector3, vector4, Lua table, JSON and C# formats.
Converting formats
Coordinates show up in many formats — a raw x, y, z from a map editor, a Lua table from a config, JSON from an API. The Vector3 tool auto-detects any format you paste and outputs all of them, ready to drop into your script.
Frequently asked questions
How do I get my coordinates in FiveM?
Use GetEntityCoords(PlayerPedId()) and print x, y, z (and GetEntityHeading for the facing). Many servers bind this to a /coords command.
What’s the difference between vector3 and vector4 in FiveM?
vector3 is a position (x, y, z); vector4 adds a heading (w). Use vector4 when you need the entity to face a direction, like a spawn point.
How do I get the distance between two coordinates?
Subtract the vectors and take the magnitude (#(a - b)), or use our Vector3 tool to compute 3D/2D distance instantly.
Ready to play?
Run your own FiveM server with XGamingServer
Spin up an always-on FiveM server your friends can join in minutes — no port-forwarding, no tech headaches.



