Stop Npcs MoveTo when they get near you

Hello, i’m using :MoveTo for my npc, and the problem is that they will climb the player when they get too near. My question is how to make it so the npcs just stay there when they get near the player?

You can do something like this:

local StopDistance = 5
local DistanceFromPlayer = (NPCHumanoidRootPart.Position - PlayerHumanoidRootPart.Position).Magnitude

if DistanceFromPlayer  > 5 then --FarFromPlayer
   NPCHumanoid:MoveTo(PlayerHumanoidRootPart.Position)
else --NearPlayer
      NPCHumanoid:Move(Vector3.new()) 
--Stay at the position then you can make the npc do some action like attack player 
end