Ragdoll killing the humanoid

Hello developers. I’m making a ragdoll system using a module script and I’ve run into a problem. Instead of ragdoll-ing the character It would kill the humanoid and I’m so confused that its stressing me out. Please help me!

Code:

-- Services --
 local Doll = {}
 local Replicated = game:GetService('ReplicatedStorage')
--

-- Fire Server --
 local Remotes = Replicated:FindFirstChild('Remotes').Hitbox
 Doll.Fall = function(Character,Player)
	Remotes.Doll:FireClient(Player,'Fall')
	--
	Character.Humanoid.JumpPower = 0
	Character.Humanoid.RequireNeck = false
	for _,V in pairs(Character:GetDescendants()) do
		if V:IsA('Motor6D') then
			--
			local Att1 = Instance.new('Attachment')
			local Att2 = Instance.new('Attachment')
			local BSocket = Instance.new('BallSocketConstraint')
			--
			Att1.Name = 'Att1'
			Att1.CFrame = V.C0
			Att1.Parent = V.Part0
			--
			Att2.Name = 'Att2'
			Att2.CFrame = V.C1
			Att2.Parent = V.Part1
			--
			BSocket.Name = 'BSocket'
			BSocket.Attachment0 = Att1
			BSocket.Attachment1 = Att2
			BSocket.LimitsEnabled = true
			BSocket.TwistLimitsEnabled = true
			--
			V.Part0 = nil
		end
	end
 end
 --
 function MakeM6D()
	local M6D = Instance.new('Motor6D')
	M6D.MaxVelocity = .1
	return M6D
 end
 --
 Doll.Stand = function(Character,Player,Humanoid)
	--
	Character.Humanoid.JumpPower = 50
	for _,V in pairs(Character:GetDescendants()) do
		if V.Name == 'Att1' or V.Name == 'Att2' or V:IsA('BallSocketConstraint') then
			print(V)
			V:Destroy()
		end
	end
	--
	for _,V in pairs(Character:GetDescendants()) do
		if V:IsA('Motor6D') then
			V.Part0 = V.Parent
		end
	end
	Remotes.Doll:FireClient(Player,'Stand')
 end
 
return Doll
--

Just to clarify, is it a ModuleScript?
And, is it the whole code?
You could have a script that instantly kills the humanoid, so i’m quite unsure if the script you provided is the needed one

What part of the code here is supposed to ragdoll it but instead kills it?

Found an issue in here:

Character.Humanoid.JumpPower = 0

Character.Humanoid.RequireNeck = false -- <-- here

for _,V in pairs(Character:GetDescendants()) do

Change RequireNeck to RequiresNeck
image

3 Likes

Make sure you set hum.BreakJointsOnDeath to false

Doll.Fall = function(Character,Player)
	Remotes.Doll:FireClient(Player,'Fall')
	--
	Character.Humanoid.JumpPower = 0
	Character.Humanoid.RequireNeck = false
	for _,V in pairs(Character:GetDescendants()) do
		if V:IsA('Motor6D') then
			--
			local Att1 = Instance.new('Attachment')
			local Att2 = Instance.new('Attachment')
			local BSocket = Instance.new('BallSocketConstraint')
			--
			Att1.Name = 'Att1'
			Att1.CFrame = V.C0
			Att1.Parent = V.Part0
			--
			Att2.Name = 'Att2'
			Att2.CFrame = V.C1
			Att2.Parent = V.Part1
			--
			BSocket.Name = 'BSocket'
			BSocket.Attachment0 = Att1
			BSocket.Attachment1 = Att2
			BSocket.LimitsEnabled = true
			BSocket.TwistLimitsEnabled = true
			--
			V.Part0 = nil
		end
	end
 end

I’m not trying to kill the player. Im trying to like just ragdoll him

I’ll show all 3 scripts that use the module

I have a update. It doesn’t kill me anymore but it just removes all the joints then puts them back acting like I died