Solved How to loop all players at the same time?

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

FishRekt

Active Member
Jan 26, 2017
87
0
0
25
Hi guys. I'm ""new"" at scripting, and i'm here because i need help. I made a speedrun skript, where the players, with a command, are teleported in a location. The problem is that the "loop all players" doesn't work at the same time, because it teleports all players one by one, doing the trigger of a command one player by one. Here's the command line:

command /speedrun [<text>] [<text>]:
permission: sr.admin
permission message: &cYou don't have enough permissions for that!
description: speedrun plugin made by LoryWasHere
trigger:
if arg-1 is "forcestart":
loop all players:
teleport loop-player to {lol}
send "&9SpeedRun>&7 SpeedRun scripted by LoryWasHere has started!" to loop-player
set block at {location1} to fence
set block at {location2} to fence
set block at {location3} to fence
set block at {location4} to fence
set block at {location5} to fence
wait 2 seconds
play sound "NOTE_PLING" to loop-player with volume 1 and pitch 2
send "&9SpeedRun>&a The game will start soon: 5" to loop-player
wait 1 second
play sound "NOTE_PLING" to loop-player with volume 1 and pitch 2
send "&9SpeedRun>&a The game will start soon: 4" to loop-player
wait 1 second
play sound "NOTE_PLING" to loop-player with volume 1 and pitch 2
send "&9SpeedRun>&a The game will start soon: 3" to loop-player
wait 1 second
play sound "NOTE_PLING" to loop-player with volume 1 and pitch 1.5
send "&9SpeedRun>&a The game will start soon: 2" to loop-player
wait 1 second
play sound "NOTE_PLING" to loop-player with volume 1 and pitch 1
send "&9SpeedRun>&a The game will start soon: 1" to loop-player
wait 1 second
play sound "LEVEL_UP" to loop-player with volume 1 and pitch 1
send "&9SpeedRun>&a The game has just started! ENJOY!" to loop-player
set block at {location1} to air
set block at {location2} to air
set block at {location3} to air
set block at {location4} to air
set block at {location5} to air
apply speed 10 to loop-player for 999 days
if arg-1 is "set":
if arg-2 is "location":
set {lol} to executor's location
send "&9SpeedRun>&7 You gave to players a new location to spawn!" to executor
if arg-1 is "delete":
loop all players:
delete {sr.gamestarted.%loop-player%}
delete {srjoinable}
send "&9SpeedRun>&7 You have delete successfully the player's location and the database!" to executor

The command is "forcestart". Please help me.
 
First of all, remove the bold font from the thread, it just hurts my eyes so hard. And for code, you should use codeblocks, like this:

[CODE]Your code here, as you can see[/CODE]

And it'll be showed as:
Code:
Your code here, as you can see
 
Okay, then you have a fix for this?

I'll put now the code:

Code:
command /speedrun [<text>] [<text>]:
    permission: sr.admin
    permission message: &cYou don't have enough permissions for that!
    description: speedrun plugin made by LoryWasHere
    trigger:
        if arg-1 is "forcestart":
            loop all players:
                teleport loop-player to {lol}
                send "&9SpeedRun>&7 SpeedRun scripted by LoryWasHere has started!" to loop-player
                set block at {location1} to fence
                set block at {location2} to fence
                set block at {location3} to fence
                set block at {location4} to fence
                set block at {location5} to fence
                wait 2 seconds
                play sound "NOTE_PLING" to loop-player with volume 1 and pitch 2
                send "&9SpeedRun>&a The game will start soon: 5" to loop-player
                wait 1 second
                play sound "NOTE_PLING" to loop-player with volume 1 and pitch 2
                send "&9SpeedRun>&a The game will start soon: 4" to loop-player
                wait 1 second
                play sound "NOTE_PLING" to loop-player with volume 1 and pitch 2
                send "&9SpeedRun>&a The game will start soon: 3" to loop-player
                wait 1 second
                play sound "NOTE_PLING" to loop-player with volume 1 and pitch 1.5
                send "&9SpeedRun>&a The game will start soon: 2" to loop-player
                wait 1 second
                play sound "NOTE_PLING" to loop-player with volume 1 and pitch 1
                send "&9SpeedRun>&a The game will start soon: 1" to loop-player
                wait 1 second
                play sound "LEVEL_UP" to loop-player with volume 1 and pitch 1
                send "&9SpeedRun>&a The game has just started! ENJOY!" to loop-player
                set block at {location1} to air
                set block at {location2} to air
                set block at {location3} to air
                set block at {location4} to air
                set block at {location5} to air
                apply speed 10 to loop-player for 999 days
        if arg-1 is "set":
            if arg-2 is "location":
                set {lol} to executor's location
                send "&9SpeedRun>&7 You gave to players a new location to spawn!" to executor
        if arg-1 is "delete":
            loop all players:
                delete {sr.gamestarted.%loop-player%}
                delete {srjoinable}
            send "&9SpeedRun>&7 You have delete successfully the player's location and the database!" to executor
 
Okay, then you have a fix for this?
You can try this:

code_language.skript:
command speedrun [<text>] [<text>]:
    permission: sr.admin
    permission message: <light red>You don't have enough permissions for that!
    description: speedrun script made by LoryWasHere #it's a script, not a plugin. Remember that.
    trigger:
        if arg-1 is "forcestart":
            teleport all players to {lol}
            send "<light blue>SpeedRun><grey> SpeedRun has started!" to all players
            loop 4 times:
                set block at {location%loop-num%} to fence
            wait 2 seconds
            loop 5 times:
                send "<light blue>SpeedRun><light green> The game will start soon: %6 - loop-num%" to all players
                play sound "NOTE_PLING" to all players with volume 1 and pitch 2
                wait 1 second
        play sound "LEVEL_UP" to all players with volume 1 and pitch 1
        send "<light blue>SpeedRun><light green> The game has just started! ENJOY!" to all players
        loop 5 times:
            set block at {location%loop-num%} to air
        apply speed to all players for 99 days


I know I'm spoonfeeding him but as he already had a base.
 
Status
Not open for further replies.