error(17,1): Unexpected token: Identifier:Global

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

I am new on this program and every time i have this error idk what’s i have to do
error(17,1): Unexpected token: Identifier:Global

sorry for my inglish

  extends Node2D

onready var enemy_1 = preload("res://Hidrogênio.png")
onready var teste = Vector2.ZERO

func _ready():
	Global.node_creation_parent = self

func _exit_tree():
	Global.node_creation_parents = null

func _on_Enemy_spawn_timer_timeout():
	var enemy_position = Vector2(rand_range(17, 32), rand_range(303, 19))
Global.instance_node(enemy_1, enemy_position, self)
:bust_in_silhouette: Reply From: jgodfrey

It looks like the code assumes that you have an Autoload script named Global that contains the referenced variables and functions.

So, a few things to check:

  • Do you have a script named
  • Has it been defined as an Autoload script (Project Settings | Autoload)?

yes i do this but still dont working

Muryko | 2020-11-10 10:02

:bust_in_silhouette: Reply From: whiteshampoo

The indentation of line17 is wrong. you cannot do stuff outside a function/method.