--[[
Creates a barrier.
--]]


return function(CenterCF,Parent)
	--Create the container.
	local Container = Instance.new("Model")
	Container.Name = "Barrier"
	Container.Parent = Parent
	
	--Create the anchor parts.
	local Anchor1 = CreateAnchorPart(Vector3.new(2,1,2),CenterCF * CFrame.new(0,1.5,-11),Container)
	local Anchor2 = CreateAnchorPart(Vector3.new(2,1,2),CenterCF * CFrame.new(0,-0.5,-5),Container)
	local Anchor3 = CreateAnchorPart(Vector3.new(2,1,2),CenterCF * CFrame.new(0,-0.5,5),Container)
	local Anchor4 = CreateAnchorPart(Vector3.new(2,1,2),CenterCF * CFrame.new(0,1.5,11),Container)
	
	--Create the first layer of the barrier.
	local Layer1Part1 = CreateLowerWallPart(Vector3.new(2,1,6),CenterCF * CFrame.new(0,0.5,-3),Container)
	local Layer1Part2 = CreateLowerWallPart(Vector3.new(2,1,6),CenterCF * CFrame.new(0,0.5,3),Container)
	WeldBetween(Anchor2,Layer1Part1)
	WeldBetween(Anchor3,Layer1Part2)
	
	--Create the second layer of the barrier.
	local Layer2Part1 = CreateLowerWallPart(Vector3.new(4,1,6),CenterCF * CFrame.new(0,1.5,-6),Container)
	local Layer2Part2 = CreateLowerWallPart(Vector3.new(4,1,6),CenterCF * CFrame.new(0,1.5,0),Container)
	local Layer2Part3 = CreateLowerWallPart(Vector3.new(4,1,6),CenterCF * CFrame.new(0,1.5,6),Container)
	WeldBetween(Layer1Part1,Layer2Part1)
	WeldBetween(Layer1Part1,Layer2Part2)
	WeldBetween(Layer1Part2,Layer2Part2)
	WeldBetween(Layer1Part2,Layer2Part3)
	
	--Create the third layer of the barrier.
	local Layer3Part1 = CreateLowerWallPart(Vector3.new(4,1,6),CenterCF * CFrame.new(0,2.5,-9),Container)
	local Layer3Part2 = CreateLowerWallPart(Vector3.new(4,1,6),CenterCF * CFrame.new(0,2.5,-3),Container)
	local Layer3Part3 = CreateLowerWallPart(Vector3.new(4,1,6),CenterCF * CFrame.new(0,2.5,3),Container)
	local Layer3Part4 = CreateLowerWallPart(Vector3.new(4,1,6),CenterCF * CFrame.new(0,2.5,9),Container)
	WeldBetween(Anchor1,Layer3Part1)
	WeldBetween(Layer2Part1,Layer3Part1)
	WeldBetween(Layer2Part1,Layer3Part2)
	WeldBetween(Layer2Part2,Layer3Part2)
	WeldBetween(Layer2Part2,Layer3Part3)
	WeldBetween(Layer2Part3,Layer3Part3)
	WeldBetween(Layer2Part3,Layer3Part4)
	WeldBetween(Anchor4,Layer3Part4)
	
	--Create the fourth layer of the barrier.
	local Layer4Part1 = CreateLowerWallPart(Vector3.new(2,1,6),CenterCF * CFrame.new(0,3.5,-9),Container)
	local Layer4Part2 = CreateLowerWallPart(Vector3.new(2,1,6),CenterCF * CFrame.new(0,3.5,-3),Container)
	local Layer4Part3 = CreateLowerWallPart(Vector3.new(2,1,6),CenterCF * CFrame.new(0,3.5,3),Container)
	local Layer4Part4 = CreateLowerWallPart(Vector3.new(2,1,6),CenterCF * CFrame.new(0,3.5,9),Container)
	WeldBetween(Layer3Part1,Layer4Part1)
	WeldBetween(Layer3Part2,Layer4Part2)
	WeldBetween(Layer3Part3,Layer4Part3)
	WeldBetween(Layer3Part4,Layer4Part4)
	
	--Create the fifth layer of the barrier.
	local Layer5Part1 = CreateLowerWallPart(Vector3.new(2,1,6),CenterCF * CFrame.new(0,4.5,-9),Container)
	local Layer5Part2 = CreateLowerWallPart(Vector3.new(2,1,6),CenterCF * CFrame.new(0,4.5,-3),Container)
	local Layer5Part3 = CreateLowerWallPart(Vector3.new(2,1,6),CenterCF * CFrame.new(0,4.5,3),Container)
	local Layer5Part4 = CreateLowerWallPart(Vector3.new(2,1,6),CenterCF * CFrame.new(0,4.5,9),Container)
	WeldBetween(Layer4Part1,Layer5Part1)
	WeldBetween(Layer4Part2,Layer5Part2)
	WeldBetween(Layer4Part3,Layer5Part3)
	WeldBetween(Layer4Part4,Layer5Part4)
	
	--Create the sixth layer of the barrier.
	local Layer6Part1 = CreateLowerWallPart(Vector3.new(2,1,6),CenterCF * CFrame.new(0,5.5,-8),Container)
	local Layer6Part2 = CreateLowerWallPart(Vector3.new(2,1,6),CenterCF * CFrame.new(0,5.5,8),Container)
	WeldBetween(Layer5Part1,Layer6Part1)
	WeldBetween(Layer5Part2,Layer6Part1)
	WeldBetween(Layer5Part3,Layer6Part2)
	WeldBetween(Layer5Part4,Layer6Part2)
	
	--Create the seventh layer of the barrier.
	local Layer7Part1 = CreateLowerWallPart(Vector3.new(2,1,6),CenterCF * CFrame.new(0,6.5,-7),Container)
	local Layer7Part2 = CreateLowerWallPart(Vector3.new(2,1,6),CenterCF * CFrame.new(0,6.5,7),Container)
	WeldBetween(Layer6Part1,Layer7Part1)
	WeldBetween(Layer6Part2,Layer7Part2)
	
	--Create the eigth layer of the barrier.
	local Layer8Part1 = CreateLowerWallPart(Vector3.new(2,1,6),CenterCF * CFrame.new(0,7.5,-8),Container)
	local Layer8Part2 = CreateLowerWallPart(Vector3.new(2,1,6),CenterCF * CFrame.new(0,7.5,8),Container)
	WeldBetween(Layer7Part1,Layer8Part1)
	WeldBetween(Layer7Part2,Layer8Part2)
	
	--Create the nineth layer of the barrier.
	local Layer9Part1 = CreateLowerWallPart(Vector3.new(2,1,6),CenterCF * CFrame.new(0,8.5,-9),Container)
	local Layer9Part2 = CreateLowerWallPart(Vector3.new(2,1,6),CenterCF * CFrame.new(0,8.5,9),Container)
	WeldBetween(Layer8Part1,Layer9Part1)
	WeldBetween(Layer8Part2,Layer9Part2)
	
	--Create the tenth layer of the barrier.
	local Layer10Part1 = CreateMiddleWallPart(Vector3.new(4,1,8),CenterCF * CFrame.new(0,9.5,-9),Container)
	local Layer10Part2 = CreateMiddleWallPart(Vector3.new(4,1,8),CenterCF * CFrame.new(0,9.5,9),Container)
	WeldBetween(Layer9Part1,Layer10Part1)
	WeldBetween(Layer9Part2,Layer10Part2)
	
	--Create the eleventh layer of the barrier.
	local Layer11Part1 = CreateMiddleWallPart(Vector3.new(4,1,8),CenterCF * CFrame.new(0,10.5,-7),Container)
	local Layer11Part2 = CreateMiddleWallPart(Vector3.new(4,1,8),CenterCF * CFrame.new(0,10.5,7),Container)
	WeldBetween(Layer10Part1,Layer11Part1)
	WeldBetween(Layer10Part2,Layer11Part2)
	
	--Create the twelveth layer of the barrier.
	local Layer12Part1 = CreateMiddleWallPart(Vector3.new(4,1,8),CenterCF * CFrame.new(0,11.5,-4),Container)
	local Layer12Part2 = CreateMiddleWallPart(Vector3.new(4,1,8),CenterCF * CFrame.new(0,11.5,4),Container)
	WeldBetween(Layer11Part1,Layer12Part1)
	WeldBetween(Layer11Part2,Layer12Part2)
	
	--Create the thirteenth layer of the barrier.
	local Layer13Part1 = CreateMiddleWallPart(Vector3.new(4,1,6),CenterCF * CFrame.new(0,12.5,-3),Container)
	local Layer13Part2 = CreateMiddleWallPart(Vector3.new(4,1,6),CenterCF * CFrame.new(0,12.5,3),Container)
	WeldBetween(Layer12Part1,Layer13Part1)
	WeldBetween(Layer12Part2,Layer13Part2)
	
	--Create the fourteenth layer of the barrier.
	local Layer14Part1 = CreateTopWallPart(Vector3.new(2,1,3),CenterCF * CFrame.new(0,13.5,-3.5),Container)
	local Layer14Part2 = CreateTopWallPart(Vector3.new(2,1,4),CenterCF * CFrame.new(0,13.5,0),Container)
	local Layer14Part3 = CreateTopWallPart(Vector3.new(2,1,3),CenterCF * CFrame.new(0,13.5,3.5),Container)
	WeldBetween(Layer13Part2,Layer14Part1)
	WeldBetween(Layer13Part1,Layer14Part2)
	WeldBetween(Layer13Part2,Layer14Part2)
	WeldBetween(Layer13Part2,Layer14Part3)
	
end