I'm trying to make the enemy bullet follow the player, but the error: invalid get index 'global' (on base: 'Kinematicbody2D ('player.gd')) always pops up. When I looked this up, I found some problems similar to mine. The solution says to check the reference, but when I checked the reference, it looked right.
func atirar():
var dog = tirim.instance()
get_tree().get_root().add_child(dog)
dog.global_position = global_position
dog.add_to_group("delete_on_restart")
dog.dir = (get_tree().get_nodes_in_group("player")[0].global.position - global_position).normalized()
func _ready():
add_to_group("player")