Every 1 tick event

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

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

Kolombooo

Active Member
Dec 3, 2020
51
3
8
Hey,

so i ran into an issue while using the every 1 tick event. This is my code:

Code:
every 1 tick:
  loop all players:
    if {%loop-player%::frzd} = 1:
      if location of player is not {%loop-player%::lockloc}:
        teleport player to {%loop-player%::lockloc}

The idea is, that every tick the skript checks if the player is located on the exact spot {%loop-player%::lockloc}

But this is the error:

Code:
[09:27:01 ERROR]: There's no world in a periodic event if no world is given in the event (e.g. like 'every hour in "world"') (atsec.sk, line 37: if location of player is not {%loop-player%::lockloc}:')

Thanks for helping me
 
You really shouldn't loop all players every single tick, you're better off using a while loop and checking the block below player rather than their location, as that checks for any movement at all, even slightly moving their mouse
 
Your problem is that in the last 2 lines you used 'player' instead of 'loop-player', here is the fixed code also following oToghty's suggestion:
Code:
every 1 tick:
  loop all players:
    if {%loop-player%::frzd} = 1:
      if location of block below location of loop-player is not {%loop-player%::lockloc}:
        teleport loop-player to {%loop-player%::lockloc}
 
Status
Not open for further replies.