I don't know if you still need help with your script but I can point to what is wrong.
Scriptname Aezealkeyscript2 extends ObjectReference Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) if akSourceContainer == Game.GetPlayer() akSourceContainer.MoveTo(MyMarker) endIf endEvent ObjectReference Property MyMarker auto
akSourceContainer, as name suggests, returns an actor or object that is the
source of the item. I.e. it may be a box you took the key from or an NPC that gave it to player. So this script won't work.
In order to make it work you would have to add the script to
the player himself, and then remove the "if akSourceContainer == Game.GetPlayer()". As you may have already figured out, a script added only to the player that works when an item is added to the inventory will logically only work when it is the player's inventory.
But I don't think you should add scripts to the player.
Use the first script. It's from wiki, I think. And it's correct.
PS. An interesting twist would be to teleport the player when he
places an item -- the key -- inside a box. It makes some sense, as the key could activate some mechanism. So, in this case, we WOULD use an OnAddItem event. It would look like this:
Spoiler Scriptname TeleportKey extends ObjectReferenceObjectReference Property Key AutoObjectReference Property XMarker AutoEvent OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) if akSourceContainer == Game.GetPlayer() && akItemReference == Key ; if any key of that type -- any teleport key -- would do, we would use akBaseItem. Game.GetPlayer().MoveTo(XMarker) endifEndEvent