[SOLVED] Teleporting back to block fell off of

Discussion in 'Skript' started by chrissquid123, Aug 12, 2018.

  1. I was wondering how I would be able to make a skript where if the player falls into the void it telelports them back to the block they fell from. This is similar to another issue I had made but I realized in that issue what I was trying to do was different so I decided to make it a new thread. The only thing I have thought of was looping blocks in a radius of the player when they fall into the void but that won't teleport them to the specific block they fell from and that might lag the server.
  2. There probably won't be a very efficient way of doing this, since there's no real event for "falling of a block"
    I would suggest maybe doing something like:
    Code (Text):
    every second: # or 5 seconds, whatever time you think works best
        loop all players:
            if block below loop-player is not air:
                set {last::loc::%loop-player%} to location of loop-player
    And then when the player dies, teleport them to {last::loc::%player%}... I cant really think of a better solution.
  3. That is actually a pretty good idea I will try this, though do you think that this will cause lag at all?
  4. i don't think it will cause much lag, but if you have a LOT of players on your server it might affect performance a bit
  5. Ok this is the code I tried and I got 2 errors
    Code (Text):
    every 3 seconds:
        loop all players:
            if block below loop-player is not air:
                set {last::loc::%loop-player%} to location of loop player
    on damage:
        if victim is in the region "betterwarzone":
            if damage cause is void:
                telelport the victim to {last::loc::%victim%}
                damage the victim by 5 hearts
                apply wither 2 to the victim for 6 seconds
    The errors are "12.08 14:35:52 [Server] ERROR There's no world in a periodic event if no world is given in the event (e.g. like 'every hour in "world"') (WarzOres.sk, line 211: set {last::loc::%loop-player%} to location of loop player') 12.08 14:35:52 [Server] ERROR Can't understand this condition/effect: telelport the victim to {last::loc::%victim%} (WarzOres.sk, line 215: telelport the victim to {last::loc::%victim%}')"
  6. So I changed my code to say "every 3 seconds in "Warzone" and that got rid of the first error though I am still unsure about the second
  7. telelport the victim to {last::loc::%victim%} <--- you have an extra L in teleport
  8. Idk how I didn't notice that thanks
  9. HEHE you are welcome. I do stuff like that ALLLLL the time
    • Like Like x 1
    • Funny Funny x 1
  10. Well this works perfectly just a tip for anyone else who does this, since they are in the void they will be out of the world guard region so I just checked to see if they were in the warzone world instead