The code is correct for C# (it should have a dot before in JS).
Probably GetComponent can’t find the script OrbitCamera, which produces this error.
Let’s check the possibilities:
1- OrbitCamera is JS and your script is C# (or the other way around): JS and C# are compiled by different compilers, thus they can’t see each other during compilation - but already compiled programs can be seen by any language, thus you can place OrbitCamera in one of the early compiled folders (Plugins, Standard Assets and Pro Standard Assets) and the code above in another Assets folder (Assets/Scripts or whatever).
2- The camera isn’t tagged MainCamera (what would let Camera.main empty);
3- The script OrbitCamera is actually attached to a child object, or to another camera.
I just realized the error that shows on the bottom of the screen was from the previous compilation and that the code actually works(I am very new to unity and still getting used to the interface). Sorry for wasting everyone’s time like this.