Discord Thread Random Teleport

  • 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!

This thread came from the skUnity Discord. You can't reply to it here but if you join the skUnity Discord, you'll be able to post a reply there. The thread link is part of the thread's message.
Status
Not open for further replies.

skUnity Discord

Site Manager
Aug 5, 2023
12,755
0
0
The skUnity Discord
discord.gg
I would like to ask for help with this script so that the player is not teleported to the sky, how can I fix in this script? I would be grateful
code_language.skript:
command /rtp:
    trigger:
        set {_x} to random integer from {@minimumxz} to {@maximumxz}
        set {_y} to 50
        set {_z} to random integer from {@minimumxz} to {@maximumxz}
        set {_location} to location at ({_x}, {_y}, {_z}) in world "{@world}"
        set {_block} to block at {_location}
        loop all blocks above {_block}:
            if loop-block is air:
                if block under loop-block is {@blockblacklist}:
                    if {@debug} is true:
                        send "&7&oFailed random teleportation attempt (blacklisted block: %block under loop-block%&7&o). Retrying..." to player
                    exit loop
                if {@regioncheck} is true:
                    if region at loop-block is set:
                        if {@debug} is true:
                            send "&7&oFailed random teleportation attempt (region is set). Retrying..." to player
                        exit loop
                add 1 to {_i}
                if {_i} >= 2:
                    teleport player at loop-block

Posted by: bill1656 from the skUnity Discord. View the thread on skUnity Discord here
 
i mean i could remake it cause idk how i wouild edit that lol
code_language.skript:
command /rtp:
  trigger:
    set {_rtp} to true
    while {_rtp} is true:
      add 1 to {_attempts}
      set {_x} to random integer from {@minimumxz} to {@maximumxz}
      set {_z} to random integer from {@minimumxz} to {@maximumxz}
      set {_y} to 200
      set {_location} to location at ({_x}, {_y}, {_z}) in world "{@world}"
      while block at {_location} is air:
        remove 1 from {_y}
        set {_location} to location at ({_x}, {_y}, {_z}) in world "{@world}"
        wait 1 tick
      if block at {_location} is not {@blockblacklist}:
        teleport player to block above {_location}
        send action bar "&aRandomly teleported! (%{_attempts}% attempts)"
        set {_rtp} to false
      wait 1 tick
best i could think of <a:cat_shrug:1072726246804434954>

Posted by: finrex01 from the skUnity Discord.
 
Status
Not open for further replies.