'rotation is a Quaternion, and unless you know what you are doing, it is not advised to to directly manipulate Quaternions. You can modify transform.eulerAngles, but the script reference says:
Do not set one of the eulerAngles axis separately (eg. eulerAngles.x = 10; )
So to get the behavior you want, you can start with your own Vector3 set to (0,0,0), modify it and assign it: