function placeBrick(k,h,M)local c=Instance.new("\080\097\114\116")c.BrickColor=M c.CFrame=k*CFrame.new(h+c.size/2)c.Parent=script.Parent.Bricks c:makeJoints()return c,h+c.size end function buildWall(k)local h=BrickColor.random()local M={}assert(wallWidth>0)local c=0 while c<wallHeight do local Z local q=-wallWidth/2 while q<wallWidth/2 do local Q Q,Z=placeBrick(k,Vector3.new(q,c,0),h)q=Z.x table.insert(M,Q)wait(brickSpeed)end c=Z.y end wait(wallLifetime)while#M>0 do(table.remove(M)):remove()wait(brickSpeed/2)end end script.Parent.ChildAdded:connect(function(k)if k.Name=="\078\101\119\087\097\108\108"then k:remove()buildWall(k.Value)end end)

function placeBrick(cf, pos, color)
	local brick = Instance.new("Part")
	brick.BrickColor = color
	brick.CFrame = cf * CFrame.new(pos + brick.size / 2)
	brick.Parent = script.Parent.Bricks
	brick:makeJoints()
	return  brick, pos +  brick.size
end

function buildWall(cf)

	local color = BrickColor.random()
	local bricks = {}

	assert(wallWidth>0)
	local y = 0
	while y < wallHeight do
		local p
		local x = -wallWidth/2
		while x < wallWidth/2 do
			local brick
			brick, p = placeBrick(cf, Vector3.new(x, y, 0), color)
			x = p.x
			table.insert(bricks, brick)
			wait(brickSpeed)
		end
		y = p.y
	end

	wait(wallLifetime)

	-- now delete them!
	while #bricks>0 do
		table.remove(bricks):remove()
		wait(brickSpeed/2)
	end

end

script.Parent.ChildAdded:connect(function(item)
	if item.Name=="NewWall" then
		item:remove()
		buildWall(item.Value)
	end
end)
