Using routing buckets for instances
Routing buckets split one server into separate worlds: players and entities in bucket 5 never see bucket 0. They are how apartments feel private, how character creation hides you from the city, and how one server runs several PvP arenas at once.
Short answer: On the server, move players with SetPlayerRoutingBucket(src, bucket) and entities with SetEntityRoutingBucket(entity, bucket); read them with GetPlayerRoutingBucket / GetEntityRoutingBucket. Disable AI population in a bucket with SetRoutingBucketPopulationEnabled(bucket, false) and set its entity lockdown with SetRoutingBucketEntityLockdownMode. Bucket 0 is the normal world — always return players there when they leave.

#Moving players and entities
local function enterInstance(src, id)
local bucket = 1000 + id
SetRoutingBucketPopulationEnabled(bucket, false)
SetRoutingBucketEntityLockdownMode(bucket, 'strict')
SetPlayerRoutingBucket(src, bucket)
end
local function leaveInstance(src)
SetPlayerRoutingBucket(src, 0)
endEntities must be moved separately: a player who enters an instance in a car should have the car moved with SetEntityRoutingBucket too, or they arrive without it.
#Typical uses
| Use | Bucket plan |
|---|---|
| Character creation / multicharacter | One bucket per player while choosing |
| Apartments and houses | One bucket per property instance |
| PvP arenas | One bucket per match |
| Events | A dedicated bucket so the city is not affected |
#Gotchas
- Voice: whether players in different buckets hear each other depends on your voice resource — test it.
- Scripts that loop over “nearby players” on the client only see their own bucket — usually what you want.
- Server-created entities start in bucket 0 unless moved.
- Track who is in which bucket so a crash or disconnect does not leave data behind.
Buckets require OneSync — see OneSync explained. Server-side spawning: server-side entities.
Questions
What is a routing bucket in FiveM?
How do I put a player in an instance?
SetPlayerRoutingBucket(source, bucketId); return them with bucket 0.How do I stop traffic spawning in an instance?
SetRoutingBucketPopulationEnabled(bucketId, false).Why did my car not come with me into the instance?
SetEntityRoutingBucket.Ready to pick a map?
Twelve themes on three base map styles, $8 each, instant download.