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

The script suddenly stops, and doesn't loop around?

I am following a ROBLOX tutorial for a section of my main Game script, and noticed that the script stops and doesn't have any errors as well. It does fine, until this part. Then it stops and doesn't loop back around or anything. Please help.

EDIT: There's a loop after this one. That's what the break is for. But it won't go onto the next one after the break.

	while true do
		
		wait()
		
		contestants = {}
		
		for _, child in pairs(Players:GetChildren()) do
			if child and child.Character then
				local ready = child:findFirstChild("Ready")
				local hum = child.Character:findFirstChild("Humanoid")
				if hum and hum.Health > 0 and ready and ready == true then
					table.insert(contestants, child)
				end
			end
		end
		
		
		if #contestants >= 3 then
			break
		else
		end
	end

2 comments

0

That's what break does

0

But it doesn't go onto the next loop. It just ends

1 answer

function FunctionName()
	-- Loop here
end

while true do

    wait()

    contestants = {}

    for _, child in pairs(Players:GetChildren()) do
        if child and child.Character then
            local ready = child:findFirstChild("Ready")
            local hum = child.Character:findFirstChild("Humanoid")
            if hum and hum.Health > 0 and ready and ready == true then
                table.insert(contestants, child)
            end
        end
    end


    if #contestants >= 3 then
	FunctionName()
        break
    else
    end
end

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