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

How to make it so that a loop executes every so seconds and doesn't wait for previous loop?

I'm trying this loop that executes a function that makes a brick invisible

local parts = script.Parent:GetChildren()


local function blink(part)
	if part:IsA("BasePart") then
		for transparency = 0, 1, 0.2 do
			part.Transparency = part.Transparency + 0.2
			if part.Transparency == 1 then
				part.CanCollide = false
				wait(2)
				part.Transparency = 0
				part.CanCollide = true
				break
			end
			wait(1)
		end
	end
end

while true do
	for i, v in ipairs(parts) do
		blink(v)
	end
end

It does go through every child in parts but it only works on one brick each time. I would like to know how to make a brick start turning invisible every so seconds instead of having it wait until the part is done executing the function

1 answer

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