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.

Help with making a randomtp thing

Discussion in 'Skript' started by TubeVillager, Jan 30, 2019.

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

    TubeVillager Active Member

    Joined:
    Jan 29, 2019
    Messages:
    28
    Likes Received:
    1
    Hey people im back

    i am making a skript that lets you do /randomtp and it will teleport you to a random player but i want it that it can not teleport you to yourself

    second of all i want it to be like if you are the only player online it will tell you that there is nobody to teleport to.
    so how do i do this?
     
  2. T

    TPGamesNL Well-Known Member

    Joined:
    Jan 20, 2018
    Messages:
    1,285
    Likes Received:
    72
    Medals:
    you can remove the player who executed the commands from a list variable which has all players, and then check if that list is set
     
  3. T

    TubeVillager Active Member

    Joined:
    Jan 29, 2019
    Messages:
    28
    Likes Received:
    1
    can you show me how to do that please?
     
  4. L

    Joined:
    Jan 26, 2017
    Messages:
    363
    Likes Received:
    19
    Code (Text):
    1. command /randomtp:
    2.     trigger:
    3.         set {_l::*} to all players
    4.         if size of {_l::*} <= 1:
    5.             message "There is no one to teleport to."
    6.             stop
    7.         remove player from {_l::*}
    8.         teleport player to a random element out of {_l::*}
     
  5. T

    TubeVillager Active Member

    Joined:
    Jan 29, 2019
    Messages:
    28
    Likes Received:
    1
    okay ive done this


    command /randomtp:
    executable by: players
    trigger:
    set {_l::*} to all players
    if size of {_l::*} <= 1:
    message "{@Prefix} {@Randomtp No Player Message}" to player
    stop
    remove player from {_l::*}
    teleport player to a random element out of {_l::*}
    send "{@Prefix} {@Randomtp Successfull Message}" to player

    but now when i type /randomtp nothing happens anymore.
    nothing with 1 player online nothing with 2 players online.
    just noting...
     
Thread Status:
Not open for further replies.
Loading...