Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 5 years ago

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

Log in to vote
1
Answered by 5 years ago

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

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? TerminusEstKuldin 40 — 5y
Ad

Answer this question