UevKF8zjRV_WEtpJsXhr
We use cookies on this site to enhance your user experience

Issue: The last path piece doesn’t disappear.

  • Check that there is a short wait between the two for loops. If not there, once the last piece disappears, the entire path will instantly reappear.

Issue: Script crashes or has errors running.

  • Check that both for loops are between while true do and the last end.

Optional Challenge

Challenge: Add more than six parts into the Parts folder and pathArray. Check that the code works as intended.


Finished Project Sample

Project File

Download the finished project here

Finished Script

local path = script.Parent
local partsFolder = path.Parts

local disappearRate = 1

local pathArray = {
	partsFolder.Part1,
	partsFolder.Part2,
	partsFolder.Part3
}

while true do
	-- Make a part disappear from the array in order
	for partIndex = 1, #pathArray  do
		wait(disappearRate)
		local whichPart = pathArray[partIndex]
		whichPart.CanCollide = false
		whichPart.Transparency = 1
	end
	
	-- Wait for a second before making the path reappear
	wait(1)

	-- Reset the path by making all parts walkable again
	for partIndex = 1, #pathArray do
		local whichPart = pathArray[partIndex]
		whichPart.CanCollide = true
		whichPart.Transparency = 0
	end
end