SHARE
TWEET

ragdoll spawner

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