help! I'm making a plataformer, and i keep getting the "null instance" error!

Godot Vertion

godot 4

Question

after I changed the “player” node to global, i keep getting this error!(note: I only get this error when and only when i changed the node to global)(sorry for the node and variable names, english is not my first language)

here is the scene tree:

Jogador
CollisionShape2D
Sprite2D
Corte
corteanimation
hitboxcorte
Camera2D
ui
contador de vida
contador de moedas
Area2D
CollisionShape2D
regeneracao

here is the code:

extends CharacterBody2D

@onready var corteanimation: AnimatedSprite2D = %corteanimation

const SPEED = 320.0
const JUMP_VELOCITY = -800.0
var esquerda = velocity.x < 0
var vel_de_regeneracao = 5

var gravity = ProjectSettings.get_setting("physics/2d/default_gravity")


func _ready() -> void:
	corteanimation.visible = false



func _physics_process(delta):
	
	get_node("regeneracao").wait_time = vel_de_regeneracao
	
	
	if Input.is_action_just_pressed("esquerda"):
		esquerda = true
	if Input.is_action_just_pressed("direita"):
		esquerda = false
	
	
	var vida = Gamemaneger.vida_do_jogador
	
	if not is_on_floor():
		velocity.y += gravity * delta

	if Input.is_action_just_pressed("ataque"):
		get_node("corte/hitboxcorte").disabled = false
		$corte.show()
		$corte/corte.corte()
	else:
		$corte/hitboxcorte.disabled = true

	if esquerda:
		$corte/hitboxcorte.position.x = -2.333
		$corte/hitboxcorte.position.y = -1.5
		$corte/corte.position.x = -9.5
	else:
		$corte/hitboxcorte.position.x = 2.333
		$corte/hitboxcorte.position.y = 1.5
		$corte/corte.position.x = -0.667

	if vida <= 0:
		Gamemaneger.reiniciar()
		get_tree().reload_current_scene()

	
	if Input.is_action_just_pressed("pulo") and is_on_floor():
		velocity.y = JUMP_VELOCITY

	
	var direction = Input.get_axis("esquerda", "direita")
	if direction:
		velocity.x = direction * SPEED
	else:
		velocity.x = move_toward(velocity.x, 0, 10)

	move_and_slide()
	
	
	$corte/corte.flip_h = $Sprite2D.flip_h
	$Sprite2D.flip_h = esquerda
func _dano(dano):
	Gamemaneger.vida_do_jogador -= dano
	if esquerda:
		velocity.y += 500
	else:
		velocity.y += -500
		move_and_slide()

func _on_area_2d_body_entered(body: Node2D) -> void:
	
		1 == 1


func _on_corte_animation_finished() -> void:
	pass


func _on_corte_animation_looped() -> void:
	print("kkk")
	$corte/corte.para()
	$corte.hide()


func _on_regeneracao_timeout() -> void:
	Gamemaneger.vida_do_jogador += 1


func _on_area_2d_area_entered(area: Area2D) -> void:
	if area.is_in_group("danonocontato"):
		_dano(1)

Which line exactly does produce the “null instance” error?

It is probably not a good idea to change the Player to a Global; what issue were you trying to solve by making it Global?