Codectionary / Developer documentation / Luau

Terrain editing

Fill a region of Roblox terrain with a material.

Why use Terrain?

Terrain uses volumetric cells rather than ordinary Parts. FillBlock is useful for generating land or water in a region, and editing it changes the shared place world.

Try it in Roblox Studio

Run this Script from ServerScriptService in a disposable Studio test place. It edits Workspace.Terrain, so use a test copy before changing an existing map.

Syntax

workspace.Terrain:FillBlock(cframe, size, Enum.Material.Grass)

Examples

Terrain editing

Add a small grass block to a test map.

local terrain = workspace.Terrain
terrain:FillBlock(
    CFrame.new(0, 0, 0),
    Vector3.new(16, 8, 16),
    Enum.Material.Grass
)
  1. workspace.Terrain is the place’s Terrain instance.
  2. CFrame and Vector3 define the region to fill; the material determines its appearance and physical material.
  3. Terrain is voxel based, so its final boundary may not match a Part’s exact dimensions.

Best practices

  • Test terrain generation in a copy of the place.
  • Avoid repeatedly filling large regions during every frame.

Runtime & versions

Luau host; Roblox engine examples require Roblox Studio. Feature availability depends on the language and runtime version used by your project; consult the official reference below.

Luau documentation

Specifications & further reading