Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Returning to a loop once a player has left...?

Asked by 5 years ago
Edited 5 years ago

Wondering if there is a way to stop a function from running after it has been called...in my case I have a function that runs a loop until 2 players join the game before moving on with the rest of the function. Now say 1 of those 2 players leaves the game, I now want it to return to the loop and wait again for 2 people to be in the game.

while waiting == true do
    ToClient:FireAllClients('RequiredPlayers',true)
    if #Playing >= RequiredPlayers then
        waiting = false
        ToClient:FireAllClients('RequiredPlayers',false)
    end
    wait(1)
end

for T = IntermissionTime,0,-1 do
    ToClient:FireAllClients('IntermissionTimer',T)
    wait(1)
end

So, if a player would leave during the 15 second IntermissionTime time it would return back to the while loop...thats the idea.

Honestly while writing this i'm thinking I need to just come up with the logic to make that work, any ideas are appreciated :)

0
Please put your code in a code block User#19524 175 — 5y
0
Just check how many players are ingame within the loop or something User#22604 1 — 5y

Answer this question