Your code is throwing an error because your third argument in your call to FillRegion() is invalid. The third argument is supposed to be a Material enumeration.
The Region3 value is also incorrect because it has to be aligned with the voxel grid. A voxel is basically a 3d pixel and can be described as a cube. Roblox uses a voxel system for their terrain by basically filling these cubes with a material. Because you are filling terrain, your Region3 has to be aligned with the 3D voxel grid. This is what the function ExpandToGrid() is for.
The ExpandToGrid() function has one parameter which is the resolution of the grid to expand to.
Resolution here refers to the resolution of the voxel grid that Roblox uses for terrain. You can think of this as the length of each cube. This parameter must always be set to four when dealing with terrain no matter what because that is the only resolution that is supported at this time. The only reason Roblox added it is for the future when they add support.
local resolution = 4
local pos1 = Vector3.new(1232.5, -340.5, 517.5)
local pos2 = Vector3.new(-816.5, 302.5, -1531.5)
local region = Region3.new(pos1 , pos2):ExpandToGrid(resolution)
game.Workspace.Terrain:FillRegion(region , resolution , Enum.Material.Water)
2 comments
Thanks, but that currently errors " Region has to be aligned to the grid (use Region3:ExpandToGrid)" which I just looked at on the wiki, but I have no idea how write it correctly. Thanks for what you have done already, I'm almost there.
i still need help