function placeBrick(h,F,m)local T=Instance.new("\080\097\114\116")T.BrickColor=m T.CFrame=h*CFrame.new(F+T.size/2)T.Parent=script.Parent.Bricks T:makeJoints()return T,F+T.size end function buildWall(h)local F=BrickColor.random()local m={}assert(wallWidth>0)local T=0 while T<wallHeight do local l local N=-wallWidth/2 while N<wallWidth/2 do local a a,l=placeBrick(h,Vector3.new(N,T,0),F)N=l.x table.insert(m,a)wait(brickSpeed)end T=l.y end wait(wallLifetime)while#m>0 do(table.remove(m)):Remove()task.wait(brickSpeed/2)end end script.Parent.ChildAdded:connect(function(h)if h.Name=="\078\101\119\087\097\108\108"then h:remove()buildWall(h.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()
		task.wait(brickSpeed/2)
	end

end

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