why doesnt the texture of my character change when i move left?

Godot Version

4.3

Question

So, i have given my character different textures to preload iif certain actions are pressed (like Jumping). For some reason i dont understand, changing the texture if the character jumps,dies or is in default work perfectly. However the texture does not change if i move left. Anyone any sugestions why? I have tried to put it as var ui_left_texture = preload("texture path) and as var left_texture = preload(“texture path”). But neither works, although for jumping it works.

extends CharacterBody2D

const SPEED = 400.0
const JUMP_VELOCITY = -600.0
const DEATH_Y_LIMIT = 700.0
var is_dead = false
var is_jumping = false
var score: int = 0

@onready var animation_player = $AnimationPlayer
var death_texture = preload(“res://assets/bunny death.png”)
var default_texture = preload(“res://assets/sitting bunny.png”)
var jumping_texture = preload(“res://assets/jumping-bunny_downscaled.png”)
var ui_left_texture = preload(“res://assets/bunny sitting moviinng ear.png”)

@onready var sprite = $Sprite2D
#@onready var respawn_label = $RespawnLabel

func _ready() → void:
# Set the initial texture for the character
sprite.texture = default_texture
#respawn_label.visible = false

func _physics_process(delta: float) → void:

move_and_slide()
for index in get_slide_collision_count():
	var collision = get_slide_collision(index)
	var body := collision.get_collider()
	if body.name == "plantbody":
		_trigger_death()
		return
	#print("Collided with: ", body.name)	

# death animation
if position.y > DEATH_Y_LIMIT:
	_trigger_death()
	return

# Add the gravity.
if not is_on_floor():
	velocity += get_gravity() * delta

# Handle jump.
if Input.is_action_just_pressed("up") and is_on_floor():
	sprite.texture = jumping_texture
	velocity.y = JUMP_VELOCITY
	is_jumping = true
	
	
if is_on_floor() and velocity.y >= 0:
	sprite.texture = default_texture
	is_jumping = false

# 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("ui_left", "ui_right")
if direction:
	velocity.x = direction * SPEED
else:
	velocity.x = move_toward(velocity.x, 0, SPEED)

#move_and_slide()

#print("Current Position: ", position) 

func _trigger_death() → void:
is_dead = true
velocity = Vector2.ZERO # Stop the player’s movement
#animation_player.play(“death”) # Play the death animation
sprite.texture = death_texture
Global.respawn = true
#respawn_label.visible = true #

if is_dead and Input.is_action_just_pressed("ui_accept"):
	_respawn()  

func _respawn() → void:
is_dead = false
# put character back into start position
position = Vector2(59, -19)
sprite.texture = default_texture # Reset to the original image
#respawn_label.visible = false
Global.respawn = false
sprite.visible = true
Global.score = 0

you can add flip.h to _physics_process if velocity.x is > 0