Hey guys. Got a bit advanced question!
Let me paste the script first Script /
while true do
wait(5)
if #game.Workspace.Lobby:GetChildren() >= 1 then
TeleportPlayers()
wait(1)
spawn(function()
GameModules.Mode1()
repeat
wait(1)
until #game.Workspace.InGame:GetChildren() == 1 and GameModules.GameOver == true
Surviver = game.Workspace.InGame:FindFirstChildOfClass('StringValue')
print('Stopped ',Surviver)
end)
elseif #game.Workspace.Lobby:GetChildren() <= 2 then
print('Not enough players in-Lobby (',#game.Workspace.Lobby:GetChildren(),')')
end
end
ModuleScript /
local GameModes = {}
GameOver = false
function GameModes.Mode1()
print('Mode1')
spawn(function(CountDown)
for i=6,0,-1 do
wait(1)
print(i,' Seconds remaining')
end
end)
wait(15)
end
return GameModes
I want to normal script to wait UNTIL the ModuleScript has finished (after waiting 15 seconds) before the script continues.
I attempted this by doing 'until #game.Workspace.InGame:GetChildren() == 1 and GameModules.GameOver == true'
Is it not waiting because of the Spawn(Function())?

1 comment
spawn creates a seprerate thread, so GameModules.Mode1() will only yeild the spawned thread not the whole script.