LinearVelocity not replicating to client

I used BasePart:SetNetworkOwner(nil) to make the server the network owner of a basepart, in this case a blue cylinder, and move it via the server.
The issue here is that the change in position from LinearVelocity does not replicate to client, it’s interactions with other physics parts behave normally, even though it doesn’t appear to move at all from the clients perspective.

This happens 100% of the time.

Video proof:

Roblox place where the bug is observable (The cylinder moves along with the player)

If I am missing any information please let me know, thank you.

We’ve filed a ticket to our internal database, and we’ll follow up when we have an update!

Thanks for the report!

@boyparis Could you provide steps to repro the observed error in the referenced experience?

I believe these steps reproduce the bug:

1.- Make a part with a LinearVelocity and attachmentDescendants.
2.- Parent the part to replicatedStorage.
3.-Place the following script in ServerScriptService

local PlayerInfo = require(game.ReplicatedStorage.Entity.PlayerEntity)

function get_available_character()
	local char = game.ReplicatedStorage.AvailablePlayers:FindFirstChildWhichIsA("Part")
	char.Parent = workspace
	return char
end


function on_player_join(Player)
	Player.CharacterAdded:Wait()
	local part = PlayerInfo.new(Player , get_available_character())

	local function update_char_move_direction(dir)
		part:change_move_direction(Player.Character.Humanoid.MoveDirection)
	end

	Player.Character.Humanoid:GetPropertyChangedSignal("MoveDirection"):Connect(update_char_move_direction)

	part.Model:SetNetworkOwner(nil)
end

game.Players.PlayerAdded:Connect(on_player_join)

4.- Place the following script in ReplicatedStorage

local Entity = {}
Entity.__index = Entity

function Entity.new(model : Model)
	local self = setmetatable({} , Entity)
	
	self.Model = model
	self.PrimaryPart = model.PrimaryPart
	self.speed = 30
	
	return self
end

function Entity:change_move_direction(direction : Vector3)

	if self.enabled then
		self.PrimaryPart.LinearVelocity.VectorVelocity = direction * self.speed
	else
		self.PrimaryPart.LinearVelocity.VectorVelocity = Vector3.zero
	end
end


return Entity

5.-Add this script as a Child of the Entity module in replicatedStorage and run the game

local Entity = require(script.Parent)
local CharacterController = {}

CharacterController.__index = CharacterController
setmetatable(CharacterController , Entity)

function CharacterController.new(player : Player , character : Model)
	local self = setmetatable(Entity.new(character) , CharacterController)
	
	self.Player = player
	self.PlayerCharacter = self:get_default_character()
	self.Grabbing = nil
	
	self.enabled = false
	self.immune = false
	
	
	
	return self
end

function CharacterController:get_default_character()
	
	if not self.Player.Character then
		self.Player.CharacterAdded:Wait()
	end
	
	return self.Player.Character
end




return CharacterController

This version of the ServerScriptService script fixes the bug, the only difference is that the model’s parent is set outside of the class constructor, which might be what causes the replication issue.

local PlayerInfo = require(game.ReplicatedStorage.Modules.Entity.PlayerEntity)

function get_available_character()
	local char = game.ReplicatedStorage.AvailablePlayers:FindFirstChildWhichIsA("Model")
	return char
end


function on_player_join(Player)
	local CharController = PlayerInfo.new(Player , get_available_character())

	local function update_char_move_direction(dir)
		CharController:change_move_direction(CharController.PlayerCharacter.Humanoid.MoveDirection)
	end

	CharController.PlayerCharacter.Humanoid:GetPropertyChangedSignal("MoveDirection"):Connect(update_char_move_direction)
	CharController.enabled = true
	CharController.Model.Parent = workspace
	CharController.Model.PrimaryPart:SetNetworkOwner(nil)

	game.ReplicatedStorage.Remote.LinkCamera:InvokeClient(Player , CharController.Model)
end

game.Players.PlayerAdded:Connect(on_player_join)

Thanks for this. I’ll update our internal ticket with the repro information.

1 Like

Hello,

I tried these reproduction steps and didn’t see the problem. I also attempted to make a more simplified reproduction with this:
LinearVelocityNotReplicating.rbxl (55.3 KB)
Are you still having this issue with the steps that you provided? If so, would you mind taking a look at my reproduction file to see if I’m missing some core element that is present for you. Thanks.

LinearVelocityReplicationBug

Closing this issue as “Can’t Reproduce”. Please feel free to reopen if the problem occurs again.