Teleport 2 players to a different location

Discussion in 'Skript' started by SammyProXCoding, Jul 15, 2021.

  1. Hey all! Im making a small minigame for my server, i want to like, teleport player 1 to x y z and player 2 to (diffrerent) x y z. I cant get it to work...
    Code (Text):

    on join:
        if {} is "0":
            set {player1} to "%player%"
    on join:
        if {} is "1":
            set {player2} to "%player%"
            execute console command "tp %{player1}% -186 64 149"
            execute console command "tp %{player2}% -186 64 157 "
    on load:
        set {} to "0"
        set {running_game} to false
  2. 1. you're storing numbers in strings which you shouldn't do, keep them as numbers, do not surround them with " "

    2. do not set variables to false or 0, keep them unset, this will reduce memory usage

    3. do not use command for teleportation, teleport with Skript instead

    you should be able to achieve it like this:
    Code (Text):

    on join:
      add 1 to {-number}
      if {-number} is 1:
        teleport player to location(-186, 64, 149, world("someworld"))
        delete {-number}
        teleport player to location(-186, 64, 157, world("someworld"))
    #2 Govindas, Jul 15, 2021
    Last edited: Jul 15, 2021