overlaps_area() checks if the area is overlapping a specific other area. You pass a reference to the second Area2D as the argument.
If you want to check if it’s overlapping any other area, you want to use get_overlapping areas() instead, which returns an array of overlaps.
Thanks for the answer!
I used -
extends Area2D
var invalid = false
func _process(delta: float) -> void:
for area in get_overlapping_areas():
if "name" in area.name || "second_name" in area.name:
invalid = true