Knockback Doesn't Work Against Players But It Works Against Dummys

im trying to add knockback to my game but using a attack that causes knockback on a player doesn’t push them back, when i use a attack that causes knockback on a dummy it works fine.

(im using HumanoidRootPart:ApplyImpulse() )

Knockback Against Player

Knockback Against a Dummy

Sever Script:

local character = script.Parent.Parent
local Humanoid = character.Humanoid

local function OnTouched(HitBox)
	if HitBox.Name == "HitBox" and HitBox.HitTargetV.Value == false and HitBox.OwnerV.Value ~= character then
		HitBox.HitTargetV.Value = true
		HitBox.PassedThroughTarget.Value = character
		
		if HitBox.OwnerV.Value.HumanoidRootPart then
			local targetPart = HitBox.OwnerV.Value.HumanoidRootPart
			local head = character:FindFirstChild("HumanoidRootPart")

			local newPosition
			if targetPart.CFrame.lookVector.Y == 0 then
				newPosition = targetPart.Position + targetPart.CFrame.lookVector
			else
				newPosition = targetPart.Position + Vector3.new(targetPart.CFrame.lookVector.X, 0, targetPart.CFrame.lookVector.Z)
			end
			head.Position = newPosition

			local directionVector = head.Position - targetPart.Position
			directionVector = directionVector.Unit
			directionVector = directionVector * 3
			newPosition = head.Position + directionVector
			head.Position = newPosition

			local directionVector = targetPart.Position - head.Position
			directionVector = directionVector.Unit
			head.CFrame = CFrame.new(head.Position, head.Position + directionVector)

			if HitBox.Stuns.StunAnimation.AnimationId ~= "rbxassetid://0" then
				local StunAnimation = HitBox.Stuns.StunAnimation
				local AnimAnim = AnimationController:LoadAnimation(StunAnimation)
				AnimAnim:Play()
			end
		else
			local targetPart = HitBox.Parent.Root
			local head = character:FindFirstChild("HumanoidRootPart")

			local newPosition
			if targetPart.CFrame.lookVector.Y == 0 then
				newPosition = targetPart.Position + targetPart.CFrame.lookVector
			else
				newPosition = targetPart.Position + Vector3.new(targetPart.CFrame.lookVector.X, 0, targetPart.CFrame.lookVector.Z)
			end
			head.Position = newPosition

			local directionVector = head.Position - targetPart.Position
			directionVector = directionVector.Unit
			directionVector = directionVector * 3
			newPosition = head.Position + directionVector
			head.Position = newPosition

			local directionVector = targetPart.Position - head.Position
			directionVector = directionVector.Unit
			head.CFrame = CFrame.new(head.Position, head.Position + directionVector)

			if HitBox.Stuns.StunAnimation.AnimationId ~= "rbxassetid://0" then
				local StunAnimation = HitBox.Stuns.StunAnimation
				local AnimAnim = AnimationController:LoadAnimation(StunAnimation)
				AnimAnim:Play()
			end
		end

		if HitBox.Knockback.Value == true then
			local Distance = HitBox.Knockback.Force.Value
			local lookVector = character.HumanoidRootPart.CFrame.LookVector
			local force = -lookVector * Distance
			character.HumanoidRootPart:ApplyImpulse(force)
			if HitBox.Stuns.Value == true then
				Stunned.Value = true
				wait(HitBox.Stuns)
			end
		end
	end
end

character.Humanoid.Touched:Connect(OnTouched)

this script is applied to both the players and dummys

You can’t just add velocity to another client from client.
Deal with knockback in server

Also use Linear velocity instead of apply impulse

1 Like

its a sever script (i use events so i dont use local scripts so dex cant see everything) and ill see what i can do with linear velocity

Anyway you can’t apply impulse for characters in server script, use linear velocity

To add onto this for @lelz9111 the reason why is due to Network Ownership, one will need to add some waits, set humanoid to platform stand, setnetwork ownership to server in order for it to work.