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 out 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.

When to use "wait a tick"

Discussion in 'Skript' started by Sqadow, Jun 1, 2021.

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

    Sqadow New Member

    Joined:
    May 29, 2021
    Messages:
    7
    Likes Received:
    0
    So I was reading some skript tutorials and it said: "Please note that while loops don't have a delay, so they are faster than a tick and will crash the server if you are using Minecraft stuff (like blocks) without at least a tick delay: wait a tick"

    can someone tell me when to use "wait a tick" I really what to know when to use it sinds my server crashes sometimes bc of this ;-;
     
  2. oHeckGage

    oHeckGage Active Member

    Joined:
    Mar 24, 2020
    Messages:
    105
    Likes Received:
    4
    one example is when creating a gui, i always put "wait a tick" in between the open chest inventory and format slot

    Code (Text):
    1.  
    2. open virtual chest inventory with size 3 to player
    3. wait 1 tick
    4. format gui slot 10 of player with a stick
    5.  
     
    • Like Like x 1
  3. Sqadow

    Sqadow New Member

    Joined:
    May 29, 2021
    Messages:
    7
    Likes Received:
    0
    Thank you so much, do you maybe have some other examples and can you also tell me when you don't have to use it?
     
  4. oHeckGage

    oHeckGage Active Member

    Joined:
    Mar 24, 2020
    Messages:
    105
    Likes Received:
    4
    Another instance where you should use (not necessarily wait 1 tick, but more like 10 ticks) is on loops such as while player is online.

    Code (Text):
    1.  
    2. while player is online:
    3.     # do something
    4.     wait 10 ticks
    5.  
    I don't really understand what you mean by times you don't need to use it. That's basically everytime that you don't use it lol.
    I don't have any other times off the top of my head.
     
  5. Minecoll_YT

    Supporter Forums Helper

    Joined:
    Dec 2, 2018
    Messages:
    597
    Likes Received:
    37
    You don't need to wait a tick every time you open a gui and second "Another instance where you should use (not necessarily wait 1 tick, but more like 10 ticks)" in a while loop you always have to use it!
     
Thread Status:
Not open for further replies.

Share This Page

Loading...