Pathfinding not working

my pathfinding isn’t working

game.Players.PlayerAdded:Connect(function(plr)
local pathfindingservice = game:GetService("PathfindingService")

local human = script.Parent:WaitForChild("Humanoid")
local torso = script.Parent:WaitForChild("Torso")

local path = pathfindingservice:CreatePath()
	local char = plr.Character or plr.CharacterAdded:Wait()
	
	while true do
		wait()
		path:ComputeAsync(torso.Position, char:WaitForChild("HumanoidRootPart").Position)
	end
local waypoints = path:GetWaypoints()


for i, waypoints in pairs(waypoints) do
	if waypoints.Action == Enum.PathWaypointAction.Jump then
		human:ChangeState(Enum.HumanoidStateType.Jumping)
	end
	human:MoveTo(waypoints.Position)
	human.MoveToFinished:Wait(2)
	end
end)	

its supposed to run towards the player but it just stands there

Have a read of this recent article in the Resources category which will help you:

1 Like

This the wrong category for this topic the correct category for this topic is #help-and-feedback:scripting-support.