All I can suggest is to make sure the script is in a new file (not underneath any other script) and that you don't try triggering it yourself. Beyond that, you'd have to troubleshoot why it's not working because it should work fine.