How to join part through attachments?

So I’ve had an idea that instead of joining my rooms through studio which leaves me with bugs like gaps and things near each hallway joining position, How can I instead join these rooms through attachments?

So you want the rooms to be positioned so that the attachments are in the same position? If the attachments are parented to the primary parts, I believe this might work.

local room1, room2 = --room models
local attach1, attach2 = -- attachments parented to the primaryparts of the rooms

local room2PpCf = room2:GetPrimaryPartCFrame()

local newPos = attach1.WorldPosition-attach2.Position
local newRoom2PpCf = room2PpCf-room2PpCf.Position+newPos

1 Like

You could also join them together using a weld or a Motor6D like how Humanoid Build Rig from attachments works.

local room1, room2 = --rooms as a BasePart
local attach1, attach2 = -- attachments

local newWeld ="Weld")

newWeld.C0 = attach1.CFrame
newWeld.C1 = attach2.CFrame
newWeld.Parent = room2