# How to add max speed to 3D rigidbody?

I’m making a racing game but with flying cars (no gravity). Trying to add a maximum speed. Tried everything I found online and no solution. Below is what I’m working with, no solution attempted.

`````` Rigidbody rb;

public float AccelSpeed = 100f;
public float ReverseSpeed = 50f;
public float RollSpeed = 50f;
public float PitchSpeed = 50f;
public float YawSpeed = 50f;

private Vector3 LocalVelocity;

public float MaxSpeed = 5f;

private PlayerInput playerInput;
private PlayerInputActions playerInputActions;

void Awake()
{
rb = GetComponent<Rigidbody>();

playerInput = GetComponent<PlayerInput>();

playerInputActions = new PlayerInputActions();
playerInputActions.Player.Enable();
}

private void FixedUpdate()
{
Accelerate();
Yaw();
Pitch();
Roll();
}

void Accelerate()
{
//Forward and backward input
ForwardInput *= Time.deltaTime; //converts to per second rather than per frame

//Velocity Update
Vector3 Acceleration = ((ForwardInput * AccelSpeed) * 1) * transform.forward;

//Remove X velocity
LocalVelocity = transform.InverseTransformDirection(rb.velocity);
LocalVelocity.x = 0;
rb.velocity = transform.TransformDirection(LocalVelocity);
}

void Yaw()
{
//Yaw input
YawInput *= Time.deltaTime; //converts to per second rather than per frame
Vector3 Yaw = (YawInput * YawSpeed) * transform.up;
}

void Pitch()
{
//Pitch input
PitchInput *= Time.deltaTime; //converts to per second rather than per frame
Vector3 Pitch = (PitchInput * PitchSpeed) * transform.right;
}

void Roll()
{
//Roll input