Loop for slide speed? Help!

Godot Version

Godot 4.5

Question

I have sliding give a speed boost in my 3D game, but I can’t get it to gradually slow back down. Can anyone help make a loop to slow the speed over the course of about a second?

Here is the code I have for sliding:
elif Input.is_action_just_pressed(“crouch”) and is_on_floor() and !crouched and sprinting:
crouched = true
crouch(1)
speed = 15

Nudge it a little bit every frame, or use a tween and let the engine nudge it.