Help Ragdoll with new roblox system (Physics)

Help to get the Physics properties without other actions (swimming, jumping, running, falling, …).
I want R6 and R15 solutions, that’s why I need to use Physics. I have another script to handle R6 and R15 with “BallSocketConstraint,” but the result is not the best.

Here’s the video where I show the problem:

Here’s the code that I use in the video:

local character: Model = script.Parent
local humanoid: Humanoid = character:WaitForChild('Humanoid')
local ragdolled: BoolValue = character:WaitForChild('Ragdolled')

local function changeState()
	if ragdolled.Value then 
		--humanoid:SetStateEnabled(Enum.HumanoidStateType.GettingUp, false)
		--humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, false)
		--humanoid:SetStateEnabled(Enum.HumanoidStateType.FallingDown, false)
		--humanoid:SetStateEnabled(Enum.HumanoidStateType.Ragdoll, false)
		--humanoid:SetStateEnabled(Enum.HumanoidStateType.Physics, false)
		--humanoid:SetStateEnabled(Enum.HumanoidStateType.Running, false)
		--humanoid:SetStateEnabled(Enum.HumanoidStateType.RunningNoPhysics, false)
		--humanoid:SetStateEnabled(Enum.HumanoidStateType.Climbing, false)
		--humanoid:SetStateEnabled(Enum.HumanoidStateType.Swimming, false)
		--humanoid:SetStateEnabled(Enum.HumanoidStateType.Seated, false)
		--humanoid:SetStateEnabled(Enum.HumanoidStateType.Flying, false)
		--humanoid:SetStateEnabled(Enum.HumanoidStateType.PlatformStanding, false)
		--humanoid:SetStateEnabled(Enum.HumanoidStateType.None, false)
		humanoid:ChangeState(Enum.HumanoidStateType.Physics)
	else
		humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
	end
end

ragdolled.Changed:Connect(changeState)

You have to disable all the character’s Motor6Ds and enable the BallSocketConstraints. That should fix your problem.

1 Like

I got this Module but its not work fine (the head effect is not good)

local module = {}

function module.ragdoll(character)
	if character.Ragdolled.Value then return end
	character.Ragdolled.Value = true
	for _, joint in pairs(character:GetDescendants()) do
		if joint:IsA('Motor6D') then
			local socket = Instance.new('BallSocketConstraint', joint.Parent)
			local att0 = Instance.new('Attachment', joint.Part0)
			local att1 = Instance.new('Attachment', joint.Part1)

			att0.CFrame = joint.C0
			att1.CFrame = joint.C1

			socket.Attachment0 = att0
			socket.Attachment1 = att1
			socket.TwistLimitsEnabled = true
			socket.LimitsEnabled = true

			joint.Enabled = false
		end
	end
end

function module.unragdoll(character)
	if not character.Ragdolled.Value then return end
	character.Ragdolled.Value = false

	for _, joint in pairs(character:GetDescendants()) do
		if joint:IsA('Motor6D') then
			joint.Enabled = true  -- Réactiver le Motor6D
		elseif joint:IsA('BallSocketConstraint') then
			joint:Destroy()  -- Supprimer la BallSocketConstraint
		end
	end
end



return module

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