Hello! I am trying to create a script that generates a “chunk” of terrain data and then loading it using Terrain:WriteVoxelChannels()
Now, the issue is that, when I’m trying to “fill one block”, an entire slice becomes filled. I have no idea why this happens.
I have searched for this issue on devforums and even checked out the docs for guidance, but I still haven’t been able to fix this issue.
Here’s my code:
Script 1
return function(Size)
local materials = table.create(Size, table.create(Size, table.create(Size, Enum.Material.Grass)))
local solidOcc = table.create(Size, table.create(Size, table.create(Size, 0)))
local waterOcc = table.create(Size, table.create(Size, table.create(Size, 0)))
solidOcc[1][3][4] = 1
--End
return {SolidMaterial=materials, SolidOccupancy = solidOcc, LiquidOccupancy = waterOcc}
end
Script 2
local voxelchann = chunkGenerator(10)
local reg = Region3.new(Vector3.zero, Vector3.one * 40)
workspace.Terrain:WriteVoxelChannels(reg, 4, voxelchann)
chunkGenerator is the function from above
If someone could help me on this, I’d appreciate it alot!