I'm trying to fill a very large region with water, and I've been looking through the wiki and stuff, and it's supposed to go FillRegion(Region3, resolution, material) and I have no idea wtf resolution is for (I think it's supposed to be a number). My code is
game.Workspace.Terrain:FillRegion(Region3.new(Vector3.new(1232.5, -340.5, 517.5), Vector3.new(-816.5, 302.5, -1531.5)), 0, Water)
I put it in the console, and it then it says "Argument 3 missing or nil". Please help me, it lags a ton when doing terrain manually.
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)