How to unragdoll?

  1. What do you want to achieve? I got this ragdoll script on the toolbox and i was trying to make him unragdoll instead of ragdoll.

  2. What is the issue? I don’t know how to make this script unragdoll.

  3. What solutions have you tried so far? I tried to look at DevForum but i din’t found a solution.

The script:

for _, v in pairs(Char:GetDescendants()) do --Char = player.Character
				if v:IsA("Motor6D") then
					local Att0, Att1 = Instance.new("Attachment"), Instance.new("Attachment")
					Att0.CFrame = v.C0
					Att1.CFrame = v.C1
					Att0.Parent = v.Part0
					Att1.Parent = v.Part1
					local BSC = Instance.new("BallSocketConstraint")
					BSC.Attachment0 = Att0
					BSC.Attachment1 = Att1
					BSC.Parent = v.Part0
					BSC.LimitsEnabled = true
					BSC.MaxFrictionTorque = 50
					BSC.TwistLimitsEnabled = true
					BSC.UpperAngle = 90
					BSC.TwistLowerAngle = -90
					BSC.TwistUpperAngle = 90
					v:Destroy()
				end
			end
			Char.HumanoidRootPart.CanCollide = false

How would i make this script unragdoll?

2 Likes

This should work.

local Char = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()

local function Ragdoll()
	for _, v in pairs(Char:GetDescendants()) do --Char = player.Character
		if v:IsA("Motor6D") then
			local Att0, Att1 = Instance.new("Attachment"), Instance.new("Attachment")
			Att0.CFrame = v.C0
			Att1.CFrame = v.C1
			Att0.Parent = v.Part0
			Att0.Name = "Att0"
			Att1.Name = "Att1"

			Att1.Parent = v.Part1
			local BSC = Instance.new("BallSocketConstraint")
			BSC.Attachment0 = Att0
			BSC.Attachment1 = Att1
			BSC.Parent = v.Part0
			BSC.LimitsEnabled = true
			BSC.MaxFrictionTorque = 50
			BSC.TwistLimitsEnabled = true
			BSC.UpperAngle = 90
			BSC.TwistLowerAngle = -90
			BSC.TwistUpperAngle = 90
			BSC.Name = "BSC"
			v.Enabled = false
		end
	end
	Char.HumanoidRootPart.CanCollide = false
end

local function Unragdoll()
	for _, v in pairs(Char:GetDescendants()) do 
		if v:IsA("Motor6D") then
			local Att0 = v.Part0:FindFirstChild("Att0")
			local Att1 = v.Part1:FindFirstChild("Att1")
			local BSC = v.Part0:FindFirstChild("BSC")

			Att0:Destroy()
			Att1:Destroy()
			BSC:Destroy()
			v.Enabled = true
		end
	end

	Char.HumanoidRootPart.CanCollide = true
end

task.wait(10)

Ragdoll()

task.wait(15)

Unragdoll()
3 Likes

You can simply just disable the Motor6D instead of just removing it, and then to unragdoll you can do this:

for _, obj in ipairs(Char:GetDescendants()) do
if obj:IsA("Motor6D") then obj.Enabled = true end
if obj:IsA("BallSocketConstraint") then obj.Attachment1:Destroy() obj.Attachment0:Destroy() obj:Destroy() end
end

Keep in mind that if you’re doing this on the server, the client might have a “fake death”. In that case, you need to disable BreakJointsOnDeath.

4 Likes

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