Welds not working

BreakJointsOnDeath is enabled by default.

I am aware. I was editing their code and that’s how they structured it.

Right, but you still recommended that they break joints on death after the fact.

Anyway, I’ve seen this script floating around before and optimised it for someone else a few days ago.

local Character = script.Parent
local Humanoid = Character:WaitForChild("Humanoid")
Humanoid.BreakJointsOnDeath = false

local function OnHumanoidDied()
	for _, Part in ipairs(Character:GetChildren()) do
		if Part:IsA("BasePart") then
			local Motor6D = Part:FindFirstChildWhichIsA("Motor6D")
			if Motor6D then
				if Part.Name ~= "Head" then
					local BallSocket = Instance.new("BallSocketConstraint")
					local Attachment1 = Instance.new("Attachment")
					local Attachment2 = Instance.new("Attachment")
					Attachment1.CFrame = Motor6D.C0
					Attachment2.CFrame = Motor6D.C1
					Attachment1.Parent = Motor6D.Part0
					Attachment2.Parent = Motor6D.Part1
					BallSocket.Attachment0 = Attachment1
					BallSocket.Attachment1 = Attachment2
					BallSocket.Parent = Motor6D.Parent
					Motor6D:Destroy()
				elseif Part.Name == "Head" then
					local WeldConstraint = Instance.new("WeldConstraint")
					WeldConstraint.Part0 = Motor6D.Part0
					WeldConstraint.Part1 = Motor6D.Part1
					WeldConstraint.Parent = Motor6D.Parent
				end
			end
		end
	end
end

Humanoid.Died:Connect(OnHumanoidDied)

After scanning the thread a little more I realised you’re trying to do this with an R6 character (6 joints), the script you’re using (and the one I provided above) will only work for R15 characters (15 joints) as R6 avatars do not have “Motor6D” instances within them.