When asking for help debugging an error, you should usually post the code you are editing. Use code tags , and remember to clearly indicate which line is getting the error.
In general terms, a NullReferenceException means that you are assuming your variable has a value but it actually does not. This can occur if you never assigned it a value, or if you assigned it to an object that has since been destroyed, or if you specifically set it to null.
“Assuming your variable has a value” basically means any time you put a period after the variable name. Also certain special cases like trying to iterate over it with a foreach loop.
If you are following a tutorial, you may have made a typo somewhere. Remember that Capitalization matters.
Also you might have forgotten to assign a reference to the variable in the inspector. This can be tricky to spot because your code is exactly right but it’s counting on some set-up that you haven’t done.