Ragdolls' arms are stuck to the player's torso upon death. Does anyone know why?

I’ve created a module script that allows me to create ragdolls. However, when I die, everything (except the head because I welded the head) but the arms actually go in a ragdoll state.
Here’s my module

local RagdollFunctions = {}

RagdollFunctions.Ragdoll = function(char, player)
	
	game.ReplicatedStorage.RagdollEvent:FireClient(player, "Ragdoll")
	
	char.Humanoid.JumpPower = 0
	
	for _, v in pairs(char:GetDescendants()) do 
		
		if v:IsA("BasePart") and v.Name == "Head" or v.Name == "Torso" then
			local weld = Instance.new("Weld")
			weld.Part0 = char.HumanoidRootPart
			weld.Part1 = v
			weld.C0 = char.HumanoidRootPart.CFrame:inverse()
			weld.C1 = v.CFrame:inverse()
			weld.Parent = char.HumanoidRootPart
			weld.Name = "RagdollWeld"
		end
		
		
		if v:IsA("Motor6D") then
			local attachment1 = Instance.new("Attachment")
			local attachment0 = Instance.new("Attachment")
			
			attachment0.Name = "Attachment0"
			attachment1.Name = "Attachment1"
			
			attachment0.CFrame = v.C0
			attachment1.CFrame = v.C1
			attachment0.Parent = v.Part0
			attachment1.Parent = v.Part1
			
			local constraint = Instance.new("HingeConstraint")
			
			constraint.Attachment0 = attachment0
			constraint.Attachment1 = attachment1
			constraint.Parent = v.Part0

			v.Part0 = nil
		end	
	end
end


function createMotor6D()
	local motor6D = Instance.new("Motor6D")
	return motor6D
end

RagdollFunctions.Stand = function(char, player, humanoid)
	char.Humanoid.JumpPower = 50
	
	for _, v in pairs(char:GetDescendants()) do
		if v.Name == "Attachment0" or v.Name == "Attachment1" or v:IsA("Weld") and v.Name == "RagdollWeld" or v:IsA("HingeConstraint") then -- change HingeConstraint to ballsocketconstraint if thats what you chose
			v:Destroy() 
		end
	end
	
	for _, v in pairs(char:GetDescendants()) do
		if v:IsA("Motor6D") then
			v.Part0 = v.Parent
		end
	end
	
	game.ReplicatedStorage.RagdollEvent:FireClient(player, "Stand")

end

return RagdollFunctions
1 Like

Search up for Humanoid state, you must change it to ragdolled.

1 Like

It doesn’t seem to have done anything.
Could you check to see if this is right?

char.Humanoid:ChangeState(1)
1 Like

I’ve put this at the end of the for loop, after all the joints are created.

1 Like

Try char.Humanoid:ChangeState("Physics") in a local script.
Also, when un-ragdolling do char.Humanoid:ChangeState("GettingUp") (in a local script)

1 Like

The bug is still happening. :confused: I’ve tried doing it several ways now.

1 Like

Except when I do it now, when the player respawns, they become a ragdoll when they spawn.

1 Like

Does the ragdoll it self work fine now? Or just what it was and now when the player respawns

1 Like

Everything works, except for when the player respawns. For some reason the player will ragdoll when they respawn

1 Like

char.Humanoid:ChangeState(Enum.HumanoidStateType.Ragdoll)

This doesn’t seem to work either

Try it now, I just fixed a typo which was previously present.

Yeah I saw, I had already fixed the typo in it. It still doesn’t work :frowning:

Did it work with “Physics”? You need to unset the “Physics” humanoid type explicitly by setting to another state type or by reloading the character.

I’ve tried both “physics” and “ragdoll”, neither have worked for me.