1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT??:

    You can always check our our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved Teleporting Players to a Location Saved as a Variable

Discussion in 'Skript' started by Hexivoid, Feb 7, 2018.

Thread Status:
Not open for further replies.
  1. Hexivoid

    Hexivoid Active Member

    Joined:
    Oct 22, 2017
    Messages:
    35
    Likes Received:
    5
    Skript version and author not applicable.

    I'm trying to teleport players in two different arrays to a location saved as a variable, but the players are not being teleported. Can someone please tell me why this portion of my Skript isn't working? Thanks!

    (I've already added players to the arrays and checked with a broadcast. Players are being teleported if I type the raw coordinated, but not with the variable!)

    Code (Skript):
    1. set {blue.spawn} to "-48, 31, 483"
    2. set {red.spawn} to "52, 35, 483"
    3.  
    4. teleport {blueteam::*} to location {blue.spawn}
    5. teleport {redteam::*} to location {red.spawn}


     
  2. Best Answer:
    Post #9 by Hexivoid, Feb 7, 2018
  3. Uzumaki

    Uzumaki Well-Known Member

    Joined:
    Feb 20, 2017
    Messages:
    290
    Likes Received:
    8
    Code (Skript):
    1. loop {blueteam::*}:      
    2.     teleport loop-value to {blue.spawn}
    3. loop {redteam::*}:      
    4.     teleport loop-value to {red.spawn}    
     
    • Useful Useful x 1
  4. Hexivoid

    Hexivoid Active Member

    Joined:
    Oct 22, 2017
    Messages:
    35
    Likes Received:
    5
    No errors, but the players still didn't get teleported :emoji_frowning:
    --- Double Post Merged, Feb 7, 2018, Original Post Date: Feb 7, 2018 ---
    <x>, <y>, <z> is the correct format for locations, right?
     
  5. Donut

    Addon Developer

    Joined:
    Mar 27, 2017
    Messages:
    1,340
    Likes Received:
    175
    Medals:
  6. Hexivoid

    Hexivoid Active Member

    Joined:
    Oct 22, 2017
    Messages:
    35
    Likes Received:
    5
  7. Donut

    Addon Developer

    Joined:
    Mar 27, 2017
    Messages:
    1,340
    Likes Received:
    175
    Medals:
    Code (Skript):
    1. teleport player to location at 0, 0, 0 in world "world"
     
    • Like Like x 1
  8. Hexivoid

    Hexivoid Active Member

    Joined:
    Oct 22, 2017
    Messages:
    35
    Likes Received:
    5
    The coordinates in my Skript will constantly change, meaning I don't want to put in raw coordinates but rather a variable ({blue.spawn}) which is already set to a location.

    Code (Skript):
    1. teleport {blueteam::*} to location {blue.spawn}        
    seems not to be working, even after the variable is set to a location (tested this with a broadcast). Any ideas on how to teleport an array of players to a VARIABLE set to a location and not just COORDINATES? Thanks!
     
  9. Donut

    Addon Developer

    Joined:
    Mar 27, 2017
    Messages:
    1,340
    Likes Received:
    175
    Medals:
    because youre trying to throw in one text variable for 3 number arguments... you can split your text at ", " and get each coord and parse it as a number or preferably use a list variable and store each coord as a number not text
     
    • Useful Useful x 1
  10. Hexivoid

    Hexivoid Active Member

    Joined:
    Oct 22, 2017
    Messages:
    35
    Likes Received:
    5
    Finally got it! After so long, it feels good to of found an answer! I didn't realize that you could just parse a variable with a location without having to make it a text/string!

    Code (Skript):
    1. set {blue.spawn} to location -48, 31, 483 in world "World"  
    2. set {red.spawn} to location 52, 35, 483 in world "World"
    3.  
    4. teleport {blueteam::*} to {blue.spawn}            
    5. teleport {redteam::*} to {red.spawn}
    6.  
    7.  
    --- Double Post Merged, Feb 7, 2018, Original Post Date: Feb 7, 2018 ---
    I took inspiration from this effect and set the variable in this format instead of the teleportation effect. Thank you!
     
    • Like Like x 1
Thread Status:
Not open for further replies.
Loading...