need to save the position before the player teleports

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

otak

Member
Oct 10, 2022
4
0
1
24
I use multiverse core and when changing the world I need to save the position before the player teleports, for example the player is in world1 use the command to world2 and before teleporting save his last position in world1, how to do it?

Code:
on player world change:
    wait 10 tick
    if player has permission "op":
        set {LastLocation.%player%} to location of player
        stop

command /backtolastlocation:
    permission: op
    trigger:
        if world is "lobby":
            teleport player to {LastLocation.%player%}
        else:
            message "&c Nejsi v lobby"
 
I don't understand how to use it, teleportation works for me but it teleports me back to the spawnlobby of the world "zkouska" and not to the last location of the player
my new code-
Code:
on player world change:
#    if player has permission "op":
    if event-world is "zkouska":
        set {LastLocation::%player%::loc} to event-location
        stop

command /backtosurvival:
    permission: op
    trigger:
        if world is "lobby":
            teleport player to {LastLocation::%player%::loc}
        else:
            message "&c Nejsi v lobby"
 
Status
Not open for further replies.