How to make NPC stop a certain distance away

So I want to make my NPC stop a certain distance away without using magnitude. I want to use something like this:

humanoid:MoveTo(destination -- make it stop 1 stud away or something)
local distanceFromDestination = 1
local targetLocation = destination + (humanoid.Parent.PrimaryPart.Position - destination).Unit * distanceFromDestination
humanoid:MoveTo(targetLocation)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.