Ability Teleportation and weld help

Hiya devs, running into a few issues here. in the video youll see that, when i use the ability on a player , it seems to switch to behind me.
However when i do it on an npc it seems to be fine and work as intended.

local rayDirection = root.CFrame.LookVector * 40 -- Raycast direction and distance (40 studs)
		local rayOrigin = root.Position
		local raycastParams = RaycastParams.new()
		raycastParams.FilterDescendantsInstances = {character,workspace.DebrisFolder,workspace.Characters}
		raycastParams.FilterType = Enum.RaycastFilterType.Exclude

		local raycastResult = workspace:Raycast(rayOrigin, rayDirection, raycastParams)
		
		local _, yRotation, _ = root.CFrame:ToOrientation()
		
		local bp = Instance.new("BodyPosition")
		bp.Name = "UppercutPos"
		bp.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
		
		if raycastResult then
			-- Teleport to the hit position while keeping the original Y-axis rotation
			local targetPosition = raycastResult.Position + Vector3.new(0, root.Size.Y / 2, 0)
			root.CFrame = CFrame.new(targetPosition) * CFrame.Angles(0, yRotation, 0)
			bp.Position =  CFrame.new(targetPosition)
			bp.Parent = root
			game.Debris:AddItem(bp,.5)

		else
			bp.Position = root.CFrame * Vector3.new(0,0,-55)
			bp.Parent = root
			game.Debris:AddItem(bp,.5)
			local newPosition = rayOrigin + rayDirection
			root.CFrame = CFrame.new(newPosition) * CFrame.Angles(0, yRotation, 0)

		end


	removeBodyVelocities(target)
			target.Humanoid.AutoRotate = false
			if character:FindFirstChild("IsGrabbing") then
				target.Humanoid:TakeDamage(properties.damage *1.1)

				local DodgeVel = Instance.new("BodyVelocity")
				DodgeVel.MaxForce = Vector3.new(50000, 50000, 50000)
				DodgeVel.Velocity = character.HumanoidRootPart.CFrame.LookVector * 80 + Vector3.new(0,50,0)
				DodgeVel.Name = "MoveForward"
				DodgeVel.Parent = target.HumanoidRootPart
				game.Debris:AddItem(DodgeVel,.1)
				
				local knocked = Instance.new("Accessory")
				knocked.Name = "Knocked"
				knocked.Parent = target
				Ragdoll:RagdollTimed(target,1.75)
				game.Debris:AddItem(knocked,1.75)
				
			
			return end
			target.HumanoidRootPart.Anchored = false
			target.HumanoidRootPart.CFrame = character.HumanoidRootPart.CFrame * CFrame.new(0,0,-4)
			
			if target:FindFirstChild("Blocking") then
				properties.damage = properties.damage / 2
			end
			
			local anim = target.Humanoid:LoadAnimation(game.ReplicatedStorage.Animations.PrimalTarget)
			anim:Play()
			print("RYHDFRHTGDFHGDFHD")
			
			
			local weld = Instance.new("Weld", character.HumanoidRootPart)
			weld.Part0 = character.HumanoidRootPart
			weld.Part1 = target.HumanoidRootPart
			weld.C1 = CFrame.new(0,0,-3.5) * CFrame.Angles(math.rad(0),math.rad(180),0)
			target.Humanoid:TakeDamage(properties.damage)

Id like to note that, sometimes it doesnt do it. it leaves me completely baffled

I notice that the attack where you move backwards, the attack fires backwards, but the attack where you punch forwards, the attack fires forwards as expected. Can you confirm this?