Advertisement
HenloMyDude

spawn some gmod ragdolls

Aug 25th, 2019
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.10 KB | None | 0 0
  1. function ragdollkill(character)
  2. local victimshumanoid = character:findFirstChildOfClass("Humanoid")
  3. if not character:findFirstChild("UpperTorso") then
  4. character.Archivable = true
  5. for i,v in pairs(character:GetChildren()) do
  6. if v.ClassName == "Sound" then
  7. v:remove()
  8. end
  9. for q,w in pairs(v:GetChildren()) do
  10. if w.ClassName == "Sound" then
  11. w:remove()
  12. end
  13. end
  14. end
  15. local ragdoll = character:Clone()
  16. ragdoll.Name = " "
  17. ragdoll:BreakJoints()
  18. ragdoll:findFirstChildOfClass("Humanoid").Health = 0
  19. if ragdoll:findFirstChild("Health") then
  20. if ragdoll:findFirstChild("Health").ClassName == "Script" then
  21. ragdoll:findFirstChild("Health").Disabled = true
  22. end
  23. end
  24. for i,v in pairs(character:GetChildren()) do
  25. if v.ClassName == "ForceField" then
  26. v:destroy()
  27. end
  28. end
  29. ragdoll.Parent = workspace
  30. if ragdoll:findFirstChild("Right Arm") then
  31. local glue = Instance.new("Glue", ragdoll.Torso)
  32. glue.Part0 = ragdoll.Torso
  33. glue.Part1 = ragdoll:findFirstChild("Right Arm")
  34. glue.C0 = CFrame.new(1.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
  35. glue.C1 = CFrame.new(0, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
  36. local limbcollider = Instance.new("Part", ragdoll:findFirstChild("Right Arm"))
  37. limbcollider.Size = Vector3.new(1.4,1,1)
  38. limbcollider.Shape = "Cylinder"
  39. limbcollider.Transparency = 1
  40. limbcollider.Name = "LimbCollider"
  41. local limbcolliderweld = Instance.new("Weld", limbcollider)
  42. limbcolliderweld.Part0 = ragdoll:findFirstChild("Right Arm")
  43. limbcolliderweld.Part1 = limbcollider
  44. limbcolliderweld.C0 = CFrame.fromEulerAnglesXYZ(0,0,math.pi/2) * CFrame.new(-0.3,0,0)
  45. end
  46. if ragdoll:findFirstChild("Left Arm") then
  47. local glue = Instance.new("Glue", ragdoll.Torso)
  48. glue.Part0 = ragdoll.Torso
  49. glue.Part1 = ragdoll:findFirstChild("Left Arm")
  50. glue.C0 = CFrame.new(-1.5, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  51. glue.C1 = CFrame.new(0, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  52. local limbcollider = Instance.new("Part", ragdoll:findFirstChild("Left Arm"))
  53. limbcollider.Size = Vector3.new(1.4,1,1)
  54. limbcollider.Shape = "Cylinder"
  55. limbcollider.Name = "LimbCollider"
  56. limbcollider.Transparency = 1
  57. local limbcolliderweld = Instance.new("Weld", limbcollider)
  58. limbcolliderweld.Part0 = ragdoll:findFirstChild("Left Arm")
  59. limbcolliderweld.Part1 = limbcollider
  60. limbcolliderweld.C0 = CFrame.fromEulerAnglesXYZ(0,0,math.pi/2) * CFrame.new(-0.3,0,0)
  61. end
  62. if ragdoll:findFirstChild("Left Leg") then
  63. local glue = Instance.new("Glue", ragdoll.Torso)
  64. glue.Part0 = ragdoll.Torso
  65. glue.Part1 = ragdoll:findFirstChild("Left Leg")
  66. glue.C0 = CFrame.new(-0.5, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  67. glue.C1 = CFrame.new(-0, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  68. local limbcollider = Instance.new("Part", ragdoll:findFirstChild("Left Leg"))
  69. limbcollider.Size = Vector3.new(1.4,1,1)
  70. limbcollider.Shape = "Cylinder"
  71. limbcollider.Name = "LimbCollider"
  72. limbcollider.Transparency = 1
  73. local limbcolliderweld = Instance.new("Weld", limbcollider)
  74. limbcolliderweld.Part0 = ragdoll:findFirstChild("Left Leg")
  75. limbcolliderweld.Part1 = limbcollider
  76. limbcolliderweld.C0 = CFrame.fromEulerAnglesXYZ(0,0,math.pi/2) * CFrame.new(-0.3,0,0)
  77. end
  78. if ragdoll:findFirstChild("Right Leg") then
  79. local glue = Instance.new("Glue", ragdoll.Torso)
  80. glue.Part0 = ragdoll.Torso
  81. glue.Part1 = ragdoll:findFirstChild("Right Leg")
  82. glue.C0 = CFrame.new(0.5, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  83. glue.C1 = CFrame.new(0, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  84. local limbcollider = Instance.new("Part", ragdoll:findFirstChild("Right Leg"))
  85. limbcollider.Size = Vector3.new(1.4,1,1)
  86. limbcollider.Shape = "Cylinder"
  87. limbcollider.Name = "LimbCollider"
  88. limbcollider.Transparency = 1
  89. local limbcolliderweld = Instance.new("Weld", limbcollider)
  90. limbcolliderweld.Part0 = ragdoll:findFirstChild("Right Leg")
  91. limbcolliderweld.Part1 = limbcollider
  92. limbcolliderweld.C0 = CFrame.fromEulerAnglesXYZ(0,0,math.pi/2) * CFrame.new(-0.3,0,0)
  93. end
  94. if ragdoll:findFirstChild("Head") and ragdoll.Torso:findFirstChild("NeckAttachment") then
  95. local HeadAttachment = Instance.new("Attachment", ragdoll["Head"])
  96. HeadAttachment.Position = Vector3.new(0, -0.5, 0)
  97. local connection = Instance.new('HingeConstraint', ragdoll["Head"])
  98. connection.LimitsEnabled = true
  99. connection.Attachment0 = ragdoll.Torso.NeckAttachment
  100. connection.Attachment1 = HeadAttachment
  101. connection.UpperAngle = 60
  102. connection.LowerAngle = -60
  103. elseif ragdoll:findFirstChild("Head") and not ragdoll.Torso:findFirstChild("NeckAttachment") then
  104. local hedweld = Instance.new("Weld", ragdoll.Torso)
  105. hedweld.Part0 = ragdoll.Torso
  106. hedweld.Part1 = ragdoll.Head
  107. hedweld.C0 = CFrame.new(0,1.5,0)
  108. end
  109. game.Debris:AddItem(ragdoll, 30)
  110. wait(0.7)
  111. if ragdoll:findFirstChildOfClass("Humanoid") then
  112. ragdoll:findFirstChildOfClass("Humanoid").PlatformStand = true
  113. ragdoll:findFirstChildOfClass("Humanoid").DisplayDistanceType = "None"
  114. end
  115. if ragdoll:findFirstChild("HumanoidRootPart") then
  116. ragdoll:findFirstChild("HumanoidRootPart"):destroy()
  117. end
  118. elseif character:findFirstChild("UpperTorso") then
  119. character.Archivable = true
  120. for i,v in pairs(character:GetChildren()) do
  121. if v.ClassName == "Sound" then
  122. v:remove()
  123. end
  124. for q,w in pairs(v:GetChildren()) do
  125. if w.ClassName == "Sound" then
  126. w:remove()
  127. end
  128. end
  129. end
  130. local ragdoll = character:Clone()
  131. ragdoll:BreakJoints()
  132. ragdoll:findFirstChildOfClass("Humanoid").Health = 0
  133. if ragdoll:findFirstChild("Health") then
  134. if ragdoll:findFirstChild("Health").ClassName == "Script" then
  135. ragdoll:findFirstChild("Health").Disabled = true
  136. end
  137. end
  138. ragdoll.Parent = workspace
  139. local Humanoid = ragdoll:findFirstChildOfClass("Humanoid")
  140. Humanoid.PlatformStand = true
  141. local function makeballconnections(limb, attachementone, attachmenttwo, twistlower, twistupper)
  142. local connection = Instance.new('BallSocketConstraint', limb)
  143. connection.LimitsEnabled = true
  144. connection.Attachment0 = attachementone
  145. connection.Attachment1 = attachmenttwo
  146. connection.TwistLimitsEnabled = true
  147. connection.TwistLowerAngle = twistlower
  148. connection.TwistUpperAngle = twistupper
  149. local limbcollider = Instance.new("Part", limb)
  150. limbcollider.Size = Vector3.new(0.1,1,1)
  151. limbcollider.Shape = "Cylinder"
  152. limbcollider.Transparency = 1
  153. limbcollider:BreakJoints()
  154. local limbcolliderweld = Instance.new("Weld", limbcollider)
  155. limbcolliderweld.Part0 = limb
  156. limbcolliderweld.Part1 = limbcollider
  157. limbcolliderweld.C0 = CFrame.fromEulerAnglesXYZ(0,0,math.pi/2)
  158. end
  159. local function makehingeconnections(limb, attachementone, attachmenttwo, lower, upper)
  160. local connection = Instance.new('HingeConstraint', limb)
  161. connection.LimitsEnabled = true
  162. connection.Attachment0 = attachementone
  163. connection.Attachment1 = attachmenttwo
  164. connection.LimitsEnabled = true
  165. connection.LowerAngle = lower
  166. connection.UpperAngle = upper
  167. local limbcollider = Instance.new("Part", limb)
  168. limbcollider.Size = Vector3.new(0.1,1,1)
  169. limbcollider.Shape = "Cylinder"
  170. limbcollider.Transparency = 1
  171. limbcollider:BreakJoints()
  172. local limbcolliderweld = Instance.new("Weld", limbcollider)
  173. limbcolliderweld.Part0 = limb
  174. limbcolliderweld.Part1 = limbcollider
  175. limbcolliderweld.C0 = CFrame.fromEulerAnglesXYZ(0,0,math.pi/2)
  176. end
  177. local HeadAttachment = Instance.new("Attachment", Humanoid.Parent.Head)
  178. HeadAttachment.Position = Vector3.new(0, -0.5, 0)
  179. makehingeconnections(Humanoid.Parent.Head, HeadAttachment, ragdoll.UpperTorso.NeckAttachment, -50, 50)
  180. makehingeconnections(Humanoid.Parent.LowerTorso, Humanoid.Parent.LowerTorso.WaistRigAttachment, Humanoid.Parent.UpperTorso.WaistRigAttachment, -50, 50)
  181. makeballconnections(Humanoid.Parent.LeftUpperArm, Humanoid.Parent.LeftUpperArm.LeftShoulderRigAttachment, Humanoid.Parent.UpperTorso.LeftShoulderRigAttachment, -200, 200, 180)
  182. makehingeconnections(Humanoid.Parent.LeftLowerArm, Humanoid.Parent.LeftLowerArm.LeftElbowRigAttachment, Humanoid.Parent.LeftUpperArm.LeftElbowRigAttachment, 0, -60)
  183. makehingeconnections(Humanoid.Parent.LeftHand, Humanoid.Parent.LeftHand.LeftWristRigAttachment, Humanoid.Parent.LeftLowerArm.LeftWristRigAttachment, -20, 20)
  184. --
  185. makeballconnections(Humanoid.Parent.RightUpperArm, Humanoid.Parent.RightUpperArm.RightShoulderRigAttachment, Humanoid.Parent.UpperTorso.RightShoulderRigAttachment, -200, 200, 180)
  186. makehingeconnections(Humanoid.Parent.RightLowerArm, Humanoid.Parent.RightLowerArm.RightElbowRigAttachment, Humanoid.Parent.RightUpperArm.RightElbowRigAttachment, 0, -60)
  187. makehingeconnections(Humanoid.Parent.RightHand, Humanoid.Parent.RightHand.RightWristRigAttachment, Humanoid.Parent.RightLowerArm.RightWristRigAttachment, -20, 20)
  188. --
  189. makeballconnections(Humanoid.Parent.RightUpperLeg, Humanoid.Parent.RightUpperLeg.RightHipRigAttachment, Humanoid.Parent.LowerTorso.RightHipRigAttachment, -80, 80, 80)
  190. makehingeconnections(Humanoid.Parent.RightLowerLeg, Humanoid.Parent.RightLowerLeg.RightKneeRigAttachment, Humanoid.Parent.RightUpperLeg.RightKneeRigAttachment, 0, 60)
  191. makehingeconnections(Humanoid.Parent.RightFoot, Humanoid.Parent.RightFoot.RightAnkleRigAttachment, Humanoid.Parent.RightLowerLeg.RightAnkleRigAttachment, -20, 20)
  192. --
  193. makeballconnections(Humanoid.Parent.LeftUpperLeg, Humanoid.Parent.LeftUpperLeg.LeftHipRigAttachment, Humanoid.Parent.LowerTorso.LeftHipRigAttachment, -80, 80, 80)
  194. makehingeconnections(Humanoid.Parent.LeftLowerLeg, Humanoid.Parent.LeftLowerLeg.LeftKneeRigAttachment, Humanoid.Parent.LeftUpperLeg.LeftKneeRigAttachment, 0, 60)
  195. makehingeconnections(Humanoid.Parent.LeftFoot, Humanoid.Parent.LeftFoot.LeftAnkleRigAttachment, Humanoid.Parent.LeftLowerLeg.LeftAnkleRigAttachment, -20, 20)
  196. for i,v in pairs(Humanoid.Parent:GetChildren()) do
  197. if v.ClassName == "Accessory" then
  198. local attachment1 = v.Handle:findFirstChildOfClass("Attachment")
  199. if attachment1 then
  200. for q,w in pairs(Humanoid.Parent:GetChildren()) do
  201. if w.ClassName == "Part" then
  202. local attachment2 = w:findFirstChild(attachment1.Name)
  203. if attachment2 then
  204. local hinge = Instance.new("HingeConstraint", v.Handle)
  205. hinge.Attachment0 = attachment1
  206. hinge.Attachment1 = attachment2
  207. hinge.LimitsEnabled = true
  208. hinge.LowerAngle = 0
  209. hinge.UpperAngle = 0
  210. end
  211. end
  212. end
  213. end
  214. end
  215. end
  216. for i,v in pairs(ragdoll:GetChildren()) do
  217. for q,w in pairs(v:GetChildren()) do
  218. if w.ClassName == "Motor6D"--[[ and w.Name ~= "Neck"--]] then
  219. w:destroy()
  220. end
  221. end
  222. end
  223. if ragdoll:findFirstChild("HumanoidRootPart") then
  224. ragdoll.HumanoidRootPart.Anchored = true
  225. ragdoll.HumanoidRootPart.CanCollide = false
  226. end
  227. if ragdoll:findFirstChildOfClass("Humanoid") then
  228. ragdoll:findFirstChildOfClass("Humanoid").PlatformStand = true
  229. ragdoll:findFirstChildOfClass("Humanoid").DisplayDistanceType = "None"
  230. end
  231. end
  232. end
  233. function ded()
  234. ragdollkill(owner.Character)
  235. end
  236.  
  237. ded()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement