Body Velocity going sideways?

I’m trying to add a forward BodyVelocity on when a player is hit within my game, however it can sometimes move side to side even though it’s set to the characters lookvector.

Example: https://gyazo.com/64a2f8e18260f041a347122bf17f5dc9

			local bvel = Instance.new("BodyVelocity")
			bvel.MaxForce = Vector3.new(99999,99999,99999)
			bvel.Parent = player.Character.HumanoidRootPart
			bvel.Velocity = player.Character.PrimaryPart.CFrame.LookVector * 10
			bvel.Name = "Knockback"
			game.Debris:AddItem(bvel,.1)

			local bvel = Instance.new("BodyVelocity")
			bvel.MaxForce = Vector3.new(99999,99999,99999)
			bvel.Parent = Info.Enemy.HumanoidRootPart
			bvel.Velocity = player.Character.PrimaryPart.CFrame.LookVector * 10
			bvel.Name = "Knockback"
			game.Debris:AddItem(bvel,.1)

Body Velocity is deprecated and should not be used.
Try using linear velocity instead

This probably because on your Animation, The PrimaryPart of the Character is Rotating. Try using the HumanoidRootPart instead, The PrimaryPart of the Character is the Player’s Head for some reason

The bodies are colliding while you are fighting which causes you to push eachother. Instead use a CollisionGroup and put all Players under it and all Dummies, now if you attack eachother you wont be pushing eachoter while the force is playing.

Else I suggest to first apply it to the enemy than the player, I doubt this would work though.

I will try it out, thanks I’m guessing its just the same with attachments

1 Like

Is this a visual bug? because it says its humanoidrootpart for me.

Could just be me:
Screenshot (165)

Is there a way to use linear velocity to make an object stay still in place, because when I set the linearvelocity to the humanoidrootparts position it moves backwards?

I would try anchoring it maybe. I’m not entirely sure because I have yet to use LinearVelocity in an actual project. I’ve only used it to mess around so far.

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