for j,H in pairs(model:GetChildren())do if string.sub(H.Name,1,1)=="\097"then table.insert(a,1,H)end end for j,H in pairs(model:GetChildren())do if string.sub(H.Name,1,1)=="\098"then table.insert(b,1,H)end end for j,H in pairs(model:GetChildren())do if string.sub(H.Name,1,1)=="\099"then table.insert(c,1,H)end end for j,H in pairs(model:GetChildren())do if string.sub(H.Name,1,1)=="\100"then table.insert(d,1,H)end end for j,H in pairs(model:GetChildren())do if string.sub(H.Name,1,1)=="\101"then table.insert(e,1,H)end end for j,H in pairs(model:GetChildren())do if string.sub(H.Name,1,1)=="\102"then table.insert(f,1,H)end end function on(j)for j,H in pairs(j)do if H:FindFirstChild("\083\117\114\102\097\099\101\076\105\103\104\116")then H.SurfaceLight.Enabled=true end if H:FindFirstChild("\083\112\111\116\076\105\103\104\116")then H.SpotLight.Enabled=true end end end function off(j)for j,H in pairs(j)do if H:FindFirstChild("\083\117\114\102\097\099\101\076\105\103\104\116")then H.SurfaceLight.Enabled=false end if H:FindFirstChild("\083\112\111\116\076\105\103\104\116")then H.SpotLight.Enabled=false end end end function run()off(a)off(b)off(c)off(d)off(e)off(f)if pattern=="\070\108\097\115\104"then repeat local j=.45 off(c)off(d)on(a)on(b)on(e)on(f)wait(j)off(a)off(b)off(e)off(f)on(c)on(d)wait(j)until pattern~="\070\108\097\115\104"return end if pattern=="\076\101\102\116"then repeat local j=.15 on(f)wait(j)on(e)wait(j)on(d)wait(j)on(c)wait(j)on(b)wait(j)on(a)wait(j)off(f)wait(j)off(e)wait(j)off(d)wait(j)off(c)wait(j)off(b)wait(j)off(a)wait(j)until pattern~="\076\101\102\116"return end if pattern=="\082\105\103\104\116"then repeat local j=.15 on(a)wait(j)on(b)wait(j)on(c)wait(j)on(d)wait(j)on(e)wait(j)on(f)wait(j)off(a)wait(j)off(b)wait(j)off(c)wait(j)off(d)wait(j)off(e)wait(j)off(f)wait(j)until pattern~="\082\105\103\104\116"return end if pattern=="\083\112\108\105\116"then repeat local j=.2 on(c)on(d)wait(j)on(b)on(e)wait(j)on(a)on(f)wait(j)off(c)off(d)wait(j)off(b)off(e)wait(j)off(a)off(f)wait(j)until pattern~="\083\112\108\105\116"return end end

for i,part in pairs(model:GetChildren()) do
	if string.sub(part.Name, 1,1) == "a" then
		table.insert(a, 1, part)
	end
end
for i,part in pairs(model:GetChildren()) do
	if string.sub(part.Name, 1,1) == "b" then
		table.insert(b, 1, part)
	end
end
for i,part in pairs(model:GetChildren()) do
	if string.sub(part.Name, 1,1) == "c" then
		table.insert(c, 1, part)
	end
end
for i,part in pairs(model:GetChildren()) do
	if string.sub(part.Name, 1,1) == "d" then
		table.insert(d, 1, part)
	end
end
for i,part in pairs(model:GetChildren()) do
	if string.sub(part.Name, 1,1) == "e" then
		table.insert(e, 1, part)
	end
end
for i,part in pairs(model:GetChildren()) do
	if string.sub(part.Name, 1,1) == "f" then
		table.insert(f, 1, part)
	end
end

function on(T)
	for i, part in pairs (T) do
		if part:FindFirstChild("SurfaceLight") then
			part.SurfaceLight.Enabled = true
		end
	    if part:FindFirstChild("SpotLight") then
			part.SpotLight.Enabled = true
		end
	end
end

function off(T)
	for i, part in pairs (T) do
		if part:FindFirstChild("SurfaceLight") then
			part.SurfaceLight.Enabled = false
		end
	    if part:FindFirstChild("SpotLight") then
			part.SpotLight.Enabled = false
		end
	end
end

function run() --mian

	off(a)--turns all lights off
	off(b)
	off(c)
	off(d)
	off(e)
	off(f)

	if pattern == "Flash" then
		repeat
			local w = 0.45
			off(c)
			off(d)
			on(a)
			on(b)
			on(e)
			on(f)
			wait(w)
			
			off(a)
			off(b)
			off(e)
			off(f)
			on(c)
			on(d)
			wait(w)
		
		until pattern ~= "Flash"
		return
	end

	if pattern == "Left" then
		repeat
		local w = 0.15
		on(f)
		wait(w)
		on(e)
		wait(w)
		on(d)
		wait(w)
		on(c)
		wait(w)
		on(b)
		wait(w)
		on(a)
		wait(w)
		
		off(f)
		wait(w)
		off(e)
		wait(w)
		off(d)
		wait(w)
		off(c)
		wait(w)
		off(b)
		wait(w)
		off(a)
		wait(w)
		until pattern ~= "Left"
		return
	end
	
	if pattern == "Right" then
		repeat
		local w = 0.15
		on(a)
		wait(w)
		on(b)
		wait(w)
		on(c)
		wait(w)
		on(d)
		wait(w)
		on(e)
		wait(w)
		on(f)
		wait(w)
		
		off(a)
		wait(w)
		off(b)
		wait(w)
		off(c)
		wait(w)
		off(d)
		wait(w)
		off(e)
		wait(w)
		off(f)
		wait(w)
		until pattern ~= "Right"
		return
	end
	
	if pattern == "Split" then
		repeat
		local w = 0.2
		on(c)
		on(d)
		wait(w)
		on(b)
		on(e)
		wait(w)
		on(a)
		on(f)
		wait(w)
		
		off(c)
		off(d)
		wait(w)
		off(b)
		off(e)
		wait(w)
		off(a)
		off(f)
		wait(w)
		until pattern ~= "Split"
		return
	end
end--run end