Jump animation not working

When I jump, the animation doesn’t play, it only plays when I do a double jump while moving
Here’s my code:

if Input.is_action_just_pressed("jump") and jumps < 2: # is_on_floor():
		$Sprite.play("jump")
		$Jump.play()
		velocity.y = JUMP_VELOCITY
		jumps += 1

Please can you show the full codes?

The full player character codes?

Yeah. Or the part you played the other animations.

Here:

> func _physics_process(delta):
> 	
> 	if is_on_floor():
> 		jumps = 0
> 
> 	if not is_on_floor():
> 		velocity.y += gravity * delta
> 		if velocity.y > 500:
> 			velocity.y = 500
> 
> 	# Handle jump.
> 	if Input.is_action_just_pressed("jump") and jumps < 2: # is_on_floor():
> 		$Sprite.play("jump")
> 		$Jump.play()
> 		velocity.y = JUMP_VELOCITY
> 		jumps += 1
> 
> 	if Input.is_action_just_pressed("dash") and canDash == true:
> 		if isflip == false:
> 			velocity.x += 700
> 		elif isflip == true:
> 			velocity.x -= 700
> 		dashing = true
> 		canDash = false
> 		$Timer.start()
> 		if is_on_floor():
> 			$Timer2.start()
> 
> 	# Get the input direction and handle the movement/deceleration.
> 	# As good practice, you should replace UI actions with custom gameplay actions.
> 	var direction = Input.get_axis("left", "right")
> 	if direction:
> 			velocity.x = move_toward(velocity.x, direction * SPEED, ACCELERATION * delta)
> 			if Input.is_action_pressed("right"):
> 				$Sprite.flip_h = false
> 				$Walk.play()
> 				if is_on_floor():
> 					$Sprite.play("walking")
> 			elif Input.is_action_pressed("left"):
> 				$Sprite.flip_h = true
> 				#$Walk.play()
> 				if is_on_floor():
> 					$Sprite.play("walking")
> 	else:
> 		$Sprite.play("idle")
> 		velocity.x = move_toward(velocity.x, 0, DECELERATION * delta)
> 
> 	move_and_slide()

Try to place the codes in the previous line of move_and_slide.