Keep getting Invalid index '0' (on base: 'PoolVector2Array) cant seem to work out why.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By G01DF15H

Keep getting Invalid index ‘0’ (on base: 'PoolVector2Array) on line 24 (indicated below)

onready var navigation = get_tree().get_root().find_node("Navigation2D",true,false)
onready var destinations = navigation.get_node("Destinations")

var motion
var possible_destinations
var path 

export var minimum_arrival_distance = 5
export var walk_speed = 0.5


func _ready():
	randomize()
	possible_destinations = destinations.get_children()
	make_path()

func _physics_process(delta):
	navigate()
	
	
func navigate():
	var distance_to_destination = position.distance_to(path[0]) <----Line 24
	if distance_to_destination > minimum_arrival_distance:
		move()
	else:
		update_path()
		
func move():
	look_at(path[0])
	motion = (path[0] - position).normalized()* (MAX_SPEED * walk_speed)
	
	move_and_slide(motion)
	
func update_path():
	if path.size() == 1 and $Timer.is_stopped():
		$Timer.start()
	else:
		path.remove(0)
	
	
func make_path():
	var new_destination = possible_destinations[randi() % possible_destinations.size()-1]
	path = navigation.get_simple_path(position,new_destination.position)
	

func _on_Timer_timeout():
	make_path()

Any ideas?

:bust_in_silhouette: Reply From: mauricio_marquessm

Hey, I’m taking the same course as you. Another guy also had the same problem. I answered him there:
https://forum.godotengine.org/95649/invalid-get-index-base-poolvector2array-complete-begginer

See if it helps you.