local part = game.Workspace.Part
local part1 = game.Workspace.Part1
local part2 = game.Workspace.Part2
part1.Parent = part
part2.Parent = part
local TweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(10, Enum.EasingStyle.Linear)
local tweenGoal = {
CFrame = part.CFrame * CFrame.Angles(0, 90, 0)
}
local tween = TweenService:Create(part, tweenInfo, tweenGoal)
tween:Play()
I think you’re a little confused on what specifically isn’t working here. Your parenting is working and judging by the video, I assume your expectation is that the other two parts rotate around with the larger part when parented. That’s not how it works.
Studio tools will account for all descendant BaseParts and update their orientations in object space which is why when you use the Studio rotation tool on the bigger block, the smaller ones rotate as well. In a runtime environment, to achieve this behaviour you need to use welds. The two parts must be unanchored and welded to the bigger block. You can use WeldConstraints for this.
But the code is working so I don’t get your problem? The parent property affect where the part is placed, and the Part1 and Part2 parents are set to Part.
OK. So it’s expected to not work in runtime? When rotating with studio tools a different logic kicks in? If thats the case, I mark your answer as solution and case closed. Thank you.
Everything works, it’s just that you might be unaware about the relation of parts to their parents and why this behaviour occurs.
Parts not rotating with their parents is the default and expected behaviour. To provide a comfortable user experience and not have to rotate mass amounts of parts, the Studio rotate tool will account for descendant BaseParts and rotate them, as well as a selected part, together as if they were one assembly.
In a runtime environment the behaviour of the Studio rotate tool is not in effect so you must find a way to connect these two parts. Enter: joints, that connect two parts together. And if not that, then you require extra code that will explicitly moves the two smaller blocks with the larger one in object space.