01
What OneSync does
Without OneSync, the FiveM server mostly acts as a relay: the players' games exchange the state of the world between themselves, much like GTA V's online mode. This way of working stops at 32 players.
With OneSync, the server knows the state of the world: player positions, vehicles, NPCs and synchronised objects (the "entities"). In practice:
- the server can host more than 32 players;
- each player only receives what is happening around them: distant players and vehicles are not sent to them, which lightens traffic;
- server-side scripts can read a player's position, create vehicles or NPCs, and share data attached to an entity;
- the server can restrict which entities players are allowed to create (see below).
The trade-off: the server does more work. A processor with fast cores matters more with many players (see optimising a FiveM server).
02
Enabling OneSync
In server.cfg, add this line at the top of the file, before the ensure lines:
set onesync on
The onesync variable accepts three values: on (the current mode, the one to use), legacy (an older mode, kept for old servers) and off. The onesync_enabled or onesync_enableInfinity lines come from old tutorials: replace them with set onesync on. The rest of the file is explained in the guide FiveM server.cfg.
With txAdmin, the OneSync setting is in txAdmin's server (FXServer) settings, which pass it at launch. Pick a single place: if OneSync is set in txAdmin, do not write a different value in server.cfg, so you do not end up with two conflicting settings. The guide txAdmin covers its other settings.
Either way, OneSync is read at startup: it takes a full server restart, not just a resource restart.
03
Player count and Element Club key
The number of slots is set with sv_maxclients. Two limits stack on top of each other:
- without OneSync, no more than 32 players;
- with OneSync and a licence key without a subscription, up to 48 players;
- above 48, you need a key linked to a Cfx.re Element Club subscription, on Patreon. The number of slots allowed then depends on the subscription chosen.
set onesync on
sv_maxclients 48
The key is set with sv_licenseKey: creating it and the 48-player limit are explained in the guide FiveM licence key. More slots does not mean more players: set a number your server and your scripts can really handle.
04
What changes for scripts
Many recent resources, including the ESX, QBCore and Qbox frameworks, rely on OneSync. A resource can require it in its fxmanifest.lua with the '/onesync' dependency: it then refuses to start if OneSync is disabled. What to know when writing or installing a script:
- The client only sees what is nearby. Client-side,
GetActivePlayers() only returns players in range, and a distant entity does not exist for it. Old for i = 0, 31 loops no longer work. For the list of all players or the position of a distant player, ask the server: GetPlayers() and GetEntityCoords(GetPlayerPed(source)) server-side.
- Entities can be created server-side.
CreateVehicle, CreatePed or CreateObject can be called from a server script: more reliable for a garage or a dealership than creation by a client.
- State bags attach data to an entity or a player, synchronised automatically:
Entity(vehicule).state, Player(source).state and GlobalState for values shared across the whole server. Recent frameworks use them a lot.
- Routing buckets split players into separate worlds (
SetPlayerRoutingBucket): a private interior, character creation, an activity instance.
- Population (NPCs and traffic) is handled by the games of nearby players. The
onesync_population variable turns it off entirely (set onesync_population false).
sv_entityLockdown (strict or relaxed) restricts the entities clients can create, which hinders cheat menus. strict mode breaks scripts that create entities client-side: try it on a test server first.
Before adding an older resource, read its page: the method is in the guide installing a FiveM script.
05
Common errors
- More than 32 slots without OneSync:
sv_maxclients above 32 does not work while OneSync is disabled.
- More than 48 slots with a key without a subscription: the key does not allow it; you need a key linked to an Element Club subscription.
- A resource refuses to start asking for OneSync: its manifest declares
'/onesync'. Enable OneSync and restart the server.
- The setting changes nothing: the server was not fully restarted, or txAdmin forces a different value from the one in
server.cfg.
- Player blips that disappear, vehicles that cannot be found at a distance: this is OneSync's normal behaviour, only sending the client what is nearby. The script has to ask the server for positions.
- Vehicles that disappear when no player is nearby any more: a vehicle created by a client can be deleted once nobody owns it. For a vehicle that must stay, create it server-side.
For other console messages, see the guide FiveM server errors.
06
On CloudFive
On a FiveM hosting plan, txAdmin comes pre-installed and ESX, QBCore or Qbox install in one click with their MariaDB database. A shared Patreon key is provided at no extra cost, limited to 48 players: beyond that, get your own Element Club subscription on the Cfx.re portal and put your key in the server's startup settings. The servers run in France on a Ryzen 9 9950X with DDR5 and NVMe, and Anti-DDoS Premium is included with a FiveM-specific profile.
07
Frequently asked questions
What is OneSync on FiveM?
It is the mode in which the FiveM server itself synchronises the world: players, vehicles, NPCs and objects. It allows more than 32 players and gives server scripts tools such as state bags and routing buckets.
How do I enable OneSync?
Add set onesync on at the top of server.cfg, or choose OneSync in txAdmin's server settings, but not in both places with different values. Then fully restart the server.
Do I need OneSync for more than 32 players?
Yes. Without OneSync, a FiveM server is limited to 32 players. With OneSync and a key without a subscription, it goes up to 48; beyond that, you need a key linked to a Cfx.re Element Club subscription.
Why can my script no longer see distant players with OneSync?
With OneSync, the client only receives the players and entities near it. For the list of all players or a distant position, the script has to ask the server, using GetPlayers and GetEntityCoords server-side.
Is OneSync available on CloudFive FiveM servers?
Yes, OneSync is enabled in server.cfg or in txAdmin, which comes pre-installed. The Patreon key provided at no extra cost is limited to 48 players; beyond that, you need your own Element Club subscription.