I hope you want to turn it on somewhere else in the script. You forgot the # for Clientside ( //#CLIENTSIDE ), and forgot to close the { bracket for turning it on. Also, I dont think scripts can go back if they call a function (if they call a function, that function needs to be below it). And the part
PHP Code:
function onKeyPressed(code,key) {
if (keycode==0x75) {//F9
the if (keycode == 0x75) { }
keycode is the code given within the onKeyPressed params, so it would either be
PHP Code:
function onKeyPressed(keycode,key) {
if (keycode==0x75) {
or
PHP Code:
function onKeyPressed(code,key) {
if (code==0x75) {
Also I don't see why this is entitled 'Gui Scripting', since so far you havn't mentioned anything about GUIs--but rather, GS2 Scripting.