I’ve just spent the past hour debugging why my arms kept falling off when the problem was this:

I have a function hooked into the unequip event that sets the shoulders’ Part1 properties back to the arms. They weren’t able to set the Part1s of the shoulders back to the arms though because the shoulders no longer existed. The shoulders are deleted by the system that cleans up welds when their Part0/Part1s are overwritten. The place I’m working with isn’t FE (working on stuff to be added onto an existing non-FE game), and I’ve had it happen in my own personal FE games before, so I don’t think it’s related to filtering.
Code (LocalScript directly inside Tool):
Discourse formatted
local leftGrip = Instance.new(“Weld”, tool)
leftGrip.C1 = CFrame.new(0.8,0.5,0.4) * CFrame.Angles(math.pi*(3/2),math.pi*(3/9),0)
local rightGrip = Instance.new(“Weld”, tool)
rightGrip.C1 = CFrame.new(-1.2,0.5,0.4) * CFrame.Angles(math.pi*(3/2), -math.pi/36,0)
tool.Equipped:connect(function()
print(“Equipped!”)
local character = game.Players.LocalPlayer.Character
local torso = character.Torso
local rightShoulder = torso[“Right Shoulder”]
local leftShoulder = torso[“Left Shoulder”]
leftGrip.Part0 = torso
rightGrip.Part0 = torso
leftShoulder.Part1 = nil
rightShoulder.Part1 = nil
spawn(function()
leftGrip.Part1 = character["Left Arm"]
rightGrip.Part1 = character["Right Arm"]
end)
tool.Unequipped:wait()
leftGrip.Part1 = nil
rightGrip.Part1 = nil
leftShoulder.Part1 = character["Left Arm"]
rightShoulder.Part1 = character["Right Arm"]
end)
[/code]
Screenshot that might be easier to read
First I set the shoulder Part1 properties to nil – I do this because they won’t get deleted if you do this by itself. Even though I’m doing this though, the joint system still thinks the shoulder Part1s are being overwritten by line 19 even though they’re set to nil first. I wrapped setting the grip Part1 properties in a spawn function to see if that would give the joint system enough time to sod off and not get a false positive pickup of an overwritten Part1, but that didn’t help. Everything works fine in a local server because there’s no network lag, but once I pop this into an online game, the joint cleanup system starts killing the shoulders.
This is definitely not the first time this has happened either. In the past, I’ve had numerous un-debuggable bugs in the past because of joints – some blip of network lag that happens once in a blue moon causes a joint to be destroyed and I can’t find out which part of the code caused it because it’s not reproduceable. The joint cleanup does not follow good behavior. The deletion of objects in-game should be the result of me explicitly doing so – not the engine deleting them without my knowledge nor consent because it thinks they need to be cleaned up. Joints being randomly deleted beyond our control only causes problems. The joint cleanup didn’t always used to be this way – around three years ago it was fine, but then the update that destroyed joints when their Part1 was overwritten came in and started causing problems (in addition to the random deletions due to network lag mentioned previously, it also broke a lot of crouch code on ROBLOX where the scripter didn’t set the Part1 of the hips to nil before setting the legs as the Part1s of the crouch joints).
Please remove this awful behavior that causes so many bugs to appear when using joints. It’s fine if the Part1 of overwritten joints is set to nil so you don’t have two joints fighting for control over a part, but don’t outright delete joints, breaking code that used those joints. I shouldn’t have to re-create joints and set their C0/C1/Part0 every time I switch between a set of joints for whatever reason – that’s silly. I expect to be able to set leftGrip/rightGrip’s Part1 properties to the arms and then set the shoulders’ Part1 properties to the arms on unequip without any of those joints being deleted in the process. If I wanted the joints to be deleted, I would have deleted them myself. Taking control of joints away from me, breaking my code because I can’t control what ROBLOX does, is a no no. Please change this behavior.
tl;dr
What the weld cleanup thinks it’s creating:

What it’s actually doing by deleting welds beyond the control of scripts:
< insert image of city on fire that Discourse isn’t displaying for some reason >
Please remove this awful behavior that causes so many bugs with welds to appear.
