Any error "undefined" or "nilclass" means that the object the script is trying to use does not exist.
For established and well-tested scripts there are only four possible ways such error can happen:
1) you loaded an old savefile.
A lot of scripts require you to start a new game to set them up correctly, all older savefiles become incompatible and result in undefined or nilclass errors.
2) you made a mistake when copying the script and left some lines uncopied (most likely at the end)
Check and try to copy again if that is the case
3) you made a wrong configuration in the script
A lot of the larger scripts can't be "copied and forgotten", you need to set them up before they can run correctly.
4) the script is incompatible with another script you're using
Finding the other script might be difficult...
Please follow the link to "how to use a script" in my signature - it describes all possible steps and how to bughunt the problem.