Melee Attack Animations Aren't working well

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By cookieoil

I want to make melee attack like this game Bright Lancer by Slo Nod which will trigger everytime you click the mouse button. Beside that, my code is following to this https://www.youtube.com/watch?v=gEx_Fmf-MhU&t=107s, a tutorial about playing 8 direction animations with the mouse, of course. I try to combine it with melee attack but seem like they aren’t doing well, debugs show up everytime and thus, whenever u attack too much, the function will be null and stop playing animation, here is the code for more closer view:

var AttackPoints = 3;

var s = 0
var i = 0
var a = 0
var b = 0
var c = 0

func _process(delta:float):
   if isplaying == false:
	var mouse = get_local_mouse_position()
	s = stepify(mouse.angle(), PI/4) / (PI/4)
	s = wrapi(int(s), 0, 8)
	
	if Input.is_action_just_pressed("skill"):
		i = s
	
	if Input.is_action_just_pressed("attack"):
		a = s
		b = s
		c = s

func move_state(delta:float):
   if Input.is_action_just_pressed("attack") and AttackPoints == 3:
	$AttackResetTimer.start();
	state = ATTACK;
	AttackPoints = AttackPoints - 1;
	
  elif Input.is_action_just_pressed("attack") and AttackPoints == 2:
	$AttackResetTimer.start();
	state = ATTACK2;
	AttackPoints = AttackPoints - 1;
	
  elif Input.is_action_just_pressed("attack") and AttackPoints == 1:
	$Attack3ResetTimer.start();
	state = ATTACK3;
	AttackPoints = AttackPoints - 1;
	
func attack_state() -> void:
  isplaying = false;
  animationTree.active = false;
  animationPlayer.playback_active = true;
  current_animation = "Attack";
  animationPlayer.play(current_animation + str(a));
  animationPlayer.playback_speed = 1.75;
  isplaying = true;

 if isplaying == true:
	a = null

func attack2_state() -> void:
 $Sprite.visible = false
 $Sprite2.visible = true
 isplaying = false
 animationTree.active = false
 animationPlayer.playback_active = true
 current_animation = "AttackTwo"
 animationPlayer.play(current_animation + str(b))
 animationPlayer.playback_speed = 1.75
 isplaying = true

 if isplaying == true:
	b = null

func attack3_state() -> void:
 $Sprite.visible = false
 $Sprite2.visible = true
 isplaying = false
 animationTree.active = false
 animationPlayer.playback_active = true
 current_animation = "AttackThree"
 animationPlayer.play(current_animation + str(c))
 animationPlayer.playback_speed = 1.75
 isplaying = true

 if isplaying == true:
	c = null

func attack_animation_finished()->void:
if state == ATTACK || state == ATTACK2 || state == ATTACK3:
	$Sprite.visible = true
	$Sprite2.visible = false
	isplaying = false
	current_animation = "Idle"
	animationPlayer.play(current_animation + str(s))
	isstop = false
	state = MOVE

	if isstop == false:
		s = null

I want to fix this as quick as possible, so ask me if you guys need more information (big thanks for the help)