Why is BodyVelocity not applying any force on the character?

Hello! I’m making a pan game where if you hit a player, they get knocked back, previously I used BodyForce / BodyThrust (not sure which one I used, but they both work), but they don’t behave the way I want them to, so I decided to use BodyVelocity, which does.

But now, when the BodyVelocity gets parented to the RootPart, it does nothing, no knock back or anything. Which is confusing me, because the other body movers do work.

Here is my code:

local hitForce = Instance.new("BodyVelocity")
hitForce.MaxForce = Vector3.new(400000, 400000, 400000)
hitForce.P = 2000
hitForce.Velocity = (character.HumanoidRootPart.CFrame.lookVector * Vector3.new(0, 0.2, 0)) * 100
hitForce.Parent = character.PrimaryPart

Debris:AddItem(hitForce, 0.05)	

Please help!

2 Likes

If you made the BodyVelocity from the Server then it will get deleted before it actually knocks the player back, try using a higher delay when adding the BodyVelocity to debris.

I have already tried that, up to 0.5 seconds.

1 Like

put the bodyvelocity parent in the torso

1 Like

I’ll try that, it might work, because that did fix some problems in the past.

1 Like

Nope it didn’t fix it. Not sure what’s wrong.

1 Like

Try it in the HumanoidRootPart, and maybe try to print out the velocities so you know if its actually doing anything

It’s not working because you’re multiplying the LookVector’s X and Z components by 0.
In this line you’re multiplying zero by 100 and wondering why the dash doesn’t work.
Also the lifetime of the dash when you use Debris should ideally be around 0.1 to 0.2

hitForce.Velocity = (character.HumanoidRootPart.CFrame.lookVector * Vector3.new(0, 0.2, 0)) * 100

Change it to:

hitForce.Velocity = (Character.HumanoidRootPart.CFrame.lookVector) * 100
1 Like

Oh my, how did I not notice this! Thank you so much!

2 Likes

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