Hello. I have this script where a part’s joints can be broken upon contact:
function onTouch(hit)
if hit:IsA("BasePart") then
hit:BreakJoints()
for _, welds in pairs(hit:GetChildren()) do
if welds:IsA("Weld") or welds:IsA("WeldConstraint") then
welds:Destroy()
end
end
end
end
script.Parent.Touched:connect(onTouch)
did you checked if the weld destroyed in the explorer ? if you did then are you sure these are Welds or WeldConstraints ? if you do then try replacing GetChildren with GetDescendants
no it will give a different result if the welds are children of other parts then this is the problem , GetChildren returns a table contains all the children of the parent but in this situation you need to use GetDescendants because GetDescendants does not only return the children of the parent it returns the any children of these children it may be hard to understand but just replace GetChildren with GetDescendants