Attack animation will not play

Godot Version

Hi the animation of attack will not play for some reason IDK if anyone can give me a solution i will be thankful i’m a begginer so bear with me and this is the script

extends CharacterBody2D

@onready var animated_sprite = $Animated_Sprite
@onready var deal_damage = $Deal_Damage

const SPEED = 250
const JUMP_Power = -400.0

var gravity = 900
var weapon_equipped: bool
var attack_type: String
var current_attack: bool

func _ready():
Global.playerBody = self
current_attack = false

func _physics_process(delta):
weapon_equipped = Global.playerWeaponEquip
if not is_on_floor():
velocity.y += gravity * delta

# Handle jump.
if Input.is_action_just_pressed("Jump") and is_on_floor():
	velocity.y = JUMP_Power

# Get the input direction and handle the movement/deceleration.
# As good practice, you should replace UI actions with custom gameplay actions.
var direction = Input.get_axis("Left", "Right")
if direction:
	velocity.x = direction * SPEED
	velocity.x = move_toward(velocity.x, 0, SPEED)

	if Input.is_action_just_pressed("Single") or Input.is_action_just_pressed("Double"):
		current_attack = true
		if Input.is_action_just_pressed("Single") and is_on_floor():
			attack_type = "Single"
		if Input.is_action_just_pressed("Double") and is_on_floor():
			attack_type = "Double"
			attack_type = "Air"


func handle_Movement_animation(dir):

	if is_on_floor():
		if !velocity:"Idle")
		if velocity:"Run")
	elif !is_on_floor():"Fall")

func toggle_flip_Sprite(dir):
if dir == 1:
animated_sprite.flip_h = false
if dir == -1 :
animated_sprite.flip_h = true

func handle_Attack_animation(attack_type):
var animation = str(attack_type,“_Attack”)

func _on_animated_sprite_animation_finished():
current_attack = false

You are telling your animated-sprite to play your attack animation and a few lines of code later you tell it to play a different animation. If you want to attack you should stop the function there with a “return” or somehow stop the following lines of code with an if statement

can u tell me a how in code

try writing:

if current_attack:

after move_and_slide()

Just forget the animation. Take a look at something like this in the

func _input(event):

At no point in time do you even need velocity.
The keywords are on the other side of the page.
The code is on a different page;

bro thank u u are insane can u tell me why did u know the prob?

well i just read through your code and its a pretty common beginner mistake :sweat_smile: