Advertisement
Rufus14

Global Ragdoll Death

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