The ragdoll works fine, its how if the player ragdolls standing still then he stays standing still unless pushed over
local humanoid = script.Parent:WaitForChild("Humanoid")
script.Using.Changed:Connect(function()
for index,joint in pairs(script.Parent:GetDescendants()) do
if joint:IsA("Motor6D") then
-- Ragdoll part
if script.Using.Value == true then
humanoid.BreakJointsOnDeath = false
humanoid.RequiresNeck = false
local socket = Instance.new("BallSocketConstraint")
humanoid:SetStateEnabled(Enum.HumanoidStateType.Ragdoll, true)
local a1 = Instance.new("Attachment")
local a2 = Instance.new("Attachment")
local part = Instance.new("Part")
local weld = Instance.new("Weld")
a1.Parent = joint.Part0
a2.Parent = joint.Part1
a1.Name = "Attachment"
a2.Name = "Attachment"
a1.CFrame = joint.C0
a2.CFrame = joint.C1
socket.Parent = joint.Parent
socket.Attachment0 = a1
socket.Attachment1 = a2
socket.Name = "BallSocketConstraint"
socket.LimitsEnabled = true
socket.TwistLimitsEnabled = true
socket.Enabled = true
part.Parent = joint.Part1
part.Name = "Connector"
part.Transparency = 1
part.CanCollide = true
part.Size = Vector3.new(joint.Part1.Size.X/1.25, joint.Part1.Size.Y/1.25, joint.Part1.Size.Z/1.25)
weld.Parent = joint.Part0
weld.Name = "Weld228"
weld.Part0 = joint.Part1
weld.Part1 = part
weld.Enabled = true
for i,v in pairs(script.Parent.Torso:GetChildren()) do
if v:IsA("Motor6D") then
v.Enabled = false
end
end
else
-- Unragdoll part
humanoid:SetStateEnabled(Enum.HumanoidStateType.Ragdoll, false)
for i,v in pairs(script.Parent.Torso:GetChildren()) do
if v:IsA("Motor6D") then
v.Enabled = true
end
end
for i,v in pairs(script.Parent:GetDescendants()) do
if v.Name == "Attachment" then
v:Destroy()
elseif v.Name == "Connector" then
v:Destroy()
elseif v.Name == "BallSocketConstraint" then
v:Destroy()
elseif v.Name == "Weld228" then
v:Destroy()
end
end
wait()
humanoid.RequiresNeck = true
end
end
end
end)
script.Ragdoll.OnServerEvent:Connect(function()
script.Using.Value = true
end)
script.UnRagdoll.OnServerEvent:Connect(function()
script.Using.Value = false
end)