Hi, i've inserted a progressbar on my player/canvaslayer and attached a script to it, in the script i've got
@export var player: Player
func _ready():
player.healthChanged.connect(update)
update()
func update():
value = player.currentHealth * 100 / player.maxHealth```
in the player script i've got these
signal healthChanged
@export var maxHealth = 100
@onready var currentHealth: int = maxHealth
func _on_hurt_box_area_entered(area):
if area.name == "HitboxComponent":
currentHealth -= 30
healthChanged.emit(currentHealth)
print_debug(currentHealth)```
it does show the damage in the debug window but the bar itself is always on 0%, what have i done wrong here ? i feel like it has to do with the update function but im not sure 😦