Hello, I'm trying to set an attack animation for my player in my game. I've tried using the animationTree so that it can handle the 4 directional movement for me. However, I'm running into a weird issue where the player will only do the attack animation in one direction. This is what my tree looks like:

I have points set up at each of the directions in the animation Tree so that a specific attack animation will play when the player faces that direction, however, the character will only attack in the direction depending upon where the blending position is set on initialization. I want the character to attack depending where it is facing when the attack button is pressed.
Here is what the Attack component of the tree looks like:

Whenever the attack button is pressed, it will only attack in that direction and not account for where the player is facing.
Here is my code for the player:
extends KinematicBody2D
enum {
MOVE,
ROLL,
ATTACK
}
# Declare member variables here. Examples:
var state = MOVE
var velocity = Vector2.ZERO
const MAX_SPEED = 200
var animationPlayer = null
var animationTree = null
var animationState = null
# Called when the node enters the scene tree for the first time.
func _ready():
animationPlayer = $AnimationPlayer
animationTree = $AnimationTree
animationState = animationTree.get("parameters/playback")
animationTree.active = true
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass
func _physics_process(delta):
match state:
MOVE:
move_state(delta)
ROLL:
pass
ATTACK:
attack_state(delta)
func move_state(delta):
var input_vector = Vector2.ZERO
input_vector.x = Input.get_action_strength("move_right") - Input.get_action_strength("move_left")
input_vector.y = Input.get_action_strength("move_down") - Input.get_action_strength("move_up")
input_vector = input_vector.normalized()
if input_vector != Vector2.ZERO:
animationTree.set("parameters/Idle/blend_position", input_vector)
animationTree.set("parameters/Walk/blend_position", input_vector)
animationState.travel("Walk")
velocity = input_vector * MAX_SPEED
else:
animationState.travel("Idle")
velocity = Vector2.ZERO
velocity = move_and_slide(velocity)
if Input.is_action_just_pressed("attack"):
state = ATTACK
func attack_state(delta):
$PlayerAttack.visible = true
$Sprite.visible = false
velocity = velocity.move_toward(Vector2.ZERO, delta)
velocity = move_and_slide(velocity)
animationState.travel("Attack")
func attack_animation_finished():
$Sprite.visible = true
$PlayerAttack.visible = false
state = MOVE