Skinned Mesh Ragdoll not working

I am getting an error for this ragdoll script. If you guys have any idea what’s going on then please feel free to tell me.

--Made By Callme_jj

local char = script.Parent
local CharBones = char:WaitForChild("HumanoidRootPart"):GetDescendants()
local RagDollPartsFolder = Instance.new("Folder",char) --Create Folder To Parent All GhostParts.
RagDollPartsFolder.Name = "RagDollPartsFolder"


local RunService = game:GetService("RunService")--HeartBeat To Move Bones To Attachments Location, And Move RootPart.
local RATE_PER_SECOND = 500 --How Many Times Per Second To Move Bones.

local BoneDict = { --Dictionary To Refrence Bones From Body MeshPart Name.

	Head = "mixamorig:Head",
	LeftFoot = "mixamorig:LeftFoot",
	LeftHand = "mixamorig:LeftHand",
	LeftLowerArm = "mixamorig:LeftForeArm",
	UpperTorso = "mixamorig:Spine",
	LeftLowerLeg = "mixamorig:LeftLeg",
	LeftUpperArm = "mixamorig:LeftArm",
	LeftUpperLeg = "mixamorig:LeftUpLeg",
	LowerTorso = "mixamorig:Hips",
	RightFoot = "mixamorig:RightFoot",
	RightHand = "mixamorig:RightHand",
	RightLowerArm = "mixamorig:RightForeArm",
	RightLowerLeg = "mixamorig:RightLeg",
	RightUpperArm = "mixamorig:RightArm",
	RightUpperLeg = "mixamorig:RightUpLeg",
}


local BoneLimits = { --Dictionary To Refrence Bones Ball Socket Limits.

	Head = {UpperAngle = 45, TwistLowerAngle = -22.5, TwistUpperAngle = 22.5}, --Main Parts
	UpperTorso = {UpperAngle = 45, TwistLowerAngle = -35, TwistUpperAngle = 120},
	LowerTorso = {UpperAngle = 45, TwistLowerAngle = -20, TwistUpperAngle = 20},

	LeftUpperLeg = {UpperAngle = 35, TwistLowerAngle = 0, TwistUpperAngle = 180}, --Left Leg
	LeftLowerLeg = {UpperAngle = 0, TwistLowerAngle = 0, TwistUpperAngle = 0},
	LeftFoot = {UpperAngle = 1, TwistLowerAngle = -35, TwistUpperAngle = 35},

	LeftUpperArm = {UpperAngle = 45, TwistLowerAngle = 0, TwistUpperAngle = 0}, --Left Arm
	LeftLowerArm = {UpperAngle = 45, TwistLowerAngle = -20, TwistUpperAngle = 20},
	LeftHand = {UpperAngle = 35, TwistLowerAngle = -180, TwistUpperAngle = 180},

	RightUpperLeg = {UpperAngle = 35, TwistLowerAngle = 0, TwistUpperAngle = 180}, --Right Leg
	RightLowerLeg = {UpperAngle = 0, TwistLowerAngle = 0, TwistUpperAngle = 0},
	RightFoot = {UpperAngle = 25, TwistLowerAngle = -35, TwistUpperAngle = 35},

	RightUpperArm = {UpperAngle = 45, TwistLowerAngle = 0, TwistUpperAngle = 0}, --Right Arm
	RightLowerArm = {UpperAngle = 45, TwistLowerAngle = -20, TwistUpperAngle = 20},
	RightHand = {UpperAngle = 1, TwistLowerAngle = -35, TwistUpperAngle = 35},

}




--Make Attachments For Each MeshPart And Position It Where The Bone Is.
for index,Child in pairs(char:GetChildren()) do
	if Child:IsA("MeshPart") and BoneDict[Child.Name] then --Check If Child Is A Mesh And If A Bone Exists In Bone Dictionary.
		local ChildLinkedBone

		for i, Bone in pairs(CharBones) do --Get The Bone Object From The Character.
			if Bone.Name == BoneDict[Child.Name] then
				ChildLinkedBone = Bone
			end
		end

		local GhostPart = Instance.new("Part", RagDollPartsFolder) --Create, Size/Position && Name GhostPart.
		GhostPart.Size = Child.Size
		GhostPart.CFrame = Child.CFrame
		GhostPart.Name = (Child.Name.."-Ghost")
		GhostPart.Anchored = true
		GhostPart.Transparency = 1
		GhostPart.CanCollide = true

		local BoneAtt = Instance.new("Attachment", GhostPart) --Create And Position Bone Attachment.
		BoneAtt.WorldCFrame = ChildLinkedBone.WorldCFrame
		BoneAtt.Name = (GhostPart.Name.."-BoneAtt")


		Child.CanCollide = false --Turn Off Main Mesh CanCollide.

		spawn(function() --Heartbeat to move the bone's CFrame to the attachments CFrame.
			RunService.Heartbeat:Connect(function(step)
				ChildLinkedBone.WorldCFrame = BoneAtt.WorldCFrame
			end)
		end)


	end
end


--Make BallSocket From Motor6d.
for index, Child in pairs(char:GetDescendants()) do 
	if Child:IsA("Motor6D") and BoneDict[Child.Part0.Name] and BoneDict[Child.Part1.Name] then --Check If Child Is A Motor6D And If Both Part0 and Part1 Have Ghost Bones.

		local GhostPart0 = RagDollPartsFolder:WaitForChild(Child.Part0.Name.."-Ghost") --Get Ghost parts.
		local GhostPart1 = RagDollPartsFolder:WaitForChild(Child.Part1.Name.."-Ghost")

		local Att0 = Instance.new("Attachment",GhostPart0) --Create Attachements For BallSocket Constraint.
		local Att1 = Instance.new("Attachment",GhostPart1)

		Att0.Name = GhostPart0.Name.."-BallAtt" --Name Attachments For Debugging Purposes.
		Att1.Name = GhostPart1.Name.."-BallAtt"

		Att0.CFrame = Child.C0 --Set The Attachments CFrame To The Joints CFrame.
		Att1.CFrame = Child.C1

		local BallConstraint = Instance.new("BallSocketConstraint", GhostPart0) --Create BallSocket Constraint And Set Its Attachments.
		BallConstraint.Attachment0, BallConstraint.Attachment1 = Att0, Att1

		BallConstraint.TwistLimitsEnabled = true --Set BallSocket Limits.
		BallConstraint.LimitsEnabled = true
		BallConstraint.UpperAngle = BoneLimits[Child.Part0.Name].UpperAngle
		BallConstraint.TwistLowerAngle = BoneLimits[Child.Part0.Name].TwistLowerAngle
		BallConstraint.TwistUpperAngle = BoneLimits[Child.Part0.Name].TwistUpperAngle

		print("BallSocket Constraint Created For "..GhostPart0.Name.." And "..GhostPart1.Name..".")
	end
end

--UnAnchor All GhostParts.
for i,v in pairs(RagDollPartsFolder:GetChildren()) do
	v.Anchored = false
end

char:FindFirstChild("HumanoidRootPart").CanCollide = false

Error: