How can I create knockback?

As you can see by the title how do I create knockback in my game?

Should I use forces? Or something else? Thanks!

There are many ways to do it. I like using Bodyvelocity but it’s up to you.

character:ApplyForce(knockbackDirection * knockbackForce)

I’m not sure if that will work because iirc players have network ownership of their characters. But I could be wrong though.

I was actually working on this type of script for my game. There’s several ways to do this but if you’re looking for instantaneous physics based knockback, you can use either Hit:ApplyImpulse((Hit.Position - Source.Position).Unit * Power) or Hit.AssemblyLinearVelocity = (Hit.Position - Source.Position).Unit * Power), but the latter needs to be reset back to its default velocity or moved with humanoid. Either option is doable.

1 Like

Finally found this, had it buried a bit deep.

local db = true
script.Parent.Touched:Connect(function(hit)
	local Hit_Character = hit.Parent:FindFirstChild("Humanoid").Parent or hit.Parent.Parent:FindFirstChild("Humanoid").Parent
	if db then db = false
		local bv = Instance.new("BodyVelocity")
		local offset = Vector3.new()
		bv.Parent = (Hit_Character.LowerTorso)
		bv.MaxForce = Vector3.new(100000,100000,100000) -- can mess with this or the 80's
		bv.Velocity = (Hit_Character.Head.CFrame.LookVector * -80)
			+ (Hit_Character.Head.CFrame.UpVector * 80)
		wait(0.01) bv:Destroy() db = true
	end	task.wait(0.33)
end)
1 Like