Nesting multiple is_in_group functions not working??

4.3
I’m making a rhythm game where I have this script which should detect if when music blocks go past a line, whether or not they are colliding with the hitboxes. To decide if the total score should be reduced or increased. The only problem is that when I have two nested is_in_group functions only the first one is being detected. I have tested swapping the order of them, and they both should work fine. I might be missing something obvious because I’m relatively new. Any help??

extends Area2D

var alreadyHit = false
@onready var timer: Timer = $Timer

func _on_area_entered(area: Area2D) -> void:
	if area.is_in_group("Hitboxes"):
		print("hitbox")
		if area.is_in_group("Music"):
			print("music")
			alreadyHit = true
			timer.start()
		else:
			if alreadyHit == false:
				print("-1")

func _on_timer_timeout() -> void:
	alreadyHit = false
	print("timerout")

Thanks!