LinearVelocity going left by itself

Hello, I am trying to make a combat system and am making it so the character steps forward after a swing, and the LV I am using just goes to the left randomly, and I dont know why. Here is a bit of the code and a video:

local lv = Instance.new("LinearVelocity", humrp)
lv.MaxForce = 10000
lv.Attachment0 = humrp.RootAttachment
lv.VelocityConstraintMode = Enum.VelocityConstraintMode.Line
lv.LineVelocity = 25

lv.LineDirection = humrp.CFrame.LookVector
wait(0.3)
lv:Destroy()

If anyone could help, I would be very grateful, thanks for any help in advance.

I am assuming that when you fire this linear velocity change, the animation is already playing, and actively changing the orientation (or lookvector) of your character’s HumanoidRootPart. Try firing this code before the animation plays, or wait until this code is fired to play the animation, or get the original orientation of the HumanoidRootPart before the animation plays and use that lookvector to fire this code.

Try changing the attachments world position like in this post: LinearVelocity applied force direction changes when tool that has a handle gets equipped.

That seems to have been the case, I moved the creation of the LV to the top of the script and enabled it later on and it seems to have done the trick. I thought that the RootPart never moves during an animation and its only the torso, but it seems otherwise. Thank you for your help.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.