Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Can you use a script to clone blocks of terrain like you can models?

I have a game I'm making which needs multiple copies of an identical section of terrain to be created via script. Is there a way to have a separate terrain object in ServerStorage to be cloned, or to copy/paste a section of terrain using scripts? Or would I have to dynamically create each section as needed?

1 answer

local region=Region3.new(Vector3.new(0,-50,0), Vector3.new(100,2,100)):ExpandToGrid(4)

local Terrain=workspace.Terrain

Terrain:FillRegion(

region,4,Enum.Material.Slate

)

local material,occupancy=Terrain:ReadVoxels(region,4)do

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])

end

end

end

end

1 comment

0

So what you're saying here is that you can use a script to "read" the contents of a region of terrain, and then I guess recreate it at another position?

This discussion is preserved as it was. New answers, comments, and votes are closed.