I created a ball in unity but whenever i stop controlling the ball it keeps sliding. How do i fix this?

public class Fall Movement : MonoBehaviour
{
public Rigidbody rb;
public float Fside;

void FixedUpdate()
{
    rb.AddForce(0f, 10f * Time.deltaTime, 0f);

    if (Input.GetKey("d"))
    {
        rb.AddForce(Fside * Time.deltaTime, 0f, 0f, ForceMode.VelocityChange);
    }

    if (Input.GetKey("a"))
    {
        rb.AddForce(-Fside * Time.deltaTime, 0f, 0f, ForceMode.VelocityChange);
    }
    
}    

}

I would do something like this (not tested)

public class Fall Movement : MonoBehaviour
{

   public Rigidbody rb;
   public float Fside;

   private float fside;

   void FixedUpdate()
   {
      fside=0f;//If you do nothing then default speed to 0
      rb.AddForce(0f, 10f * Time.deltaTime, 0f);
      if (Input.GetKey("d"))
      {
         fside=Fside;
      }
      if (Input.GetKey("a"))
      {
         fside=-Fside
      }
         rb.AddForce(fside * Time.deltaTime, 0f, 0f, ForceMode.VelocityChange);
      }
}

Also I’m surprised that you add 10*Time.deltaTime force constantly on the y-axis, but whatever fits your needs :slight_smile:

Just reset the velocity.

  void FixedUpdate()
     {
         rb.AddForce(0f, 10f * Time.deltaTime, 0f);
         if (Input.GetKey("d"))
         {
             rb.AddForce(Fside * Time.deltaTime, 0f, 0f, ForceMode.VelocityChange);
         }
         if (Input.GetKey("a"))
         {
             rb.AddForce(-Fside * Time.deltaTime, 0f, 0f, ForceMode.VelocityChange);
         }
         if(!Input.GetKey("d") && !Input.GetKey("a")) 
         {
             rb.velocity = Vector3.zero;
         }
         
     }