Consistent knockback? (Player gets launched further if they're jumping)

I believe this has something to do with friction, regardless, I’ve noticed that with my knockback system, if a player gets hit while jumping, their knockback distance will be significantly increased, this can break combos and just create an unfair advantage / method of breaking the combo. I was using BodyVelocity for this and creating the correct direction and applying that as the velocity amount.

Angle = ((VictimHRP.Position - ConvictHRP.Position) * Vector3.new(10,0,10)).Unit * 50 + Vector3.new(0,20,0)
Velocity.MaxForce = Vector3.new(10000000,10000000,1000000)

Velocity.Velocity = Angle

Any suggestions on how to combat this without ruining combat fluidity?

1 Like

I don’t touch on physics often but something as simple as using Humanoid.FloorMaterial and applying a different amount of force depending if they are in the air or not may work.

1 Like

Unfortunately this won’t work as distance from the ground can change how far they’ll go

Just use BodyPosition and move them an exact increment. BodyPosition don’t care about friction, only cares about BodyForce.P and BodyForce.D. Look at the embeded link and mess around with it, if you are stuck with anything just reply again.

2 Likes

Seems to work, appreciate that!

The final code for anyone who needs it:

	local UnitDirection = (CharacterObj.HumanoidRootPart.Position - Source.HumanoidRootPart.Position).Unit -- Getting the direction relative to the player who hit them
	local BP = Instance.new("BodyPosition")
	BP.Parent = CharacterObj.HumanoidRootPart
	BP.Position = CharacterObj.HumanoidRootPart.Position + UnitDirection * 5 -- 5 is the power of the hit, the higher the further they go
	BP.D = 500 -- Dampening, the higher this is the smoother the hit will be (and the longer it'll take to get there)
	BP.MaxForce = Vector3.new(math.huge, math.huge, math.huge) -- Force, set to math.huge for ease
	Debris:AddItem(BP, 0.5)

Edit:

It might be worth creating a new Vector3 with the UnitDirection’s X and Z coordinates, as well as removing the Y since there can be some cases where the player can get knocked far into the air.