Should I be using NetworkOwnership? If so, how?

So I see a lot of people talking about NetworkOwnership. And I am wondering if I should use it?

Here are my questions,

  • Should I use it?
  • If so how?
  • Any scenarios where I should not use it?
  • scenarios when I should use it?
  • Other?

Cool thanks!
~Froyo~

Generally you’d use it in two scenarios, because of the default behavior.

Scenario 1: Explicit player physics ownership

When a player needs to have full control over the physics of an object you would want to grant them physics ownership.

Scenario 2: Explicit server physics ownership

When you have an object that is exploitable, such as a falling meteor, you might want to make sure that no players own this object’s physics, since they could potentially take control of the meteor with an exploit and use it to kill other players.

The other case is where you want to avoid visible hitching as a player gets near the physics actor. A really common case is for Humanoid NPCs. By explicitly forcing server ownership it ensures that the Humanoid events and functions act in a timely manner, if the physics ownership were auto you would see delays in the behaviors in most cases.

Default behavior

The default network ownership is Auto this means that the server owns the physics when no players are near enough to it. This can cause visible hitching as players approach an object but it tends to be a more performant solution in some cases.

network ownership is mainly used to give a player control over something within the server, e.g if a player sits in a car you would want it to replicate to the server. Aside from that its used in some building systems or to manipulate other players characters.

1 Like

So basically if there is a physics based object that the player would control, I would give them Network ownership?

Otherwise give it to the server.

Also is the players character automatically set its ownership to the player? Or do I have to do it manually.

Also how do I set the ownership?

So basically if there is a physics based object that the player would control, I would give them Network ownership?

Correct, if you were making a gravity gun, for example, you would want to give the client NetworkOwnership of the assembly that they were grabbing, assuming they should be able to move it.

Otherwise give it to the server.

As a general rule, perhaps. It does take some discretion depending on the situation but this is the safest option.

Also is the players character automatically set its ownership to the player? Or do I have to do it manually.

This is correct, it is automatically owned by the player.

Also how do I set the ownership?

Part:SetNetworkOwner(Player | nil) See SetNetworkOwner
If you specify a player, then the player owns the physics. If you specify nil then the server owns the physics.

See also: SetNetworkOwnershipAuto()

1 Like

Cool! That answers all of my questions! This will decently help!
I didn’t even know this existed till today so cool!

Thanks!

~Froyo~

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.