Advertisement
Drvays

Ragdoll Script

Jul 5th, 2022
51,554
2
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 2 0
  1. local Humanoid = script.Parent:WaitForChild("Humanoid")
  2. Humanoid.BreakJointsOnDeath = false
  3.  
  4. Humanoid.Died:Connect(function()
  5. for index, joint in pairs(script.Parent:GetDescendants()) do
  6. if joint:IsA("Motor6D") then
  7. local socket = Instance.new("BallSocketConstraint")
  8. local a1 = Instance.new("Attachment")
  9. local a2 = Instance.new("Attachment")
  10. a1.Parent = joint.Part0
  11. a2.Parent = joint.Part1
  12. socket.Parent = joint.Parent
  13. socket.Attachment0 = a1
  14. socket.Attachment1 = a2
  15. a1.CFrame = joint.C0
  16. a2.CFrame = joint.C1
  17. socket.LimitsEnabled = true
  18. socket.TwistLimitsEnabled = true
  19. joint:Destroy()
  20. end
  21. end
  22. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement