Invalid get index 'score' (on base: 'null instance')

Godot Version

godot-3.5

Question

Hi I’m new and trying to make a top down shooter. I had a problem when trying to make a points counter using a global variable. At the moment when a mob dies, the death function should add a number to the variable. In the counter code, accessing this variable should receive this value, but at this moment an error from the post title

**Mob code**
extends RigidBody2D

var health = 100
onready var global = get_node("res://Core/Global.gd")


func _hit():
	health -= 25
	if health == 0: 
		global.score += 1
		queue_free()

**Global variable**
extends Node

var score := 0

**Points counter**
extends CanvasLayer

onready var global = get_node("res://Core/Global.gd")

func _ready():
	$Score.text = str(global.score)

You can’t use get_node with a file path, you need to use a node path instead, see get_node