Body Velocity does not work on client

Hi, I am trying to make a ball that you can move around with the arrows. I am using body velocity to move the ball, but I have found some unexpected behavior. When I change the body velocity on the server, the ball moves with no problem. Here is what it looks like. -https://gyazo.com/3b69e4039c0731380e62c66ce6b4dafa

Unforunately, when I change it via a local script I experience some odd behavior. Most of the time the ball will not move at all, while other times it will move a little and then stop.
https://gyazo.com/016f17d80185146c321ac5b84b5c5db0
https://gyazo.com/1524ef9a58876c5f7891501ca1e1c6a7

Here is the code:

local UserInputService = game:GetService("UserInputService")

local myBall = game.Workspace.Ball

UserInputService.InputBegan:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.W then
		myBall.BodyVelocity.Velocity = Vector3.new(1000,0,0)
	end
end)

I don’t want to have to fire a lot of remote events and handle it all on the server, so what can I do to fix this?

Well, I suppose you would have to set the network ownership of the part to the player via a server script to have full control of its physics. Simply do game.Workspace.Ball:SetNetworkOwner(player) . You would obviously get the player parameter from a playeradded function, in case you were wondering…

1 Like