Can't seem to move this model/folder somewhere else

For days now I’ve been trying to figure out how to move an entire folder/model
I’m trying to move 1 part of a Map Generation somewhere else than the other generation.

I’ve tried Pivoting the model/folder to a certain part but it doesn’t seem to work.

The folders are corresponding to the area number you put in for the function.

function generate(colorground, colorwater, colorsand, area)
	
	--[[ all code by okeanskiy. ]]--
--[[
    Script #1 of 2: game.ServerScriptService.Terrain (Server Script)
]]

	local X = 50
	local Z = 50

	local grid = {}

	for x = 1, X do
		grid[x] = {}
		

		for z = 1, Z do
			grid[x][z] = math.noise(x/10, z/10) * 15
		end
	end

	for x = 1, X do
		for z = 1, Z do
			local yPos = grid[x][z]

			local part = Instance.new("Part")
			part.Anchored = true

			if yPos < -3 then
				part.Material = Enum.Material.SmoothPlastic
				part.BrickColor = colorsand
			else
				part.Material = Enum.Material.SmoothPlastic
				part.BrickColor = colorground
				local attach = Instance.new("Attachment")
				attach.Parent = part
				attach.Position = Vector3.new(attach.Position, 16.796, attach.Position)
				attach.Visible = true
			end
			
			
		
			
			part.Position = Vector3.new(x*5, yPos, z*5)
			part.Size = Vector3.new(5, 30, 5)
			part.Parent = workspace.MapGeneration
			
			
			
		end
	end

	local water = Instance.new("Part")
	water.Anchored = true
	water.Size = Vector3.new(X*5, 30, Z*5)
	water.Position = Vector3.new(((X+1)*5)/2, -5, ((Z+1)*5)/2)
	water.CanCollide = false
	water.Transparency = .5
	water.BrickColor = colorwater
	water.Parent = workspace.MapGeneration
	
	local model = Instance.new("Model")
	
	for _, Generation in pairs(workspace.MapGeneration:GetChildren()) do
		Generation.Parent = model
		model.Name = area .. "- MapGenerator"
		model:PivotTo(workspace[area].DefaultPosition.CFrame)
		model.Parent = workspace
		print(area)
	end
	
	if area == 0 then
		local spawnloc = Instance.new("SpawnLocation")
		spawnloc.Anchored = true
		spawnloc.Size = Vector3.new(X*5, 30, Z*5)
		spawnloc.Position = Vector3.new(((X+1)*5)/2, -5, ((Z+1)*5)/2)
		spawnloc.CanCollide = false
		spawnloc.Transparency = .5
		spawnloc.Parent = workspace

	else


	end
	
--[[
    Script #2 of 2: game.ServerScriptService.RandomVsNoise (Server Script)
]]

	--[[print("10 RANDOM NUMBERS:")
	for i = 1, 10 do
		print(math.random())
	end

	print("10 NUMBERS GENERATED FROM NOISE")for i = 1, 10 do
		print(math.noise(i/10))
	end]]
	
	
	
end

generate(BrickColor.new("Bright green"), BrickColor.new("Electric blue"), BrickColor.new("Cool yellow"), 1)

generate(BrickColor.new("Medium stone grey"), BrickColor.new("Electric blue"), BrickColor.new("Cool yellow"), 2)

I just wanted to say. I just wanted to tell you. That-that I’m the one who knocks

If it is a model you can use setprimarypartCFrame(), although that is deprecated. Other than that I don’t know. You would have to use scripts and some math at that point.

get all of the children in the folder, and move them according to their own position a set number of studs to another space

dont move them all to a specific spot or you will put them all in the same spot

vector3.new(nil, +20, nil)

im a beginner so the above way of moving them might not work

image
it kinda did work but now all the parts are in one

could you show me an example since i really dont know how to use setprimarypartCFrame

local yourModelHere = game.Workspace.Model

-- Set the primary part cframe like this
yourModelHere:SetPrimaryPartCFrame(game.Workspace.NewPos.CFrame)

He meant to add
Instead of “= Vector3” do “+= Vector3”

Ex:
Part.Position += Vector3.new(x,y,z)

this does indeed work but when i try multiple at once the 2 generations go in the same spot

dont move them all to directly one space, move them a set amount of studs according to their own part, and not according to global

Add a variable to store them.

--Put outside of loop
local Num = 20
--Put after loop (After “until” or “end”)
Num += 20
--Use this to move the parts
Part.Position += Vector3.new(x,Num,Z)

I’m assuming you’re using a template generation and cloning them?

im not cloning them im using a function to generate a random generation so i dont know where to put them

what exactly are you trying to achieve?

multiple generations to be right next to eachother

when you make a new generation, add to its current position using += in the direction you want it to go, preventing them from being ontop of each other