For some reason, my attack animation goes to the first frame but won't play.
here are enemy script, i'm not sure what i did wrong

extends KinematicBody2D

var speed : int = 70
var jump_speed : int = 400
var gravity : int = 1500
var velocity = Vector2()
var facing_right = true
var running
var damage = 3

onready var player = get_parent().get_node("Player")

func _physics_process(delta):
	if running:
		$Pivot/AnimationPlayer.play("Run")
	if !running:
		$Pivot/AnimationPlayer.play("Idle")
	
	if facing_right == true:
		$Pivot.scale.x = 1
	else:
		$Pivot.scale.x = -1
	
	if is_in_range() && is_on_floor():
		$Pivot/AnimationPlayer.play("Attack")
	
	calculate_velocity(delta)

func calculate_velocity(delta):
	velocity.x = 0
	
	if player.get_node("CollisionShape2D").global_position.x < $CollisionShape2D.global_position.x - 22:
		velocity.x -= speed
		facing_right = false
		running = true
	elif player.get_node("CollisionShape2D").global_position.x > $CollisionShape2D.global_position.x + 22:
		velocity.x += speed
		facing_right = true
		running = true
	else:
		velocity.x = 0
		running = false
	

	#Gravity
	velocity.y += gravity * delta
	velocity = move_and_slide(velocity, Vector2.UP)
	pass

func damage():
	if is_in_range():
		player.take_damage(damage)


func is_in_range() -> bool:
	var in_range
	var o_bodies = $Pivot/HitRange.get_overlapping_bodies()
	
	for body in o_bodies:
		if body.name == player.name:
			in_range = true
			break
		else:
			in_range = false
	
	return in_range

in every physics frame you are starting the animation from the start again. Add in a if statement checking if the animation player is already playing the animation.

Looking at your code I'd think the running would have had the same issue, tho. It's curious that you are only having the issue with the attack animation.