BasePart:GetRootPart states root part selection is random when it's since been made deterministic

Issue Description
This page states that RootPart selection:

and advises against relying on an implementation detail for working with RootParts

However, the more recent DevHub Page Understanding Assemblies states it’s externally determinstic with preset rules on what determines the root part.

Its worth noting that the selection is still controlled by the engine, but these factors let you control the RootPart. If you have a part with RootPriority 127 and only anchor that, it’ll always be the RootPart no matter what

Issue Area: DevHub Content
Page URL: BasePart:GetRootPart

2 Likes

Thanks for the report! We’ve filed a ticket to our internal database and we’ll follow up when we have an update for you.

1 Like

Want to note that both are true.

You can influence it, but with all else being equal, with two parts of the same name and same size as a last resort it will sort based on the internal replicated GUID. This is deterministic and consistent, but since this isn’t exposed (since it provides no additional developer utility beyond ordinary reference identity, it’s just a single session network serializable ID) it’s still effectively random to you.

It currently has a tendency to favor the newest part if they were both created on the same machine, but that’s not guaranteed. Don’t rely on that!

This discussion of gnarly implementation details was just omitted from the article.

4 Likes

Very interesting implementation of this, will definitely keep that in mind next time my train starts having weird weld offset behaviour.