Any alternatives to BasePart:BreakJoints()?

Title is self-explanatory.

“Member ‘BasePart.BreakJoints’ is deprecated”
image

2 Likes

I’m not sure how the function works internally, but by my understanding it breaks all the joints in the character, so you could just define your own function and do it yourself like it:

for _, joint in character:GetDescendants() do
    if joint:IsA("Motor6D") then
        joint:Destroy()
    end
end

I haven’t tested this code, but it should work. Also, correct if I’m wrong, but I think breaking joints also includes breaking WeldConstraints and Welds in the character, also. You might have to destroy those, too.

1 Like

I thought there was a built-in alternative to it, I was planning to do that lol. Thanks.

Also, BreakJoints destroy all joints (like Welds, Glues, ManualWelds, etc) inside a BasePart/Model.

1 Like

There’s always BasePart:GetJoints(); though it unfortunately doesn’t have an equivalent method for models, like BreakJoints does.

1 Like

BasePart has a GetJoints method you could use here to replicate the behavior of BreakJoints with a function, or any other custom behavior you need.

local function BreakJoints(Part:Part)
	for _,child in Part:GetJoints() do
		child:Destroy()
	end
end
5 Likes

I made a function for it in my utilities module, thanks.

function Utilities:BreakJoints(Object: Instance)
	if not Object:IsA("BasePart") then
		for _, OtherObject in Object:GetDescendants() do
			Utilities:BreakJoints(OtherObject)
		end
	else
		for _, Joint in Object:GetJoints() do
			Joint:Destroy()
		end
	end
end
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.