My states wont work

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

I am following this tutorial o f HeartBeast https://www.youtube.com/watch?v=0nd1zNiy0C4&lc=UgzG5FuBIP3rGk2aXwt4AaABAg.98rGt4K6Doh9KvONL0dyZv

Everthing just works but if i press the Space key/J key than my character starts walking slowly instead of stopping can anyone pls help

Here is the code for my Character:
extends KinematicBody2D # gebruik de KinematicBody2D (speler)

const ACCELERATION = 400 # versnelling
const MAX_SPEED = 50

const FRICTION = 400 # wrijving

var velocity = Vector2.ZERO # velocity = snelheid
var welkekant = 0
var state = MOVE

onready var animationPlayer = $AnimationPlayer
onready var animationTree = $AnimationTree
onready var animationState = animationTree.get(“parameters/playback”)

enum{
MOVE,
ATTACK
}

func _ready():
animationTree.active = true

func _physics_process(delta):
if Input.is_action_just_pressed(“attack”):
state = ATTACK
move_state(delta)
match state:
MOVE:
move_state(delta)
ATTACK:
attack_state(delta)

func attack_state(_delta):
pass

func move_state(delta):
var input_vector = Vector2.ZERO
input_vector.x = Input.get_action_strength(‘ui_right’) - Input.get_action_strength(‘ui_left’) # links naar rechts bewegen
input_vector.y = Input.get_action_strength(‘ui_down’) - Input.get_action_strength(‘ui_up’) # boven naar beneden bewegen
input_vector = input_vector.normalized()

if input_vector != Vector2.ZERO: # niet gelijk
	animationTree.set("parameters/Idle/blend_position", input_vector)
	animationTree.set("parameters/Run/blend_position", input_vector)
	animationState.travel("Run")
	velocity = velocity.move_toward(input_vector * MAX_SPEED, ACCELERATION * delta)
else:
	animationState.travel("Idle")
	if welkekant == 1:
		animationPlayer.play('Rechts')
	else:
		animationPlayer.play("Links")
	velocity = velocity.move_toward(Vector2.ZERO, FRICTION * delta)
move_and_slide(velocity)

I made a system thats not in the video
Its just if the player go’s to right that he’s idle is right and in reverse