Speed dont changing

Godot Version

4.1.3

Question

Hey, everybody. I’m not getting the speed change via script to work. Could you please help?
Code:
extends CharacterBody2D

var is_rolling
var WalkSpeed = 150
var RollSpeed = 400
var Can_Roll = true
@export var animation_tree: AnimationTree
var direction: Vector2 = Vector2.ZERO
@export var roll_culdown_timer: Timer

func _ready():
animation_tree.active = true

func _process(delta):
update_animations_parameters()

func _physics_process(delta):
direction = Input.get_vector(“left”, “right”, “up”, “down”)
if direction.length() > 0:
if Input.is_action_pressed(“Roll”) and Can_Roll == true:
velocity = direction * RollSpeed
is_rolling = true
Can_Roll = false
roll_culdown_timer.start(0.5)
else:
velocity = direction * WalkSpeed
is_rolling = false
else:
velocity = Vector2.ZERO
move_and_slide()

func update_animations_parameters():
animation_tree[“parameters/conditions/Idle”] = velocity == Vector2.ZERO
animation_tree[“parameters/conditions/Is_Walking”] = velocity != Vector2.ZERO
animation_tree[“parameters/conditions/Is_Rolling”] = is_rolling == true

if direction != Vector2.ZERO:
	animation_tree["parameters/Idle/blend_position"] = direction
	animation_tree["parameters/Walk/blend_position"] = direction
	animation_tree["parameters/Roll/blend_position"] = direction

func _on_roll_culdown_timer_timeout():
Can_Roll = true

Format your code properly, dude. It’s not clear how you handle the nested if/else blocks.