How to make an object slowly decelerate?

Im very new to coding so bear with me, im making a car game, with the car being a single block, so no fancy wheels or anything.
I have the movement code down, now i need to somehow make it so when i press space bar, the ‘car’ slowly decelerates to a complete stop. Can someone help?

Heres the code:

public class scr : MonoBehaviour
    public float thrust = 1.0f;
    public Rigidbody rb;
    public GameObject move;
    public Vector3 offset;
    public float angleBetween = 0.0f;
    public Transform target;
    void Start()
        rb = GetComponent<Rigidbody>();
        offset = transform.position - move.transform.position;

    void FixedUpdate()
    if (Input.GetKey(KeyCode.W))
        rb.AddForce(transform.forward * thrust);
    if (Input.GetKey(KeyCode.S))
        rb.AddForce(-transform.forward * thrust);
    if (Input.GetKey(KeyCode.A))
       transform.Rotate(0, -1, 0 * thrust);
    if (Input.GetKey(KeyCode.D))
       transform.Rotate(0, 1, 0 * thrust);
	if (Input.GetKey(KeyCode.LeftShift))
	   rb.AddForce(transform.forward * thrust * 2, ForceMode.Acceleration);

    void LateUpdate()
     transform.position = move.transform.position + offset;

Thank you!

You could try to add a ForceMode.Impulse when you add the force rb.AddForce(/*force*/, ForceMode.Impulse);
Or you could simply add a deceleration that you control fully:

if (Input.GetKey(KeyCode.W)){
         rb.AddForce(transform.forward * thrust);
}else if (Input.GetKey(KeyCode.S)){
         rb.AddForce(-transform.forward * thrust);
}else{ //If no Input
        rb.velocity = rb.velocity * 0.95f * Time.deltaTime;      //Edit 0.95 with the value you want as long as it is smaller than 1 and bigger than 0

Hello @champion342,

If you use rigidbody simply increase the drag property and angular drag, you could also edit the physic material.

What you want is friction, to add friction simply substract a percent of the velocity each frame (like in late update) like this:

rb.velocity -= 0.1f*rb.velocity;

Hope that help,