Why gameobject still fall after isgravity is false

I have a gameobject that fall when game start but when input is M the gameObject should stop. But it does not stop it keeps falling. when Input M is pressed the rigidbody Gravity is desabled and isKinematic is enabled.

Hi! You need to set the rigid body velocity to zero!

implement this after disabling gravity and enabling kinematic:

rigidbody.velocity = Vector3.zero;

Obviously, rigidbody is the rigidbody components attached to your game object.