I've been trying to use or understant the NetworkOwner, and I can't find information about it.
If I use:
local player = game.Players.Player1 SetNetworkOwner(player)
Does not throw an error, but then, when I use:
print(GetNetworkOwner())
always return nil. There is some other method like GetNetworkOwnershipAuto ( ) or SetNetworkOwnershipAuto ( ) that I just can't understant, is there anyone that know how this work? or how do I make work? or where to get more information about it?
Any help would be appreciated.
Firstly more information about Network ownership can be found here.
We are able to set who calculates/simulates the physics in roblox. By default the server will decide who simulates the physics ie the server or a player but only one will do the task and replicate the changes. When a player is close to a part in general the task of simulating the physics will be swapped to that player. This will mean that that player will have the most "up-to-date" physics.
Network ownership functions are available for all base parts ie parts that have physics. We can only set ownership of the parts from the server and cannot set the ownership of anchored parts as it has no physics to simulate.
Some examples:-
-- make a server part local tmp = Instance.new('Part', workspace) tmp.CFrame = CFrame.new(0, 20, 0) tmp:SetNetworkOwner(nil) -- nil is the server -- give a part to each player for them to simulate game.Players.PlayerAdded:Connect(function(plr) plr.CharacterAdded:Connect(function(charModel) local part = Instance.new('Part', workspace) -- the part must be in the game to have physics part.CFrame = CFrame.new(0, 20, 0) part:SetNetworkOwner(plr) end) end)
Side notes:-
You can check if you are able to set the network owner of a part by using CanSetNetworkOwnership
else the script will error for parts that have no physics to simulate such as anchored parts.
I hope this helps.