Need Help with Code Not Working Exactly like A Working Example

Okay, so I omitted the function but now the game freezes telling me the line “get_tree().change_scene(targetScene)” refers to a nonexistent function when I touch the flag, even though that is what the tutorial I linked to told me to do word for word.

Can you guys please help with a solution/workaround?

Okay, so I added a line about getting the root node in the start/ready function, but unfortunately I get the same error after adding the line.

What else am I doing wrong?