Getting specific parts and grouping them seperately

So I have a chunk loader script in my game, and it only loads instances which are grouped. This is fine, since I use it for trees and nature, but it doesn’t support parts.

I have some code that will find all specific parts in a game if i’d like, but I want to figure out a way to make it group each one seperately. You could instance.new a model, and parent it to that but I’m just not sure how to execute it.

Here’s the line of code for selecting parts:

local Workspace = game:GetService(‘Workspace’)
for Index, Part in ipairs(Workspace:GetDescendants()) do
if blahblahblahnameisthis then
Part.groupitselfidkhow) end
end

Any help is appreciated, thanks.

Do you mean something like this?

local Workspace = game.Workspace
for Index, child in ipairs(Workspace:GetDescendants()) do
	if child:IsA("Part") then
		child.Parent = Instance.new("Model", Workspace)
	end
end
1 Like

Yes, thank you! this helps save a lot of time!