Help with attack collisions in 2D

Godot Version

4.2.2

Question

I am currently trying to develop my own 2D platformer, i was able trough some trial and error, and watching some youtube videos to get all my attack animations working, i have also setup an Area 2D and Collisionshape2D and i did the same for the enemies, i tried a couple tutorials to get this working but i haven’t found one that works, or maybe im just doing something wrong.

This is my animation setup at the moment

func player_animations():
	particle_trails.emitting = false
	
	if is_on_floor():
		if abs(velocity.x) > 0:
			particle_trails.emitting = true
			player_sprite.play("Walk", 1.5)
		elif Input.is_action_just_pressed("Attack"):
			player_sprite.play("single_attack")
		elif Input.is_action_just_pressed("double_attack"):
			player_sprite.play("double_attack")
	elif Input.is_action_pressed("Attack") and !is_on_floor():
			player_sprite.play("air_attack")
	else:
		player_sprite.play("Jump")

and i also added a var to the top of the script, this was done probably in one of the tutorials i was watching

@onready var deal_damage = $Collision

and i even already have a collision detection on the characters body for traps, although i have tried to fiddle with the code to get it working with the same code but it just does not work as intended

func _on_collision_body_entered(_body):
	if _body.is_in_group("Traps"):
		death_particles.emitting = true
		death_tween()

i think im just not getting the concept of how it detects the attack beetween the enemies and the player or vice versa, or how can i get the code to actually detect something, im feeling just lost at the moment, can anyone provide some light on how to do this ?

Animation plays, attack is at peak animation when hit should take place. Have animation call function to query if something needs to deal damage and do so.