Script working on object but not on camera

Please format your code .