A few questions about pathfinding

You could either do:

while task.wait() do
	-- CODE HERE
end

or

while true do
	-- CODE HERE
	task.wait()
end

Don’t do this:

while true do
	-- CODE HERE
end

It will lead to script exhaustion because it’s running the code incredibly fast (without any kind of pauses).