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 :)

2 comments

0

Please put your code in a code block

0

Just check how many players are ingame within the loop or something