[Solved] When key pressed rotate until lifted if key up smoothly revert to original position and if rotate too far die

Object Asks: When key pressed rotate until lifted if key up smoothly revert to original position and if rotate too far die
I am trying to have a smooth rotation animation on this hover-car to make it seem more realistic.

I am trying to code it so that if the key a or d is pressed it will rotate to the left and right accordingly. If it rotates too far then it dies and the scene is reloaded. When the keys a or d are lifted then it will smoothly revert back to its original position. I want it to rotate on the x axis of its origin. If you see in the image the scenes axis is z and the axis of origin that points in the direction of that from the vehicle is its x.

Here is the scene with the axis’s of the vehicle:
enter image description here

Code:
        public int speed = 100;
        public float maxrotation = 30f; //To Set Max Rotation

        void Start()
        {
            
        }

        // Update is called once per frame
        void Update()
        {
            if (transform.rotation.eulerAngles.x > 0)
            {
               
                transform.rotation.eulerAngles.x - 1; //there is an error on this line saying "Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement"
                
            }
            if (transform.rotation.eulerAngles.x < 0)
            {
               
                transform.rotation.eulerAngles.x + 1; //there is an error on this line saying "Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement"
                
            }
            if (Input.GetKey(KeyCode.A))
            {
                //Set a rate at which we should turn
                float turnSpeed = speed * Time.deltaTime;
                //Connect turning rate to horizonal motion for smooth transition
                float rotate = Input.GetAxis("Horizontal") * turnSpeed;
                //            //Get current rotation
                //            float currentRotation = gameObject.transform.rotation.z;
                //            //Add current rotation to rotation rate to get new rotation
                //            Quaternion rotation = Quaternion.Euler (0, 0, currentRotation + rotate);
                //            //Move object to new rotation
                //            gameObject.transform.rotation = rotation;
                gameObject.transform.Rotate(Vector3.left * rotate);
            }
            if (Input.GetKey(KeyCode.D))
            {
                //Set a rate at which we should turn
                float turnSpeed = speed * Time.deltaTime;
                //Connect turning rate to horizonal motion for smooth transition
                float rotate = Input.GetAxis("Horizontal") * turnSpeed;
                //            //Get current rotation
                //            float currentRotation = gameObject.transform.rotation.z;
                //            //Add current rotation to rotation rate to get new rotation
                //            Quaternion rotation = Quaternion.Euler (0, 0, currentRotation + rotate);
                //            //Move object to new rotation
                //            gameObject.transform.rotation = rotation;
                gameObject.transform.Rotate(Vector3.left * rotate);
                
            }
            if (transform.eulerAngles.x > maxrotation)
            {
                Application.LoadLevel(Application.loadedLevel); //kills player and reloads scene
                scorecript.scoreValue = 0; // sets score to zero
            }
            if (transform.eulerAngles.x < maxrotation - (maxrotation * 2))
            {
                Application.LoadLevel(Application.loadedLevel); //kills player and reloads scene
                scorecript.scoreValue = 0; //sets score to zero
            }

        }

<!-- end snippet -->

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.