Skip to main content
Bridge.Entities is the sanctioned way to spawn networked entities from a resource. It spawns server-side, tracks every entity in a registry, and automatically deletes a player’s entities when they disconnect. You get back a data-only view keyed by netId, which is what you use to reach the entity on clients. This is a server-only surface.

Why server-side spawning

A client-spawned networked entity is owned by the spawning client. That client controls its network state — it can teleport it, modify it, give it god mode, or delete it at will. It is one of the most exploited attack surfaces on FiveM. Spawning server-side makes the server authoritative over the entity’s creation and lifecycle. A client may request a spawn over Bridge.Net (validate the request first), but the server performs the spawn through Bridge.Entities.Spawn.
Never CreateVehicle / CreatePed / CreateObject from a client for anything other players interact with. Route the request to the server, validate it, and spawn with Bridge.Entities.Spawn.

Spawn

Spec fields

'vehicle' | 'ped' | 'object'
required
What to spawn. Invalid kinds return nil, 'bad_kind'.
string | number
required
Model name (hashed for you) or a precomputed hash.
vector4 | vector3 | table
required
Spawn position; the w component is the heading (defaults to 0 if omitted).
integer (player src)
If set, the entity is filed under this player and auto-deleted when they disconnect.
string
Free-form tag stored on the record and returned in the view.
table
Arbitrary data stored on the record and returned in the view.
string
Vehicle class for the server setter (default 'automobile'). Use e.g. 'bike', 'heli', 'boat' for other classes.
integer
Ped type for CreatePed (default 4).

Return — a data-only view

Spawn returns a view, not the raw entity handle. The raw handle stays server-side; consumers reach the entity through netId.

Track & retrieve

Despawn & cleanup

Cleanup is automatic for owned entities: when a player disconnects, every entity spawned with owner = src is despawned for you. You only call ReleaseOwner if you want to drop a player’s entities early (e.g. on a job change).
Auto-cleanup on disconnect runs regardless — ReleaseOwner is only for releasing early. An entity spawned without an owner is tracked but is never auto-deleted; despawn it yourself.

Protected statebags

Attach tamper-revert state to any networked entity. If a client edits the statebag, the bridge reverts it to your value — use it for server-authoritative entity data (fuel, lock state, ownership).

Attach props to a player

Attach (and later clear) decorative props on a player ped — handled server-side so every client sees them.

Request-then-spawn pattern

The full secure flow: client requests, server validates, server spawns, client gets the netId to use.

Networking

Validate and rate-limit the spawn request before you act on it.

World

Interaction prompts, zones, and blips for the entities you spawn.