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

how to excute multiple parts at the same time ?


local ye = true

function disapper (part)
	part.CanCollide = false
	part.Transparency = 1
end

function apper (part)
	part.CanCollide = true
	part.Transparency = 0
end


function excute (yes, parts)
	if yes then
		while true do
			disapper(parts)
			wait(4)
			apper(parts)
			wait(4)
		end
	else
		while true do
			apper(parts)
			wait(4)
			disapper(parts)
			wait(4)
		end
	end
end

local a = game.Workspace:GetChildren()


for i,v in pairs(a) do
	if string.match(v.Name,'dis') then
		if i % 2 == 0 then
			excute(ye,v)
		else
			
		end
	end
end


so lets say there are 8 parts that called disappering platform i want every even ones to disapper at the same time then the other 4 disapper at the same time but in this scrpit it only excute 1 at a time so first one goes after 8 sec the other goes i want all the first 4 to go toghter at the same time plz help

1 answer

local ye = true

function disapper(part)
	part.CanCollide = false
	part.Transparency = 1
end

function apper(part)
	part.CanCollide = true
	part.Transparency = 0
end


function excute(yes, parts)
	if yes then
		task.spawn(function()
			while true do
				disapper(parts)
				task.wait(4)
				apper(parts)
				task.wait(4)
			end
		end)
	else
		task.spawn(function()
			while true do
				apper(parts)
				task.wait(4)
				disapper(parts)
				task.wait(4)
			end
		end)
	end
end

local a = game.Workspace:GetChildren()


for i,v in pairs(a) do
	if string.match(v.Name,'dis') then
		if i % 2 == 0 then
			ye = true
			excute(ye,v)
		else
			ye = false
			excute(ye,v)
		end
	end
end


i got it nvm thx

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