RuneScape Auto Talker

I have a script that tells System Events to keystroke in some text that has been inputted by the user in a text box, however, I keep getting this cryptic error message:

Screenshot

I can get it to work in Script Editor, it’s the exact same script except without the “on clicked theObject” and “end clicked” tags.

And, no, I am not coding in Japanese or Chinese or whatever that stuff is.

Thanks in advance.

Model: MacBook
AppleScript: 2.0.1
Browser: Safari 525.20
Operating System: Mac OS X (10.5)