So here the variable is public,but when I go to the inspector the variable isn't there I saved the code and went back to the script and it's still not there
Show us your code (using CODE tags), we can't diagnose problems if we don't know the symptoms, kind of like Doctors
The simplest solution for "odd behaviors" like this is to simply remove the script component and then to add it back.