Trying to stop loop but can't

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

Aidan

Member
Aug 7, 2020
12
0
1
28
Hi! The script I am writing is supposed to give the player 1 stick and 2 iron ingots, each 3 items with 50 second intervals inbetween. The only problem is, I only want this to occur in the world "pvp". I used a loop so it would save a lot of space, but I can't seem to stop the loop. I have also tried "exit 1 loop", "exit 2 loops" but with no success. Also, is there any better way to write this? I am very new to skript so I may not completely understand what may seem simple.

Code:
on player world change:
  if player is in the world "pvp":
    loop 1000 times:
      wait 50 seconds
      make console execute "give %player% stick 1"
      wait 50 seconds
      make console execute "give %player% iron_ingot 1"
      wait 50 seconds
      make console execute "give %player% iron_ingot 1"
    if the player is not in the world "pvp":
      exit 1000 loops
[doublepost=1597766877,1597669927][/doublepost]Bumping
[doublepost=1597843084][/doublepost]Bumping, again
 
  1. on player world change:
  2. if player is in the world "pvp":
  3. loop 1000 times:
  4. wait 50 seconds
  5. make console execute "give %player% stick 1"
  6. wait 50 seconds
  7. make console execute "give %player% iron_ingot 1"
  8. wait 50 seconds
  9. make console execute "give %player% iron_ingot 1"
  10. if the player is not in the world "pvp":
  11. stop

[doublepost=1597873056,1597872998][/doublepost]juse use stop not exit loops
 



    • on player world change:
    • if player is in the world "pvp":
    • loop 1000 times:
    • wait 50 seconds
    • make console execute "give %player% stick 1"
    • wait 50 seconds
    • make console execute "give %player% iron_ingot 1"
    • wait 50 seconds
    • make console execute "give %player% iron_ingot 1"
    • if the player is not in the world "pvp":
    • stop
[doublepost=1597873056,1597872998][/doublepost]juse use stop not exit loops
(I had troubles finding where to put it) It's working now. Thanks!
 
Status
Not open for further replies.