saipitman12

Untitled

Oct 20th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. function Ragdoll(Character)
  2. local Joints = {}
  3. local Rotates = {}
  4. local Anim
  5. local Torso = Character:findFirstChild("Torso")
  6. if Torso then
  7. local Humanoid = Character:findFirstChild("Humanoid")
  8. Anim = Character:findFirstChild("Animate")
  9. for _, v in pairs(Torso:children()) do
  10. if v:IsA("Motor6D") then
  11. local Rotate = Instance.new("Rotate")
  12. Rotate.C0 = v.C0
  13. Rotate.C1 = v.C1
  14. Rotate.Part0 = v.Part0
  15. Rotate.Part1 = v.Part1
  16. Rotate.Name = v.Name
  17. local Rotate2 = Rotate:clone()
  18. Rotate2.C0 = Rotate.C0 * CFrame.Angles(0, math.rad(90), 0)
  19. table.insert(Joints, v)
  20. table.insert(Rotates, Rotate2)
  21. table.insert(Rotates, Rotate)
  22. end
  23. end
  24. local function Rotation()
  25. if Anim then
  26. Anim.Parent = nil
  27. end
  28. for _,v in pairs(Joints) do
  29. v.Parent = nil
  30. end
  31. for _,v in pairs(Rotates) do
  32. v.Parent = Torso
  33. end
  34. end
  35. local function Connect()
  36. for _,v in pairs(Rotates) do
  37. v.Parent = nil
  38. end
  39. for _,v in pairs(Joints) do
  40. v.Parent = Torso
  41. end
  42. if Anim then
  43. Anim.Parent = Character
  44. end
  45. end
  46. if Humanoid then
  47. Humanoid.Changed:connect(function(Derp)
  48. if Derp == "PlatformStand" then
  49. if Humanoid.PlatformStand then
  50. Rotation()
  51. else
  52. Connect()
  53. end
  54. end
  55. end)
  56. end
  57. end
  58. end
  59.  
  60. Ragdoll(workspace.xSoulStealerx)
Add Comment
Please, Sign In to add comment