I'm getting this error: the modifier public is not valid for this item

If you post a code snippet, ALWAYS USE CODE TAGS:

How to use code tags: Using code tags properly

How to understand compiler and other errors and even fix them yourself:

Beyond that, here is how to report your problem productively in the Unity3D forums:

http://plbm.com/?p=220