Hi there, I have a dummy with pathfindingservice, but the issue is, is that the dummy keeps moving back and forth while following me. I’ve heard that checking the magnitude can help, but do not exactly know how. How do I fix the dummy from moving back and fourth?
game:GetService('RunService').Heartbeat:Connect(function()
local goal = workspace:WaitForChild("vxsqi").Head.Position
local path = PathfindingService:CreatePath()
path:ComputeAsync(Root.Position, goal)
local waypoints = path:GetWaypoints()
for i, waypoint in ipairs(waypoints) do
Humanoid:MoveTo(waypoint.Position)
if waypoint.Action == Enum.PathWaypointAction.Jump then
Humanoid.Jump = true
end
Humanoid.MoveToFinished:Wait()
end
end)