How would I get two attachments, and then connect/snap them together like Lego pieces?
2 Likes
I thought attachments did have properties for this but apparently not… You could use their CFrames or Motor6D could work aswell. Those are my speculations
An Example:
local part1 = workspace.Part1
local part2 = workspace.Part2
local attachment1 = part1:FindFirstChildOfClass("Attachment") or Instance.new("Attachment", part1)
local attachment2 = part2:FindFirstChildOfClass("Attachment") or Instance.new("Attachment", part2)
local ropeConstraint = Instance.new("RopeConstraint")
ropeConstraint.Name = "CustomConstraint" -- You can give it a custom name
ropeConstraint.Attachment0 = attachment1
ropeConstraint.Attachment1 = attachment2
ropeConstraint.Length = (part2.Position - part1.Position).Magnitude -- Set the length based on the distance between attachments
-- Parent the constraint to one of the parts (or to a different parent, depending on your needs)
ropeConstraint.Parent = part1
2 Likes
Yeah this would work perfectly!
1 Like
This does do something, but all that does is make a rope connected between them. I need their Attachments to have the same CFrame. I tried setting it like so:
Attachment1.CFrame = Attachment2.CFrame
But that does not work, and yes, nothing is anchored or such.
1 Like
Fixed it, just used parts instead of attachments, dont know why I even tried them in the first place tbh.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.