Loop Values

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

Juan7030

Member
Mar 20, 2017
13
0
0
30
Error:
Code:
[15:36:21 ERROR]: loop-value-2 can't have anything added to it (fortnite.sk, line 233: give 1 wooden sword named "&bEspada de Madera" with lore "&7Con esto tienes ya algo con que matar!" to loop-value-2')
[15:36:21 ERROR]: loop-value-2 can't have anything added to it (fortnite.sk, line 234: give 1 wooden pickaxe named "&bPico de Madera" with lore "&7Con esto tienes ya algo con que picar piedra!" to loop-value-2')
[15:36:21 ERROR]: loop-value-2 can't have anything added to it (fortnite.sk, line 235: give 1 wooden axe named "&bHacha de Madera" with lore "&7Con esto tienes ya algo con que talar madera!" to loop-value-2')

Skript:
Code:
loop {arena.starttime} times: (This is other code, but is a loop in the same line.)

if {arena.status} is "Ingame.":
                    loop {arena.players.playing::*}:
                        if {arena.playerplaying.%loop-value-2%} is set:
                            teleport loop-value-2 to {arena.enderspawncoords}
                            make loop-value-2 execute command "/pet bat"
                            wait 2 ticks
                            make loop-value-2 execute command "/pet ride"
                            set gamemode of loop-value-2 to Adventure
                            give 1 wooden sword named "&bEspada de Madera" with lore "&7Con esto tienes ya algo con que matar!" to loop-value-2
                            give 1 wooden pickaxe named "&bPico de Madera" with lore "&7Con esto tienes ya algo con que picar piedra!" to loop-value-2
                            give 1 wooden axe named "&bHacha de Madera" with lore "&7Con esto tienes ya algo con que talar madera!" to loop-value-2
                            stop

Help please <3
 
Abusing of variables like that will end up very bad. Here some tips:
  • Never use {this.format}, it doesn't cause more than issues.
  • instead of having a variable that checks if they're playing ({arena.playerplaying.%player%}) and a variable that stores all the players playing ({arena.players.playing::*}), you could have a single var such as: {arena::emoji_stuck_out_tongue:layer::%player%} (set to the player of course) and then if you want give all the players playing something, you could do:
    code_language.skript:
    give 1 wooden axe to {arena::player::*}
    And if you want check whether a player is playing you can do:
    code_language.skript:
    if {arena::player::%player%} is set: # of course, you have to delete it when the player is not playing anymore or this wouldn't work otherwise
 
Last edited:
Status
Not open for further replies.