Class_name Player: Problem with accesing var of player

Godot Version

4.2.2

Question

Under extends CharacterBody2D I made a class_name Player and @onready var Health: int = 100. In UI I have a progress bar to reflect health.
In the UI script i made @export var player: Player and reference to the progress bar. When I try to hook up progress bar value by writing progress_bar.value = player.health i get an error Invalid get index ‘health’ (on base: ‘Nil’). What am I doing wrong?

@export variables must be assigned, usually through the editor make sure your UI has a player selected in the inspector.

Tried that but there is nothing to select there :frowning:

Try it again from a scene which contains both the player and the UI element. Maybe a Main or Level scene?

Without seeing any code its simply just blind guesses.
Pseudocode (when people write down what they want the computer to do) always works.