My player is stuck in his attack animation when I pressed it once, do I miss something in my code?

Every movement animation works but for the attack animation not here’s my code

extends CharacterBody2D
class_name player

@export var speed : int = 150
@export var jump_force : int = 255
@export var gravity : int = 900

var is_attacking = false

#Player Movement
func _physics_process(delta):
var direction = Input.get_axis(“left”,“right”)

if direction:
	velocity.x = direction * speed
	if is_on_floor() and is_attacking == false:
	velocity.x = 0
	if is_on_floor() and is_attacking == false:

#Animation left and right
if direction == 1:
$AnimatedSprite2D.flip_h = false
elif direction == -1:
$AnimatedSprite2D.flip_h = true

if Input.is_action_pressed(“jump”) and is_on_floor():
velocity.y -= jump_force

if not is_on_floor():
velocity.y += gravity * delta

#Claw attack animation
if Input.is_action_pressed(“attack”):
is_attacking = true
await $AnimatedSprite2D.animation_finished
is_attacking = false


There’s a few similar functions. one is ‘is_action_just_pressed’, which return true once and stop, but the one you are using will echo the key stroke and return true multiple times.