Advertisement
Rufus14

R6/R15 Ragdoll Death Script

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