SHARE
TWEET

ragdoll clone

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