Can anyone figure out whats wrong with this script? It keeps saying NullReferenceExeption.

NullReferenceException means you are trying to access a part of something which is a null value. Easily one of the most common and most google-able problems you will run into. Not only that, the full error will tell you which line it occurs on, after that, you only need to narrow it down yourself to figure out what’s null.

On a second note, when posting code in the Scripting Forum, make sure to use Code Tags to make your code easier to read for anybody that wants to help you.