✓ Accepted answer
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:-
local tmp = Instance.new('Part', workspace)
tmp.CFrame = CFrame.new(0, 20, 0)
tmp:SetNetworkOwner(nil)
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(charModel)
local part = Instance.new('Part', workspace)
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.
6 comments
Still returns nil when i use part:GetNetworkOwner()
It passes back nil or the player, nil is the server.
Yes, but I set the network -->part:SetNetworkOwner(plr)// then I print --> part:GetNetworkOwner()// and get nil
if you play in solo it will be nil, create a local server.
Nice, I already test, work good thanks
I just want to say thanks because I had the same problem 1 year later :)