function GoToPoint()
local torso = script.Parent.Parent.Parent.Torso.Position
local endpoint = script.Parent.Value
local hum = script.Parent.Parent.Parent.Humanoid
local path = game:GetService("PathfindingService"):FindPathAsync(torso,endpoint)
local points = path:GetWaypoints()
if path.Status == Enum.PathStatus.Success then
for i,v in pairs(points) do
hum:MoveTo(v.Position)
hum.MoveToFinished:wait()
if v.Action == Enum.PathWaypointAction.Jump then
hum.Jump = true
end
end
end
end
script.Parent.Changed:Connect(function()
if script.Parent.Value ~= Vector3.new(0,0,0) then
GoToPoint()
end
end)
this pathfinding script works very well except I noticed something annoying.
the NPC using this tended to constantly slow down and speed up making its movement look laggy. I didn’t realize its because with the pathfinding it slows down when it reaches a waypoint before going to the next. is there something I can do to make movement smoother? perhaps change how far apart waypoints are?
I tried your script and I didn’t see anything wrong, it seemed to go at a consistent speed. Could you provide a video of whats going on? Do you have a lot of other humanoids in your game? That could be why it seems laggy. Do you any other scripts that are taking a lot of computing power that could be slowing things down? Try looking at the Script Performance tab while your game is running and see how much each script is using
so I found a solution to the problem which would have not been considered should my game have been different. I lowered the mass of the NPC as well as remove all friction and this seemed to have fixed the stopping/moving. and because the game is space themed this behavior is desired. I also discovered that my method for FindPathAsync() is depreciated and I have corrected the problem by using FindPath(). what should I do at this point in terms of marking a solution?