part:Resize() function does not respect snap welds

I recently noticed that when calling the :Resize(…) function of a BasePart, the CFrame of any connected welds is not updated after the resize.

According to the description of “Resize”,

Changes the size of an object just like using the Studio resize tool.

But this is not the case. In Studio, with JoinSurfaces enabled, the welds are regenerated every time a resize handle is dragged. When using the Resize() function, the welds are not updated at all.

This causes problems with build tools relying on the Resize function:
Studio Resize 1
Above, the weld is keeping the centers of the parts aligned, even though the top part should be offset after resizing the in the direction of the right handle.

Studio Resize 2
In the image above, the part is left floating on top, even though the weld should be broken once the part has been resized and is no longer touching the bottom part.

This behavior has changed in the last year or so, and it causes problems with any building games that rely on the BasePart:Resize(…) function.

1 Like

If you need this behavior you can backdoor into it using multiple JointsService::CreateJoinAfterMoveJoints calls in combination with a FindPartsInRegion.

Alternatively if you’re brave enough, you can attempt to extract the JointPairs module from the new Lua Draggers, which implements the surface joining behavior entirely in Lua. It’s mostly usable as is, but you will have to hook up the Roact dependency if you want to show the white joint-outlines using it.

I found that the deprecated BasePart::MakeJoints() function was a better workaround. But really, the resize function should still work as it used to, considering that many games still depend on it and that it is not a deprecated function.