Set network owner not replicating to other clients

I am setting the network ownership of my vehicle to the player, however, when I join the game with a second account the vehicles movements do not replicate to my other account. Only once I exit the vehicle and its final position is updated to the server via remote event, does it suddenly appear. How do I fix this?

local _workspace = game:GetService("Workspace")
local up = _workspace.Up
print(player)
up.Body.Anchored = false
seat:SetNetworkOwner(player)
up.Body.Anchored = true

Structure:
Screenshot 2022-01-15 at 22.36.21
Seat is welded to body and union also to body.

The problem might be that the player variable is nil, which causes SetNetworkOwner to set the owner to the server, not an intended player.

Could you show how you get/set the player variable?

Sure. I also printed the player and it printed my name.

if _workspace.Up.VehicleSeat.Occupant ~= nil then
 local humanoid = seat.Occupant
		 if humanoid then
			 local player = game:GetService("Players"):GetPlayerFromCharacter(humanoid.Parent)
              if player then
				 print(player)
				 up.Body.Anchored = false
				 seat:SetNetworkOwner(player)
				 up.Body.Anchored = true
				print(player)
			 end
end
1 Like

Huh, weird. Maybe it has something to do with anchoring the assembly? I’m not sure.

1 Like

Ah, yeah, you’re right. Client2 can see me once I removed the .Anchored = true. Can’t properly fly the vehicle now though lol. Just keeps falling on the ground

Yeah, only the movement of unanchored parts will replicate (so as long as they aren’t welded to any anchored parts), if you need the vehicle to fly use a BodyForce instance.