Script doesnt work

@Dersarius I have put comments in, the comments are prefixed with //

With everything provided, even someone with no understanding of the API should be able to get it working with a little effort.