Hello developers! I am trying to use the paste region feature, however whenever I paste something, i can’t seem to find it. I am unsure if its even pasting at all, or if the Vector3Int16 value i am inputting is very far out to the point where I can’t see it. Also if possible, how would I make it be able to match up the position with regular vector3 values.
There is no errors, and The workspace is just blank, so I don’t think its being pasted.
I can’t seem to find any other solutions in the forums either.
As of right now, here is my code:
{
Terrain = true,
Name = "Field",
Terrainpos = Vector3int16.new(1,0,0)
}
local WorldLoader = {NextWorld = "Field"}
for i,v in worldconfigdata do -- worldconfigdata is the table above with all the values.
print(v)
if v.Name == WorldLoader["NextWorld"] then
terrain.PasteCache(v.Terrain,v.Terrainpos,WorldLoader["NextWorld"])
end
end
local Terrain = {}
local gameTerrain = game.Workspace.Terrain
local terrainparts = game.Workspace.TerrainParts
local CachedTerrains = {}
function Terrain.Initialize()
for i,v in game.Workspace.TerrainParts:GetDescendants() do
print(v)
local x = v.Position.X
local y = v.Position.Y
local z = v.Position.Z
worldterrain = workspace.Terrain:CopyRegion(Region3int16.new(Vector3int16.new(x,y,z)))
worldterrain.Parent = game.ReplicatedStorage.Worlds.CachedTerrains
worldterrain.Name = v.Name:sub(9)
workspace.Terrain:Clear()
CachedTerrains[worldterrain.Name] = worldterrain
print(CachedTerrains)
-- As of right now, I am only using 1 TerrainRegion, so I don't think im pasting the wrong one.
end
end
Terrain.Initialize()
function Terrain.PasteCache(v,pos,name)
print(name)
if v == false then return end
gameTerrain:PasteRegion(CachedTerrains[name],pos,true)
end
return Terrain