I’m trying to develop a system where a player can use a ProximityPrompt to create a RodConstraint and then automatically attach it to two parts with included attachment points. I’m having issues with this though, as the RodConstraint won’t activate, and of course, the property is locked so it can’t be manually set.
My script is the following:
script.Parent.Triggered:Connect(function()
local coupler = Instance.new("RodConstraint")
coupler.Parent = game.Workspace.Part1
coupler.Attachment0 = game.Workspace.Part1.Attachment
coupler.Attachment1 = game.Workspace.Part1.Attachment
local distance = (game.Workspace.Part1.Position - game.Workspace.Part2.Position).magnitude
coupler.Length = distance
coupler.Visible = true
coupler.Enabled = true
script.Parent.Enabled = false
end)
If anyone has any advice on how to deal with this, it would be greatly appreciated. If it’s an obvious solution that I’m missing, I’m sorry, I haven’t dealt with constraints much so far. Thanks!