Hi all, I'm trying to read the material of terrain in a region that follows a player's vehicle, and I have a few small parts to set region boundaries to keep the script simple but no matter whether I have the parts or not the script always returns the error "Region cannot be empty" Any help?
while wait(2) do
local region = Region3.new(Vector3.new(script.Parent.Region1.Position), Vector3.new(script.Parent.Region2.Position))
region = region:ExpandToGrid(4)
local material, occupancy = game.Workspace.Terrain:ReadVoxels(region, 4)
local size = material.Size
for x = 1, size.X do
for y = 1, size.Y do
for z = 1, size.Z do
print("Material at (", x, y, z, "): ", material[x][y][z])
print("Occupancy at (", x, y, z, "): ", occupancy[x][y][z])
print(script.Parent:GetBoundingBox().p)
end
end
end
end

2 comments
I still get the "Region cannot be empty" error at line 5