Moving all parts inside a folder to different location

Im trying to move a map to a specific point
The map is in a folder and other multiple folders that just store stuff
I dont want to change it into a model (tried to do it but all parts inside the model would just disappear after changing the position for some reason ?)

There is MapCenter part inside the map’s folder and [MapPoint Part] inside workspace

Done many attempts to do it but just ended up with all parts moving to the MapPoint position instead of moving the map and keeping it’s normal shape

Might not be really clear but tried my best explaining it

You can keep the Map folder but make all of the descendants of it into model. After this, you can set the primary part of the model to the map center you were talking about. Next, use the PivotTo method on the model.

More information on PivotTo() here.

PVInstance | Documentation - Roblox Creator Hub

It would look something like this:

local model = script.Parent
model:PivotTo(CFrame.new(5,0,1)) - this takes CFrame, so change the desired cframe

If you have any questions regarding this, let me know.

I did exacly same thing and the parts just disappear (from the workspace)

Also there is no :Destroy() anywhere so i have no idea how did that happen

There may be other ways/better ways to do this but, I’m just going to answer the question you asked.

local folder = game.Workspace.YourFolder
local newPosition = Vector3.new(x, y, z)

for _, part in ipairs(folder:GetChildren()) do
    if part:IsA("BasePart") then --probably going to need this
        part.Position = part.Position + newPosition
    end
end

Turned out it was all fault of StreamingEnabled (with the model stuff)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.