I’ve put together a weld script to weld all touching parts in my game. The problem is, that’s… not actually working. I’m using :GetTouchingParts, but that only appears to be getting parts inside of each other. If you need the code, here it is:
function Weld:WeldAllParts(model)
print(“Welding…”)
for _, child in pairs(model:GetDescendants()) do
if child:IsA(“BasePart”) and not child:IsA(“Terrain”) then
for _, touchingPart in pairs(child:GetTouchingParts()) do
local isWelded = false
for _, weld in pairs(touchingPart:GetChildren()) do
if weld:IsA("WeldConstraint") then
if weld.Part0 == child and weld.Part1 == touchingPart or weld.Part0 == touchingPart and weld.Part1 == child then
isWelded = true
break
end
end
end
if not isWelded then
local weld = Instance.new("WeldConstraint")
weld.Part0 = child
weld.Part1 = touchingPart
weld.Parent = child
weld.Enabled = true
end
end
end
end
end
This is at the point where even the BASEPLATE isn’t being welded to. Only parts inside of each other are welded, but not if they’re actually touching! Is there any fix for this?
EDIT: The model
is being set to workspace
for now.