local K=5000 local V={}local S={}local e=Instance.new("\077\111\100\101\108",workspace)e.Name="\116\114\105\066\105\110\067\111\110\116\097\105\110\101\114"function V.add(K)if not K then K=Instance.new("\087\101\100\103\101\080\097\114\116")end K.Anchored=true K.CanCollide=true K.TopSurface=0 K.BottomSurface=0 K.Size=Vector3.new(5,5,5)K.CFrame=CFrame.new(0,-500,0)K.Parent=e S[#S+1]=K end function V.get()local K=S[1]table.remove(S,1)if#S==0 then fillBuffer()end return K end function V.recycle(K)K.Transparency=0 K.Material="\083\109\111\111\116\104\080\108\097\115\116\105\099"V.add(K)end function fillBuffer()for K=#S,K,1 do V.add()end end fillBuffer()return V
--Preemptively adds triangles to the world and reuses them to reduce load
local buffer = 5000
local TriStorage = {}
local tris = {}

local container = Instance.new("Model", workspace)
container.Name = "triBinContainer"

function TriStorage.add(tri)
	if not tri then
		tri = Instance.new("WedgePart")
	end
	
	tri.Anchored = true
	tri.CanCollide = true
	tri.TopSurface = 0
	tri.BottomSurface = 0
	tri.Size = Vector3.new(5, 5, 5)
	tri.CFrame = CFrame.new(0, -500, 0)
	tri.Parent = container
	
	tris[#tris+1] = tri
end

function TriStorage.get()
	local tri = tris[1]
	table.remove(tris, 1)
	
	if #tris == 0 then
		fillBuffer()
	end
	
	return tri
end

function TriStorage.recycle(tri)
	tri.Transparency = 0
	tri.Material = "SmoothPlastic"
	
	TriStorage.add(tri)
end

function fillBuffer()
	for i = #tris, buffer do
		TriStorage.add()
	end
end

fillBuffer()

return TriStorage