Loop

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

KeinMiner

Member
Jan 15, 2019
3
0
0
33
Hello. I have a Problem i want to make a Rainbow wool that is on your head and this is the code


if arg 1 is "White woole":
equip player with White wool
send "&cR&6e&eg&2e&3n&1b&5o&cg&6e&en &2W&3o&1l&5l&ce &7gewählt"
wait 10 tick
loop 10000000000000000000000 times:
equip palyer with 35:1
wait 10 tick
equip player with 35:5
wait 10 tick
equip player with 35:4
wait 10 tick
equip player with 35:3
wait 10 tick
equip player with 35:2
wait 10 tick
equip player with 35:9
wait 10 tick
equip player with 35:

my problem now is i want to make more hats but everytime i equip the other hat the rainbow wool comes because of the loop how can i cancel the loop by executing an other command like if i equip the Wool and then an other hat the loop stops. thanks for your help
 
I would recommend using a while loop rather than looping 10000000000000000000000 times
code_language.skript:
while <condition>:
    <code>
 
I would recommend using a while loop rather than looping 10000000000000000000000 times
code_language.skript:
while <condition>:
    <code>
What do i enter in the condition part ?

because this isnt working
command /hut [<text>]:
trigger:
if arg 1 is "Melone":
equip player with melon block
send "{@Hüte} Du hast den Hut &8'&9%arg 1%&8' &7gewählt"
if arg 1 is "Taucher":
equip player with glass
send "{@Hüte} Du hast den Hut &8'&9%arg 1%&8' &7gewählt"
while arg 1 is "Stein":
equip player with White wool
wait 10 tick
equip palyer with 35:1
wait 10 tick
equip player with 35:5
wait 10 tick
equip player with 35:4
wait 10 tick
equip player with 35:3
wait 10 tick
equip player with 35:2
wait 10 tick
equip player with 35:9
wait 10 tick
equip player with 35:1
 
Last edited:
while true:
The thing is now my code looks so

command /hut [<text>]:
trigger:
if arg 1 is "Melone":
equip player with melon block
send "{@Hüte} Du hast den Hut &8'&9%arg 1%&8' &7gewählt"
if arg 1 is "Taucher":
equip player with glass
send "{@Hüte} Du hast den Hut &8'&9%arg 1%&8' &7gewählt"
while true:
equip player with White wool
wait 10 tick
equip palyer with 35:1
wait 10 tick
equip player with 35:5
wait 10 tick
equip player with 35:4
wait 10 tick
equip player with 35:3
wait 10 tick
equip player with 35:2
wait 10 tick
equip player with 35:9
wait 10 tick
equip player with 35:1

and when i try to put one of the other hats on the loop will goes on like first i put on the wool and then the melon the melon appears for a second and then the wool again
 
I´d just set a variable to true and add a condition to the while loop so it just changes the hat when you want it to.
 
Status
Not open for further replies.