Unlock Exit...Big Problems...

I've been struggling with this for many an hour with no luck.
Here's what I'm doing:-

Create a lockable exit to the south (kitchen).
Give script name 'to kitchen'.
Add script.....
If player has object 'key'
Unlock exit 'to kitchen'
Print message "Door Unlocked'.

But it don't happen.

What am I doing wrong???!!!

Any help would be gratefully appreciated..

Can you please attach your .aslx game file? Click reply, then use the "Upload attachment" tab under the submit/preview/save draft buttons.

Okay, thanks for taking a look. Hopefully you will get my attachment.

Your script is in the wrong place - an exit script will only run when the player uses that exit, but the exit is locked, so it will never be run!

Instead, I would put the script in the "key" object. Add a "Use" script, and make it unlock the exit there.

That makes sense! Thanks Alex.
:)