Need Help with importing shirts onto Custom Ragdoll

So, I have this ragdoll module script, and it works fine physically, but visually, the shirts do not import on the parts. How would I edit this script to make it so the shirt and pants import onto the new limbs?

image
what happens

local ragdoll = {}

function ragdoll.Start(character)
	if character.Name == (nil or "Workspace") then return end
	if character.Ragdoll.Value then return end
	
	character.Ragdoll.Value = true

	local rARM = character["Right Arm"]:Clone()
	local lARM = character["Left Arm"]:Clone()

	local rLEG = character["Right Leg"]:Clone()
	local lLEG = character["Left Leg"]:Clone()

	rARM.Name = "Ragdoll-RA"
	lARM.Name = "Ragdoll-LA"
	rLEG.Name = "Ragdoll-RL"
	lLEG.Name = "Ragdoll-LL"

	rARM.Parent = character.HumanoidRootPart
	lARM.Parent = character.HumanoidRootPart
	rLEG.Parent = character.HumanoidRootPart
	lLEG.Parent = character.HumanoidRootPart

	rARM.CFrame = character["Right Arm"].CFrame
	lARM.CFrame = character["Left Arm"].CFrame
	rLEG.CFrame = character["Right Leg"].CFrame
	lLEG.CFrame = character["Left Leg"].CFrame

	character.Torso["Right Shoulder"].Part1 = rARM
	character.Torso["Left Shoulder"].Part1 = lARM
	character.Torso["Right Hip"].Part1 = rLEG
	character.Torso["Left Hip"].Part1 = lLEG

	character["Right Arm"].Anchored = true
	character["Left Arm"].Anchored = true
	character["Right Leg"].Anchored = true
	character["Left Leg"].Anchored = true

	character["Right Arm"].Transparency = 1
	character["Left Arm"].Transparency = 1
	character["Right Leg"].Transparency = 1
	character["Left Leg"].Transparency = 1

	character["Right Arm"].CastShadow = false
	character["Left Arm"].CastShadow = false
	character["Right Leg"].CastShadow = false
	character["Left Leg"].CastShadow = false

	character["Right Arm"].CanTouch = false
	character["Left Arm"].CanTouch = false
	character["Right Leg"].CanTouch = false
	character["Left Leg"].CanTouch = false

	rARM.Anchored = false
	lARM.Anchored = false
	rLEG.Anchored = false
	lLEG.Anchored = false

	rARM.CanCollide = true
	lARM.CanCollide = true
	rLEG.CanCollide = true
	lLEG.CanCollide = true

	for i, joint in pairs(character:GetDescendants()) do
		if joint:IsA("Motor6D") then
			local socket = Instance.new("BallSocketConstraint")
			local a0 = Instance.new("Attachment")
			local a1 = Instance.new("Attachment")
			a0.Parent = joint.Part0
			a1.Parent = joint.Part1
			socket.Parent = joint.Parent
			socket.Attachment0 = a0
			socket.Attachment1 = a1
			a0.CFrame = joint.C0
			a1.CFrame = joint.C1
			socket.LimitsEnabled = true
			socket.TwistLimitsEnabled = true

			joint.Enabled = false
		end
	end

	character.Humanoid.WalkSpeed = 0
	character.Humanoid.JumpPower = 0

	character.Humanoid.PlatformStand = true

	character.Humanoid.AutoRotate = false
	character.Humanoid:ChangeState(Enum.HumanoidStateType.Physics)
end

function ragdoll.Stop(character)
	local hrp = character:FindFirstChild("HumanoidRootPart")
	local hum = character:FindFirstChild("Humanoid")
	for i,part in pairs(character.HumanoidRootPart:GetChildren()) do
		if string.find(part.Name,"Ragdoll-") then
			part:Destroy()
		end
	end

	character["Right Arm"].Anchored = false
	character["Left Arm"].Anchored = false
	character["Right Leg"].Anchored = false
	character["Left Leg"].Anchored = false

	character["Right Arm"].CanTouch = true
	character["Left Arm"].CanTouch = true
	character["Right Leg"].CanTouch = true
	character["Left Leg"].CanTouch = true

	character.Torso["Right Shoulder"].Part1 = character["Right Arm"]
	character.Torso["Left Shoulder"].Part1 = character["Left Arm"]
	character.Torso["Right Hip"].Part1 = character["Right Leg"]
	character.Torso["Left Hip"].Part1 = character["Left Leg"]

	character["Right Arm"].Transparency = 0
	character["Left Arm"].Transparency = 0
	character["Right Leg"].Transparency = 0
	character["Left Leg"].Transparency = 0

	character["Right Arm"].CastShadow = true
	character["Left Arm"].CastShadow = true
	character["Right Leg"].CastShadow = true
	character["Left Leg"].CastShadow = true

	for i, joint in pairs(character:GetDescendants()) do
		if joint:IsA("BallSocketConstraint") then
			joint:Destroy()
		end

		if joint:IsA("Motor6D") then
			joint.Enabled = true
		end
	end

	character.Ragdoll.Value = false

	hum.WalkSpeed = 16
	hum.JumpPower = 50

	hum.AutoRotate = true
	hum.PlatformStand = false
	character.Humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
end

return ragdoll
1 Like

Remove this part of the code:

	rARM.Name = "Ragdoll-RA"
	lARM.Name = "Ragdoll-LA"
	rLEG.Name = "Ragdoll-RL"
	lLEG.Name = "Ragdoll-LL"

Changing the name of the limbs causes the Humanoid to not find them.
Also parenting the limbs to the HumanoidRootPart will also prevent the humanoid from finding them, as they should be parented to the character.

1 Like