Problem with blocking system

Hello, im trying to make a simple sword combat system for fun, but im running into a few problems, one of the being the blocking system. Im not entirely sure if im calculating the lookvector wrongly or something, but my blocking system is just not working what so ever. here is the server side script that handles the blocking

-- Handle blocking and parry
				if enemyPlayer and blockingPlayers[enemyPlayer] then
					local currentTime = tick()
					local lastAttackTime = lastAttackTimes[player] or 0

					-- Calculate the dot product to check if players are facing each other
					local facingDirection = (enemyRootPart.CFrame.LookVector):Dot((playerRootPart.Position - enemyRootPart.Position).Unit)
					if facingDirection >= FACING_THRESHOLD then
						-- Check if the block is within the parry window
						if currentTime - lastAttackTime <= PARRY_WINDOW then
							-- Parry: Stun the attacker
							BlockRemote:FireClient(player, "Stun") -- Notify the attacker to play stun effects
							return -- Skip further damage and effects
						else
							-- Block: No damage, but no parry
							return
						end
					else
						-- Attacker is not in front, block is invalid
						BlockRemote:FireClient(enemyPlayer, "DeactivateBlock") -- Notify blocker to stop blocking
					end
				end

LocalScript blocking remove connector

BlockRemote.OnClientEvent:Connect(function(action)
	if action == "Stun" then
		Stun()
	elseif action == "DeactivateBlock" then
		StopBlocking() -- Deactivate block when attacked from behind
	end
end)

https://gyazo.com/f8df078efb2ffd4932d34bb55d2472f7

if anyone knows what is going on that i’ve coded wrong can i get some help please.

You can simplify this to:

local facingDirection = enemyRootPart.CFrame.LookVector:Dot(playerRootPart.CFrame.LookVector)

If facingDirection is equal to -1, it means that the enemy and the player are facing each other, and if it’s equal to 1, it means that they’re looking towards the same direction