How to make vehicle local script replicate movements to server

How do I make all the movements of the vehicle that the local script controls replicate across all clients so other players see the vehicle moving as well?

You’ll have to give the player controlling the vehicle Network ownership of the vehicle for it to replicate across to the server. You can read about it here with some good examples.

1 Like

Hi, thanks for your reply. So I added in the network ownership code, however, when I switch between client and server mode during testing nothing has changed. On client the part drove away but on server mode it’s still in the same place. Do you know what I am doing wrong?

local seat = script.Parent
local _workspace = game:GetService("Workspace")
seat:GetPropertyChangedSignal("Occupant"):Connect(function()
	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
				up.Body.Anchored = false --because Body anchored and welded to seat
				seat:SetNetworkOwner(player)
				up.Body.Anchored = true
				print(player)
			end

Structure:
Screenshot 2022-01-03 at 13.53.21