Ciao,
I’ve been trying to make a pathfinding that follows the player, but it crashes into it.
Is there any way to make it possible for the dummy to stop a few cm before?
Code:
local PathfindingService = game:GetService("PathfindingService")
local RunService = game:GetService("RunService")
local path = PathfindingService:CreatePath()
path:ComputeAsync(Dummy.PrimaryPart.Position, Target)
local waypoints = path:GetWaypoints()
for i = 1,#waypoints do
humanoid:MoveTo(waypoints[i].Position)
humanoid.MoveToFinished:Wait()
end
You would calculate distance between player and the NPC as how @zamont124 did.
After you have calculated distance you should check if it’s less than closer distance.