Network Ownership

In order to support complex physical mechanisms while also aiming for a smooth and responsive experience for players, the Roblox physics engine utilizes a distributed physics system in which computations are distributed between the server and all connected clients. Within this system, the engine assigns network ownership of physically simulated BaseParts to either a client or server to divide the work of calculating physics.

Clients experience more responsive physics interactions with parts that they own, since there's no latency from communication with the server. Network ownership also improves server performance because physics computations can be split up among individual clients, allowing the server to prioritize other tasks.

Visualizing Ownership

To assist with network ownership debugging, Studio can render colored outlines around objects when playtesting.

Part ownership indicated through colored outlines

To enable ownership visualization:

  1. Open FileStudio Settings.

  2. In the Physics tab, enable Are Owners Shown.

    Studio Settings window showing Are Owners Shown option

BasePart Ownership

By default, the server retains ownership of any BasePart. Additionally, the server always owns anchored BaseParts and you cannot manually change their ownership.

Based on a client's hardware capacity and the player's Player.Character proximity to an unanchored BasePart, the engine automatically assigns ownership of that part to the client. Thus, parts close to a player's character are more likely to become player-owned.

Assembly Ownership

If a physics-based mechanism has no anchored parts, setting ownership on an assembly within that mechanism sets the same ownership for every assembly in the mechanism.

If you anchor a lone assembly that is not part of a broader mechanism, its ownership goes to the server, since the server always owns anchored BaseParts. Upon unanchoring the same assembly, its previous ownership state is lost and it reverts to automatic handling by the engine.

If you anchor one assembly within a broader mechanism of assemblies, its ownership goes to the server, but ownership of the other assemblies remains unchanged. Unanchoring the same assembly reverts its previously set ownership.

Setting Ownership

In experiences with complex physics interactions or in cases where you need to assign direct control, you can set ownership through a server-side call to BasePart:SetNetworkOwner().

Consider a vehicle that has a VehicleSeat object for the driver and a Seat object for a passenger, with both included in the vehicle assembly. With the default ownership rules, if a player character sits in the Seat (passenger) and then another player jumps into the VehicleSeat (driver), the passenger gains physical ownership of the entire vehicle because they entered first. The driver will have to wait several network cycles before their input is recognized and the vehicle will feel less responsive.

The following Script fixes this by manually assigning network ownership to the driver. In it, the VehicleSeat sets its Occupant to the Humanoid sitting on it, so the script listens for the seat's Changed event to catch when a player sits in the seat. When the driver leaves the seat, the vehicle's network ownership is reverted to automatic with BasePart:SetNetworkOwnershipAuto().

local Players = game:GetService("Players")
local vehicleSeat = script.Parent
if prop == "Occupant" then
local humanoid = vehicleSeat.Occupant
if humanoid then
-- Get the player from the character
local player = Players:GetPlayerFromCharacter(humanoid.Parent)
if player then
-- Reset ownership when seat is unoccupied

Security Concerns

Roblox cannot verify physics calculations when a client has ownership over a BasePart. Clients can exploit this and send bad data to the server, such as teleporting the BasePart, making it go through walls or fly around.

Additionally, BasePart.Touched events are tied to network ownership, meaning that a client can fire Touched events on a BasePart it owns and send it to the server, even if the server doesn't see it touch anything. For example, a client can make a sword deal damage to another player across the map by firing the event through script injections, so it's important to check the validity of such events fired by clients.

See Security Tactics and Cheat Mitigation for detailed security tactics and cheat mitigation tactics for Roblox experiences.