This is a consequence of the class hierarchy - RigidConstraint inherits from Constraint, whereas the other rigid joints inherit from JointInstance.*
Here is the full behavior:
BreakJoints: It only works for WeldConstraint and JointInstances. It does not break Constraints.
GetJoints: Check again - it actually does return Constraints, JointInstances, and WeldConstraints. You can use it to implement BreakJoints-like behavior for constraints.
We can add a special case for BreakJoints to work with RigidConstraint, but it would break existing content and would add an odd corner to the API that you would have to think about.
For now, you can get the same or better behavior as BreakJoints with a few lines.
local function breakEverything(part: BasePart)
for _, joint in part:GetJoints() do
joint.Enabled = false
end
end
This works with constraints.
* Except WeldConstraint, which is sort of out there on its own.
Hey, thank you! I figured that RigidConstraint would be treated the same as WeldConstraint since they’re both rigid, but I respect the decision to avoid adding more of these potentially difficult to account for edge cases. Thank you for the clarification that this is intentional behaviour, I will make sure to keep it in mind in the future!
I had tested GetJoints and I was for some reason unable to find RigidConstraints that way. I implemented some code that looked like this:
local function breakJoints(part: BasePart)
for _, joint in ipairs(part:GetJoints()) do
joint:Destroy()
end
end
When I used this code, the RigidConstraints persisted, and after trying to print out part:GetJoints() I was consistently seeing an empty table, despite the existence of the RigidConstraint.
Perhaps I was simply misreading something, a bug or an oversight on my part is probably pretty likely, so I will make sure to go validate, and I will test in a more isolated environment. If RigidConstraint is not being returned from :GetJoints() I will make sure to submit a separate bug report for that that appropriately identifies that specific issue.