Welds break on death because of ragdoll

Roblox apparently never made an actual attachment for UpperLegs (if I assigned my 3d 2.0 bodytype clothing meshes to the KneeRigAttachment or HipRigAttachment, it would just hang there, not moving with the UpperLegs’ movements). I solved this by welding it to the legs like so,

local rightup1 = Player.Character:WaitForChild("ElyStanRPants") 
local rightup2 = Player.Character:WaitForChild("ElyStanLPants")

repeat
rightup1.Handle:WaitForChild("AccessoryWeld").Part1 = Player.Character.RightUpperLeg 
		rightup2.Handle:WaitForChild("AccessoryWeld").Part1 = Player.Character.LeftUpperLeg
		task.wait()
	until rightup1.Handle:WaitForChild("AccessoryWeld").Part1 == Player.Character.RightUpperLeg and rightup2.Handle:WaitForChild("AccessoryWeld").Part1 == Player.Character.LeftUpperLeg
	rightup1.Handle.AccessoryWeld.C0 = CFrame.new(Vector3.new(0,0,0) )
	rightup1.Handle.AccessoryWeld.C1 = CFrame.new(Vector3.new(0, 0, 0) )

	rightup2.Handle.AccessoryWeld.C0 = CFrame.new(Vector3.new(0,0,0) )
	rightup2.Handle.AccessoryWeld.C1 = CFrame.new(Vector3.new(0, 0, 0) )

I know it’s horribly inefficient and probably a mess to work with once I add even more clothing options, but it’s the best I can do.

The problem is that when my character dies, the ragdoll script I’m using is basically destroying the original character, cloning the character, and applying ragdoll to it. For the other Attachments, the clothing stays on because they’re actual Roblox systems, but it breaks the weld for the UpperLeg clothing.

Does anyone know a better way of attaching the UpperLeg 3d meshes without using a weld that can be broken? This is really just a Roblox oversight.

maybe blacklist the weld? like add a tag to it and modify the ragdoll code so it ignores those welds

How would I blacklist it? Idk what you mean by a tag.

Instances can have tags assigned to them. So you could just do AccesoryWeld:AddTag("ragdollBlacklist") or something like that and then on the ragdoll code find where the welds are broken and if the instance has that tag, ignore it

I found the problem and solution. The ragdoll script wasn’t breaking the welds; it was just recycling the same useless KneeRigAttachments that the original character had while overriding my AccesoryWeld code. I managed to find a solution in @StrayanCini 's post on the same problem, where he created new Attachments for the UpperLegs. Thanks.
How to attach accessories to R15 upper legs - Help and Feedback / Building Support - Developer Forum | Roblox