Make NPC run away from player

I’ve already created an AI script for an NPC, and I want them to run away from the character to them if they can fear (boolean) and if they are under half health. I don’t want them to run towards the player, but rather where the person is facing (opposite direction of where the NPC is facing, as they are naturally facing eachother.) How would I get the direction the NPC would need to go? Any help is appreciated

You can subtract the player’s position from the NPC’s position like this:

local directionAwayFromPlayer = (NPC.PrimaryPart.Position - player.PrimaryPart.Position).Unit
local directionTowardPlayer = (player.PrimaryPart.Position - NPC.PrimaryPart.Position).Unit