I have looked around on google, but most things that come up are just calculating volumes not generating them. I have found a way that works with all sizes. But I doubt it is the most simnple or cost effective ways to do it.
Here is my code:
local Volume = 20
local PartSize = 20
for Number = -Volume / 2, Volume / 2 do
for Number2 = -Volume / 2, Volume / 2 do
for Number3 = -Volume / 2, Volume / 2 do
if (Number / (Volume / 2)) % Volume == 1 or (-Number / (Volume / 2)) % Volume == 1 or (Number2 / (Volume / 2)) % Volume == 1 or (-Number2 / (Volume / 2)) % Volume == 1 or (Number3 / (Volume / 2)) % Volume == 1 or (-Number3 / (Volume / 2)) % Volume == 1 then
local Part = Instance.new("Part")
Part.CFrame = CFrame.new(Number * PartSize, Number2 * PartSize, Number3 * PartSize)
Part.Anchored = true
Part.Size = Vector3.new(PartSize, PartSize, PartSize)
Part.Parent = workspace.Terrain
end
end
end
wait()
end
I am wondering if anyone can help me shorten it as it is an eyesore.