How do I fix ragdolled players able to move?

I was making myself a ragdoll system I could use, and I made a little button to test out the system. It worked… with a weird effect.
image
Players kinda slump over and are able to “walk”. Now, I’m not complaining, it’s kinda funny, but it’s not ideal. How do I prevent this particular issue?

Module script:

local module = {}

function module.RagdollAdd(character)
	for i,joint in pairs(character:GetDescendants()) do
		if joint:IsA("Motor6D") then
			local socket = Instance.new("BallSocketConstraint")
			local a1 = Instance.new("Attachment")
			local a2 = Instance.new("Attachment")
			a1.Parent = joint.Part0
			a2.Parent = joint.Part1
			socket.Parent = joint.Parent
			socket.Attachment0 = a1
			socket.Attachment1 = a2
			a1.CFrame = joint.C0
			a2.CFrame = joint.C1
			socket.LimitsEnabled = true
			socket.TwistLimitsEnabled = true
			joint.Enabled = false
			print("Ragdolled!")
		end
	end
	
end

function module.RagdollRemove(character)
	for i,socket in pairs(character:GetDescendants()) do
		if socket:IsA("BallSocketConstraint") or "Attachment" then
			socket:Destroy()
			for i,joint in pairs(character:GetDescendants()) do
				if joint:IsA("Motor6D") then
					joint.Enabled = true
				end
			end
			print("Unragdolled!")
		end
	end
end

return module

Button script:

local RagdollSystem = require(game.ReplicatedStorage.RagdollSystem)
local cd = script.Parent

cd.MouseClick:Connect(function(plr)
	local character = plr.Character
	RagdollSystem.RagdollAdd(character)
	
end)

Can u set the humanoid walk speed to 0 or is that not what u need?

On the client, when ragdolled, set the players humanoid state to Physics. Back to standing when unragdolling.

1 Like

I’m unable to figure out how unfortunately.

Update: I managed to get it working thanks to a different post. SImply added a remote event that triggers different humanoid states depending on the needed one.

Though now I must find out how to disable the camera from moving when ragdolled.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.