How to make an animation script???

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

This is my script

export (int) var speed = 1200
export (int) var jump_speed = -1800
export (int) var gravity = 4000

var velocity = Vector2.ZERO

func get_input():
velocity.x = 0
if Input.is_action_pressed(“walk_right”):
velocity.x += speed
$AnimatedSprite.play(“run”)
else: $AnimatedSprite.stop()

if Input.is_action_pressed("walk_left"):
	velocity.x -= speed

func _physics_process(delta):
get_input()
velocity.y += gravity * delta
velocity = move_and_slide(velocity, Vector2.UP)
if Input.is_action_just_pressed(“jump”):
if is_on_floor():
velocity.y = jump_speed

I Cant seem to get the animation script working it always says
Attempt to call function ‘stop’ in base ‘null instance’ on a null instance

:bust_in_silhouette: Reply From: exuin

Generally that error message means that your path to the node is incorrect. Make sure that you have an AnimatedSprite node as a child of the node that the script is on.