Say there is like millions and millions of parts inside parts in the workspace and i wanted to teleport them all to one position. Could I do it like this?

local Children = workspace:GetChildren()
local Position = Vector3.new(1, 1, 1)

for i = 1, #Children do

	local Child = Children[i]
	Child.Position = Position

	local Children2 = Child:GetChildren()

	for i = 1, #Children2 do

		local Child2 = Children2[i]
		Child2.Position = Position

		Children3 = Child:GetChildren()

		for i = 1, #Children3 do

			local Child3 = Children3[i]
			Child3.Position = Position

			Children4 = Ch -- so on and so on blah blah blah

		end

	end

end

If I did this the script would go on for so long long long long and it would just look horrible so is there a way I could shorten it to only be like, idk, 50 lines? just not a lot

AND I WANT THIS TO BE DONE BY SCRIPT, if youre giving me an answer

2 comments

0

So you're saying you don't want them to stack? If not, use CFrame.

0

Why not just use an in pairs loop? It's more efficient and simpler to use.