I’ve made a lot of mountain terrain in a old project I was working on and was wondering if I can copy one small section of the terrain and than paste it into a new place. I have seen a lot of plugins yet not any of them seem to work on the latest version of Roblox Studio.
I have tried this plugin in the past, it doesn’t seem to work.
When using Terrain.MaxExtents in the :CopyRegion() call, it will copy all of the terrain in the game, but as far as I understand, you can replace that with the specific boundaries of the area that you want to copy over so that it doesn’t bring over all of the Terrain.
Terrain:CopyRegion() accepts a Region3int16, which is made up from two Vector3int16 (a minimum and a maximum). I’m not very familiar with this, but after reading through its documentation, it seems like you can create it by inputting the X, Y, and Z coordinates into Vector3int16.new(). This means that you would effectively need to have the coordinates for the opposite corners of the specific section of Terrain that you want to save, and once you have that, you can input it there, place those into a Region3int16.new() call, and then place that into the Terrain:CopyRegion() call to copy that section of Terrain.
To make it easier to understand, here’s what the process for saving / copying a specific section of Terrain seems like it would be, based on my interpretation of how it works:
Open the place that has the Terrain you want to save / copy
Create an empty Script anywhere in the game (it can be anywhere; this is temporary).
Find the area of Terrain that you want to copy
Locate the opposite corners of that section of Terrain.
Place a part at each corner. One part should be at the lowest possible point of the Terrain you want to save, and the other should be at the highest possible point.
Select one of the parts, then look at its Position in the Properties window.
Inside the Script you created during Step #2, write down the X, Y, and Z values for the first part.
Do the same thing for the other part (select it, look at the value of its “Position” property, and write it down in the Script)
Create a Vector3int16 based on the position of each part:
-- Notes
local part1Position = {X = 0, Y = 0, Z = 0}
local part2Position = {X = 10, Y = 10, Z = 10}
---
local part1Vector = Vector3int16.new(0, 0, 0)
local part2Vector = Vector3int16.new(10, 10, 10)
Based on those Vector3int16 values, create a Region3int16:
local part1Vector = Vector3int16.new(0, 0, 0)
local part2Vector = Vector3int16.new(10, 10, 10)
local region = Region3int16.new(part1Vector, part2Vector)
From there, include that region in the Terrain:CopyRegion() call, and then have the Script place the copied selection into the Terrain object in the Workspace:
Final Command Bar Code for the “starting place”
Remember to update the values of part1Vector and part2Vector to the opposite sets of coordinates that define the area of Terrain that you want to save / copy over. In the example below, one corner would be at the coordinates 0, 0, 0 and the other corner would be at 10, 10, 10.
local part1Vector = Vector3int16.new(0, 0, 0)
local part2Vector = Vector3int16.new(10, 10, 10)
local region = Region3int16.new(part1Vector, part2Vector)
local savedTerrainRegion = workspace.Terrain:CopyRegion(region)
savedTerrainRegion.Parent = workspace.Terrain
Next, copy that code and paste it into the Command Bar. After pressing enter to run it, open the Terrain object in the Workspace. A TerrainRegion object should be there, which is the copied area of Terrain.
From here, you can follow the next few steps that were outlined in the “How to post a Bug Report” thread above, with an exception for Step #3 (since you can open any other game you want to add it to, it doesn’t need to be a brand new baseplate) along with a slight modification for Step #5:
(If the quote did not load, click here to read what it said at the time of writing this post)
Step 2: Right click > Save As (.rbxm) the generated TerrainRegion parented under workspace.Terrain
Step 3: Create a new, empty baseplate and delete the baseplate + spawn
Step 4: Insert the TerrainRegion saved in step 2 through the Model tab > Model button and parent it to workspace.Terrain
Step 5: Run the following in the command bar:
What you include in the :PasteRegion() call would be a bit different from what is mentioned there since you would need to be more specific about defining where the Terrain should be placed in the other game, given that it’s not pasting all of the Terrain.
The main thing to change would be the "-32000"s within the Vector3int16.new(-32000, -32000, -32000) call. Update that to the set of coordinates that define the corner of where you want the Terrain to be pasted in. So if you wanted the corner to be based on the origin at 0, 0, 0, the PasteRegion() call would be the following:
Final command bar code for the other game that you want to move the terrain to
IMPORTANT: The TerrainRegionrbxm file from the starting place has to be added into the new game before running the following command bar code. Based on the 4th step outlined from Roblox’s instructions earlier, the TerrainRegion should be placed into the Terrain object in the Workspace before continuing.
Remember to update the Vector3int16.new(0, 0, 0) to the desired set of coordinates that the Terrain will be pasted into. This defines the corner that it’ll be placed at.
local Terrain = workspace.Terrain
local TerrainRegion = Terrain.TerrainRegion
Terrain:PasteRegion(TerrainRegion, Vector3int16.new(0, 0, 0), false)
This will probably take some trial and error to figure out what set of coordinates works best for your use case, but since it lets you delete TerrainRegions, that should make it much easier and faster to test out different coordinates for the corner until it’s pasted into a spot that you are satisfied with.
I’m sorry for the very late response, but I am a bit confused, I have used this plugin in the past. Does this allow you to copy a part of the terrain and paste it into another game, or does it copy the entirety of the terrain?