why isnt my code working?

im new to coding and i wanted to make my character run when I press down leftshift. but when i press left shift all the character does is accelarate for an instance and slows down again.
this is my code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Player : MonoBehaviour
{
    public float speed = 7.0f;
    public float sprintSpeed = 14.0f;
    private float currentSpeed;
    public float jumpForce = 8f;
    public Rigidbody rb;
    public Transform groundCheckTransform = null;
    public LayerMask groundLayers;

    private bool sprintKeyWasPressed;
    private bool jumpKeyWasPressed;
    float verticalMovement;
    float horizontalMovement;


    void Start()
    {
        Cursor.lockState = CursorLockMode.Locked;
    }

    void Update()
    {

        if (Input.GetKey(KeyCode.LeftShift))
        {
         currentSpeed = sprintSpeed;
        }
         
        else
        {
         currentSpeed = speed;
        }

         horizontalMovement = Input.GetAxis("Horizontal") * speed * Time.smoothDeltaTime;
         verticalMovement = Input.GetAxis("Vertical") * currentSpeed * Time.smoothDeltaTime;
         
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            Cursor.lockState = CursorLockMode.None;
        }
        if (Input.GetMouseButton(0))
        {
            Cursor.lockState = CursorLockMode.Locked;
        }

        if (Input.GetKey(KeyCode.Space)) { jumpKeyWasPressed = true; }

    }

    void FixedUpdate()
    {
        transform.Translate(horizontalMovement, 0f, verticalMovement);

        if (Physics.OverlapSphere(groundCheckTransform.position, 0.1f).Length == 1)
        {
            return;
        }

        if (jumpKeyWasPressed)
        {
            GetComponent<Rigidbody>().AddForce(Vector3.up * jumpForce, ForceMode.Impulse);
            jumpKeyWasPressed = false;
        }

    }
}

I know that you’re new to coding so here’s something to keep in mind, whenever you set a value equal to another value and you want it to change, you have to actually change it.

What you did: currentSpeed = sprintSpeed;

What you want to do: currentSpeed += sprintSpeed;

@erno1234 hello mate! Coding gets really easy with practice so dont worry too much,ul get there!
I think that your problem comes out from this part

horizontalMovement = Input.GetAxis("Horizontal") * speed * Time.smoothDeltaTime;
          verticalMovement = Input.GetAxis("Vertical") * currentSpeed * Time.smoothDeltaTime;

Where 1st line actually multiplies with speed and not currentspeed, I think this should work:

 horizontalMovement = Input.GetAxis("Horizontal") * currentSpeed * Time.smoothDeltaTime;
              verticalMovement = Input.GetAxis("Vertical") * currentSpeed * Time.smoothDeltaTime;

I hope I helped!