I keep getting invalid set index error, what should I do?

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

Hi, I am writing a minmax code for a game, but whenever I run it I get the error Invalid set index ‘start’ (on base: ‘Node (main.gd)’) with value of type ‘bool’. What does it mean and how do I fix it.

extends Node
var board=[7,5,3,1]
func _ready():
	self.board=board
	self.start=true
	makechilds(self)
func makechilds(pnode):
	for x in range(0,4):
		board=pnode.board
		for y in range (0,pnode.board[x]):
			board[x]-=1
			var child=Node
			child.board=board
			child.done=false
			child.start=false
	pnode.done=true
	nextsubject(pnode)
func nextsubject(pnode):
	for i in range (0,pnode.get_child_count( )):
		if not pnode.get_child(i).board==[0,0,0,0] and pnode.get_child(i).done==false:
			makechilds(pnode.get_child(i))
	if pnode.start==false:
		nextsubject(pnode.get_parent())
	else:
		print('done')
:bust_in_silhouette: Reply From: Inces

Because You never introduce variable “start” anywhere !

It must exist before You set it in ready function. Do the same thing You did with “board” variable : introduce it with VAR keyword