How to make speed go slower?

Hi, I’m working on a game, and I would like the player to go slower when you press shift (I have set up shift as crouch in the input manager). I tried this code and it didn’t work, can somone tell me what I’m doing wrong?

void Update()
{
        if (Input.GetButtonDown("Crouch"))
        {
               playerSpeed = 2.5f;
        }
        else
        {
            playerSpeed = 5f;
        }
}

GetButtonDown is only true the frame you started to press the key.
Use GetButton instead. It’s true every frame the key is pressed.

     if (Input.GetButton("Crouch"))
     {
            playerSpeed = 2.5f;
     }