Teleporting back up from void

Discussion in 'Skript' started by chrissquid123, Jul 31, 2018.

  1. So I am making a skript where when the player falls into the void while in the warzone world they get teleported back up to the nearest block. My code so far is
    Code (Text):
    on damage of player:
        if damage cause is void:
            cancel event
            damage the player by 5 hearts
            apply wither 2 to the player for 10 seconds
            apply slowness 2 to the player for 4 seconds
    My problem is I don't know how to check where the nearest block is, after testing I found you start taking void damage at around -65 and most of the lowest floor of the warzone is around 0-10. Yet the problem is I don't know if I should loop all the blocks around the player and then if it isn't air teleport them to it, since I would have to loop so many I don't know if that would lag the server.
     
  2. I don't think it's a good idea to teleport them to thenearest block. I think it's better to teleport them to the first floor above them or to the block they jumped of before falling in the void.
     
  3. I want to teleport to the block they fell from but I don't know how