I'm trying to make a loop that creates parts and stops when there's 20 parts, but then continues again when there is less than 20 parts in the game.
while wait(.1) do local model = game.Workspace.Model local children = model:GetChildren() local part = Instance.new("Part") part.Parent = workspace.Model part.Position = Vector3.new(10,10,10) print(#children) if #children >= 20 then end end
Make a while loop that runs while the amount of children in the workspace is below 20.
Example:
while #workspace:GetChildren()) < 20 do -- Create parts here end