WeldConstraint is disabled when created by script

Hello!

I’m currently trying to create some WeldConstraints to create a model and keep all of its parts the same in terms of relativity. The problem is that the WeldConstraints’ Active property is set to false.

-- Variable 'v' is a model
          for i2,v2 in pairs(v:GetDescendants()) do
				if v2:IsA('BasePart') and v2 ~= boundingBox then
					local weldConstraint = Instance.new('WeldConstraint')
					weldConstraint.Parent = boundingBox
					weldConstraint.Part0 = boundingBox
					weldConstraint.Part1 = v2
				end
			end

How the welds look:
Screen Shot 2021-03-05 at 10.52.56 PM

Here’s how the welds look, a better view.
Screen Shot 2021-03-05 at 10.51.53 PM

According to the Roblox Developer Hub, the Active property of the WeldConstraint will be disabled under the following circumstances:

If the WeldConstraint or one of its parts is not in Workspace the weld will be inactive.

If the “boundingBox” that is being referred to is inside of Workspace, the behavior that you’re observing may be a result of other factors.


As I do not have much experience with WeldConstraints, here’s another post on the Developer Forum with an explanation to a similar question that’ll provide more value on this subject than I am able to:

1 Like

Yep, I checked both of those before posting and unfortunately neither solved my issue :confused:

1 Like

I feel like an idiot, it was because I forgot to unanchor the parts :man_facepalming:

2 Likes