[Fixed!] Script not seeming to wait for "wait()" function

Hello! I am currently working on a mini-project game and I’m having a scripting issue.


Solution: Script changes were not applying correctly so I had to restart studio.


For some reason I ask the script to wait(20) and it doesn’t seem to do so.

I’m having the issue in this game I’m working on (see this post for more info) and I want the screen to display the status “Mom wins! Mom has found all the children!” and then wait 20 seconds before reloading all of the characters.

if TimeOut == true then
	GameInfo.Status.Value = "Time up, mom couldn't find all the children!"
elseif #Children == 0 then
	GameInfo.Status.Value = "Mom wins! Mom has found all the children!"
elseif Mom == nil then
	GameInfo.Status.Value = "Round over, mom has left the game"
end
		
for i, Child in pairs(Children) do
	table.remove(Children, i)
end

wait(20)
for i, Player in pairs(Players:GetPlayers()) do
	Player.Team = Teams.InLobby
	Player:LoadCharacter()
end

Instead of the game waiting the 20 seconds. It instantly reloads all of the characters after saying “Mom wins! Mom has found all the children!” for less than a second.

I’m having a lot of trouble fixing this and I hope that I can find a solution.

Please and thank you.

1 Like

Remove the post if you have solved it, or edit the solution in

2 Likes