Thank you for pointing out the errors!
I've gotten the script to compile now, although it doesn't seem to want to work. Namely, I can talk to an event with this script, but all that will happen is the "click" sound. It doesn't freeze or anything, it just acts as if no event was there.
Here's the fixed up version of the script. I'm guessing there's still something I did wrong near the begining, since it won't even start.
EDIT: I figured out what I had wrong! For anyone curious, I've left the fixed version below.