How do I freeze the y rotation?

{

    rb.freezeRotation = true;

    if(collisionInfo.collider.name == "Ground")
    {
        rb.AddForce(0, 150, 0);
        rb.freezeRotation = false;
    }

    rb.freezeRotation = false;
    rb.freezeRotation.y = true;
}

You can do it from the inspector like this