The print always print the same result

Godot Version

4.7

Question

i made a code where if the player entered an area2d they a variable of the singleton woulve lower by 15 and if it got lower than 0 it wouldnt got lower than it and utted a print to see the damge on the output, the thing is that every time i enter the area its printed the value 100 on the output so instead of being something like 100. 85. 70. 55 its printed 100. 100. 100. 100. can someone tell me why this happens?

func _on_area_2d_body_entered(body: Node2D) -> void:
	if body.is_in_group("player"):
		bnuuy.heath -= 15
	if bnuuy.health <= 0:
		bnuuy.health = 0
	print(bnuuy.health)

Try adding a print like this:

func _on_area_2d_body_entered(body: Node2D) -> void:
	if body.is_in_group("player"):
		print("body is in group player")
		bnuuy.heath -= 15
	if bnuuy.health <= 0:
		bnuuy.health = 0
	print(bnuuy.health)

This is the only place where it might change, so clearly the body detected is not in the group, so the value never changes. I would guess you never see that new string printed.

This looks to be a simple typo; it should read ’ ‘health’, not ‘heath’.
Does correcting that solve the problem..?