The issue:
BasePart:GetRootPart() returns the incorrect type, aka Instance, not basepart, it won’t autofill basepart’s properties and can cause a bit of confusion.
HI! Thanks for the report. I think GetRootPart is just very old (maybe even older than typing), hence why it returns an Instance. I will ask around about changing that. In the meantime, like you mentioned, we recommend the use of AssemblyRootPart, which does return a BasePart.
I also did a benchmarking and it turned out that it’s faster to use already referenced instance property than function that need to execute and return result
Code:
local Result2 do
local Part = workspace.Part
local Time = os.clock()
for _=1, 1000000 do
local Root = Part:GetRootPart()
end
Result2 = os.clock() - Time
end
local Result1 do
local Part = workspace.Part
local Time = os.clock()
for _=1, 1000000 do
local Root = Part.AssemblyRootPart
end
Result1 = os.clock() - Time
end task.wait(1)
print(Result1)
print(Result2)
print(`Part.AssemblyRootPart is faster{100 -(Result1/Result2*100)}% than :GetRootPart()`)
(Need to run a few times for better result)
So yeah, better to mark :GetRootPart as deprecated. While then, i’ll mark solution for now because there’s nothing really to discuss