In my game there’s an issue with some items loading faster than the rest and i would like to fix it, but i would have to get all of the rootparts and then check if there’s a lot connected parts and load those first.
Is there a way to get all of the rootparts from a model?
I mean, you could name these rootparts something exclusive like “rootpart” and then loop through all of the model’s children and put the root parts in a different array.
local rootparts = {}
for i, v in pairs(model:GetChildren()) do
if v.Name == "rootpart" then
table.insert(rootparts, v)
end
end
Is this what you’re asking? If not can you make it clearer please because a rootpart isn’t a built-in mechanism by roblox that people use often it’s something you come up with.
I need to get all of the mechanisms with all of the connected parts.
So as an example a car and a boat those 2 are both mechanisms, but i need a way to get those 2 mechanism into a seperate table.
Oh I see what you mean now, for this you can probably use :GetTouchingParts() which returns a table containing all touching parts, and considering that the rootpart has the other connected part next to it that’s perfect for what we are doing. This is a first option that is easy to use, but we will meat some issues with this.
So another thing we can do is use :FindPartsInRegion3() and this is better because we get to define the area that we search for the parts in, so yeah that’s the way to go i’d say, just in case you don’t know region3 here you go.