OneSync fundamentals and entity ownership
A routing bucket is a separate world on the same server. Assign a player or entity to a bucket and they only see players and entities in that same bucket. Use them for sessions and game modes, not for interiors. This lesson builds a small instance and proves the partition with two players.
Build it
Make the resource folder
Inside your server's resources folder, create this folder:
resources/qu_network_onesync
Create the files
Create this exact file layout:
resources/qu_network_onesync/
fxmanifest.lua
server.lua
Write fxmanifest.lua
Open fxmanifest.lua and paste this:
fx_version 'cerulean'
game 'gta5'
server_script 'server.lua'
Older tutorials add a lua54 'yes' line here. As of June 2025 that setting is deprecated and ignored: Lua 5.4 is the only Lua runtime now, so you leave it out.
Write the lesson code
Open server.lua and paste this:
-- Move yourself into a heist instance (its own routing bucket).
RegisterCommand('heist', function(src)
local bucket = 10
-- 1. Make this bucket a clean, locked-down instance.
SetRoutingBucketPopulationEnabled(bucket, false)
SetRoutingBucketEntityLockdownMode(bucket, 'strict')
-- 2. Move the player into it. They now share a world only with
-- other players in bucket 10.
SetPlayerRoutingBucket(src, bucket)
print(('[qu_network_onesync] moved %s (id %s) into heist bucket %d'):format(GetPlayerName(src), src, bucket))
end, false)
-- Send yourself back to the shared world (bucket 0).
RegisterCommand('leaveheist', function(src)
SetPlayerRoutingBucket(src, 0)
print(('[qu_network_onesync] returned %s (id %s) to bucket 0'):format(GetPlayerName(src), src))
end, false)
-- Read which bucket a player is currently in.
RegisterCommand('mybucket', function(src)
print(('[qu_network_onesync] %s is in bucket %d'):format(GetPlayerName(src), GetPlayerRoutingBucket(src)))
end, false)
Start and test it
Open server.cfg and add this line:
ensure qu_network_onesync
Save server.cfg. Then type this into the server console (the txAdmin Live Console, or the black FXServer console window if you run it directly), not PowerShell and not the in-game chat:
restart qu_network_onesync
Join the server. In the in-game chat (press T) type /heist, press Enter, then /mybucket. (In the F8 console you would type the same commands without the leading slash.) The printed lines appear in the server console, not on your screen:
Alex and id 3 are illustrative: you will see your own in-game name and the server id you were assigned on join. The lines that must match exactly are the [qu_network_onesync] prefix and bucket 10.
Prove the invisibility
A bucket number printing is not proof of anything. The whole point of this feature is that players in different buckets cannot see each other. So test that directly.
Get two players on the server (a friend, or a second FiveM client on another machine). Have both stand next to each other so you can see each other's character. Then on player one only, run:
/heist
Player one is now in bucket 10. Player two is still in bucket 0. Watch what happens: player one's character vanishes from player two's screen, and player two vanishes from player one's. You are standing on identical coordinates and you cannot see each other. Run /leaveheist on player one and you reappear to each other instantly. That disappearance is the routing bucket doing its only job.
Keep reading the full lesson
Sign in to start, then unlock every step of this lesson and the full FiveM School with a membership.
- How it works
- If something went wrong
- What you can do now
- Try it yourself
The remainder of OneSync fundamentals and entity ownership is available to FiveM School members.