My knockback is not smooth and does sometimes not even work at all?

Ok so I have been making a combat system recently and I tried to make the enemy receive knockback when getting hit by an arrow. The problem is that the knockback is not smooth at all and sometimes does not even work:

https://gyazo.com/d53be70ec60be96c4626cf210c759b9e

There is no error in the output and all the other things work perfectly fine.

When the arrow hits, the server sends an event to all clients where the effects and knockback happen. I thought having it on all clients should work smoothly for the knockback but it doesn’t ;(

I’ve been looking at some other posts here but they did not help me much.

local function BodyForce(Enemy, Velocity, hrp)
	local HRP = Enemy.HumanoidRootPart
	
	-- Enemy turns to the player when getting hit
	local gyro = Instance.new('BodyGyro')
		gyro.P = 5000
		gyro.D = 0
		gyro.MaxTorque = Vector3.new(math.huge ,math.huge ,math.huge )
		gyro.CFrame = CFrame.new(HRP.Position,hrp.Position)
		gyro.Parent = HRP
	game.Debris:AddItem(gyro, 0.25)
	
	-- Add BodyVelocity
	local BV = Instance.new("BodyVelocity")
		BV.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
		BV.P = math.huge
		BV.Velocity = Velocity
		BV.Parent = HRP
	
	game.Debris:AddItem(BV, .3)
end

I hope u guys could help me out here. If u need more info on how I did it feel free to ask!

1 Like

Having studied your video, it looks like the stop comes at the end of the animation. If you have a look, as soon as the animation stops, the character stops in mid air before continuing.

Perhaps you should look into making animations more versatile with movement.

Hope this helps,
-Tom :slight_smile: