Knockback not working

Hey I have been trying to do a knockback system, where when a player clicks on another player, the target player is enflicted with knockback. I found some code on the devforum and modified and connected it to events. However the target won’t move and the output isn’t showing errors.

Here are the scripts:

--Local side
local mouse = game.Players.LocalPlayer:GetMouse()
local knockBackEvent = game.ReplicatedStorage.Events.KnockbackM

function getKnockback(hitPlayer)
	local dir = mouse.UnitRay.Direction
	knockBackEvent:FireServer(hitPlayer, dir)
end


mouse.Button1Down:Connect(function()
	local hit = mouse.Target
	if hit then
		if hit.Parent:FindFirstChildWhichIsA("Humanoid") then
			getKnockback(hit.Parent)
		end
	end
end)

-- Server side
local knockBackEvent = game.ReplicatedStorage.Events.KnockbackM
local TweenService = game:GetService("TweenService")

function doKnockback(player, hitPlayer, dir)
	local newCFrame = CFrame.new(hitPlayer.PrimaryPart.CFrame.Position)
	newCFrame *= CFrame.Angles(dir.X, dir.Y, dir.Z)
	newCFrame += newCFrame.LookVector * 20 --Arbitrary power amount

	--Tween the player to that position.
end

knockBackEvent.OnServerEvent:Connect(doKnockback)

I would use warn(“success”) after each bit in the code to troubleshoot

You didn’t perform the actual tween.

local newCFrame = CFrame.new(hitPlayer.PrimaryPart.CFrame.Position)
newCFrame *= CFrame.Angles(dir.X, dir.Y, dir.Z)
newCFrame += newCFrame.LookVector * 20 --Arbitrary power amount

-- Tween the player to that position.

You need to make the tween yourself as the code only sets the target CFrame and doesn’t do anything with this value.
Tweening is bad way of making a knockback thing though. I’d recommend you to use body movers for this.