Get_overlapping_boddies now working help

Godot Version

4.0

so get_overlapping_boddies is not working with this code:
extends Area2D

func _physics_process(delta):
if Input.is_action_just_pressed(“ui_accept”):
for body in $Area2D.get_overlapping_bodies():
body.queue_free()
print(“you won good job”)

when space or enter is pressed near this area2d it should make my coin disappear
so what am i doing wrong and sorry if its a really easy question i m new to godot

Hi !

I think we lack a lot of information/clarification to be able to help you here.

Look at the definition of the get_overlapping_bodies funciton in the official documentation : Area2D — Godot Engine (stable) documentation in English

Does your coin object inherit from the PhysicsBody2D node ?
Do your coin object and your Area2D have a CollisionShape2D ?
If so, check that the mask of you Area2D match the collision layer of your coin object.