Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why repeat wait() until is not working???

I make a mini game script that if have no players in the mini game, the timer stops and the message says "Time ended". But why its not working. I have a folder named "Ingame". The parent of this folder is workspace. It is working when the timer is 0 then it says times up but when the ingame is nil it not working and it is continued to countdown until it reaches 0 and disables the script of the timer. This is the part of my script that i mean.

local Time = game.ReplicatedStorage.Values:WaitForChild("Timer")
repeat
game.ServerScriptService.Time.TimeThreeMinutes.Disabled = false
wait()
until Time.Value == "0:00" or workspace.Ingame == nil
game.ServerScriptService.Time.TimeMinutes.Disabled = true
Status.Value = "Time's up"

Can you help me??

5 comments

0

Time.Value == "0:00", does that not seem a bit STRANGE

0

i mean i missed the variables

0

there edited

0

greatneil80 i think its supposed to be a string value that copies another value and translates it into time

0

No ^

1 answer

To check if a object exist, you actually should check its parent, due to way roblox removes objects - Ingame.Parent == nil The problem is that you are probably want to check number of children in that folder instead and not if the folder exists, cause that makes no sense. You can do it like this:

local Time = game.ReplicatedStorage.Values:WaitForChild("Timer")
repeat
game.ServerScriptService.Time.TimeThreeMinutes.Disabled = false
local children = workspace.Ingame:GetChildren()
wait()
until Time.Value == "0:00" or #children == 0
game.ServerScriptService.Time.TimeMinutes.Disabled = true
Status.Value = "Time's up"

This discussion is preserved as it was. New answers, comments, and votes are closed.