Weld Programming Problem

Let’s say I have two parts: Part A, which has a weld inside it, and Part B, which is welded to Part A. Part A touched another part. Now, I want to break the weld, but how can I determine if a part is welded to another part when the weld isn’t inside the part itself? (I’ve simplified this to make it easier to explain.)

Welds have attachments which need to be parented to the respective part. So you can check if there’s a weld with an attachment on the part and delete it.

image
are u sure there is an attachments or is it the part itself?

I thought there was a newly added property that can determine this.

You could try using the :GetConnectedParts() method.

local function isWelded(part)
return #part:GetConnectedParts() > 0
end

An alternative could also be checking the AssemblyRootPart property.

2 Likes

i didnt test it yet but does it work with all sort of weld like WeldConstraint ?

Yes, the documentation says so.