extends Area3D var children = 0 # Called when the node enters the scene tree for the first time. func _ready(): body_entered.connect(_on_area_entered) body_exited.connect(_on_area_exit) func _on_area_entered(_body : Node3D) -> void: children += 1 func _on_area_exit(_body : Node3D) -> void: children -= 1