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()
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.