SurfaceType based joining is deprecated, do not use MakeJoints for new projects.
HingeConstraint|HingeConstraints should be used instead
Goes through all
BasePart|Parts in the
Model and creates joints between the specified Parts and any planar touching surfaces, depending on the parts’ surfaces.
- Smooth surfaces will not create joints
- Glue surfaces will create a
- Weld will create a
Weldjoint with any surface except for Unjoinable
- Studs, Inlet, or Universal will each create a
Snapjoint with either of other the other two surfaces (e.g. Studs with Inlet and Universal)
- Hinge and Motor surfaces create
This function will not work if the Part is not a descendant of
Workspace. Therefore developers must first ensure the Model is parented to Workspace before using MakeJoints.
This code sample demonstrates how joints can be made using the Model:MakeJoints function.
A model is instanced, with two parts on top of each other. The top part is anchored and the bottom part is not. Normally, when parented to the Workspace the bottom part would fall to the Baseplate.
However, as TopSurface property of the bottom part is set to Enum.SurfaceType.Weld, this means that when Model:MakeJoints is ran a connection is made between them.
Therefore the bottom part does not drop until the joints in the model are broken. This is often done using Model:BreakJoints, but in this example the connection is broken using an explosion.
Simple Joint Creation
This code sample demonstrates creation of joints on two parts that are siblings of the script (PartA and PartB). It uses MakeJoints on two touching parts with compatible surface types (Studs and Inlet).