How to add a speed change with left shift button held down

Here’s my script. Im not sure what exactly I would need to write for there to a be change to the movement speed when I hold down left shift. hoping someone could point me in the right direction. thanks!

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

public class WSv3 : MonoBehaviour
{
    public Rigidbody rb;
    public float jumpForce;
    float speed = 5.0f;
    // Start is called before the first frame update
    void Start()
    {
        speed = 50f;
    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKey(KeyCode.W))
        {
            transform.Translate(Vector3.forward * Time.deltaTime * speed);
        }
        if (Input.GetKey(KeyCode.S))
        { 
            transform.Translate(-1 * Vector3.forward * Time.deltaTime * speed);
        }
        if (Input.GetKeyDown("left shift"))
        {
            //need to speed up the 50f to 100f(?) to give the player a boost when
            //the sprint animation starts, also from the left shift being held down.
        }
    }
}

Simply introduce a Speed Multiplier that’s 1 when Left Shift is not pressed, and 2 when Left Shift is pressed:

float _speedMultiplier = 1f;

if (Input.GetKey(KeyCode.W))
{
    transform.Translate(Vector3.forward * Time.deltaTime * speed * _speedMultiplier );
}
if (Input.GetKey(KeyCode.S))
{ 
    transform.Translate(-1 * Vector3.forward * Time.deltaTime * speed * _speedMultiplier );
}
if (Input.GetKeyDown("left shift"))
{
    _speedMultiplier = 2f;
}
if (Input.GetKeyUp("left shift"))
{
    _speedMultiplier = 1f;
}

Also, consider using Input.GetAxis("Vertical") instead of Input.GetKey(KeyCode.W) and Input.GetKey(KeyCode.S), it’s more optimized and cleaner, good luck!

There’s a really easy way to do this:

if( Input.GetKeyDown(KeyCode.LeftShift) )
{
    SpeedVar = 100;
}

Just change your speed variable to 100, and seeing that you already use this variable for your movement, it should work right away.