Player turn toward character error

So I found a movement script for turning towards a player.

turn_toward_character($game_map.events[id of the event you want to turn toward])

It works when I play test it, however as soon as I transfer maps (which it is supposed to do straight afterwards) it comes up with this error.

Here's the link to the other thread: https://forums.rpgmakerweb.com/index.php?threads/player-turns-towards-event.39846/

\
1589861896703.png

I've moved this thread to RGSSx Script Support. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/player-turn-toward-character-error.121752/