AssemblyLinearVelocity Bug

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    In my soccer game I made a steal move. When you press e, you dash forward and tackle the player.

  2. What is the issue? Include screenshots / videos if possible!
    Right when the tackle is over, the screen shakes for a millisecond and jitters like I teleported

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    Reviewing code/searching online

player.Character:WaitForChild("HumanoidRootPart"):SetNetworkOwner(nil)

	player.Character:WaitForChild("HumanoidRootPart").AssemblyLinearVelocity = player.Character:WaitForChild("HumanoidRootPart").CFrame.lookVector * 400



	

	local touchedEvent = stealHitbox.Touched:Connect(function(hit)
		
		if hit.Parent:FindFirstChild("Ball") and hit.Parent:FindFirstChild("Humanoid") and hit.Parent.Name ~= player.Name and hit.Parent:FindFirstChild("HumanoidRootPart"):FindFirstChild("Ball") then
			if hit.Parent.Ball.CanSteal.Value == false then
				return
			end
			hit.Parent.HumanoidRootPart:WaitForChild("Ball"):Destroy()
			hit.Parent.Ball.PossessorName.Value = player.Name
			hit.Parent.Ball.InPossession.Value = true
			local motor6D = Instance.new("Motor6D")
			motor6D.Part0 = player.Character:WaitForChild("HumanoidRootPart")
			hit.Parent:FindFirstChild("Ball").Parent = player.Character
			motor6D.Part1 = player.Character:FindFirstChild("Ball")
			motor6D.Parent = player.Character.HumanoidRootPart
			motor6D.Name = "Ball"
	
		end
	end)
	task.wait(player.Character.StealCooldown.Value * 0.25)
	player.Character:WaitForChild("HumanoidRootPart"):SetNetworkOwner(player)

(part of code which makes it slide)

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

-- This is an example Lua code block

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

1 Like

This is because of the sudden change in network ownership, where the transfer in physics control causes a very brief jitter since client and server have very different physics states. Try removing the network owner lines

without the network owner lines, the assembly linear velocity change is ignored

Assuming this is a server script, you won’t be able to change the HumanoidRootPart’s (HRP) AssemblyLinearVelocity outside of the player’s network ownership – and you’re solving that by setting the HRP’s network owner to the server.

As you can see, that switch-up causes a noticeable jitter/lag. I’d recommend figuring out a way so that

player.Character:WaitForChild("HumanoidRootPart").AssemblyLinearVelocity = player.Character:WaitForChild("HumanoidRootPart").CFrame.lookVector * 400

runs on the client itself, rather than the server.

before moving it to the server, i had this line in the script and the player didnt move