Advertisement
InTesting

Death Effect: Global Ragdoll (Under 50 lines)

Nov 28th, 2019
540
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.71 KB | None | 0 0
  1. print'https://pastebin.com/raw/5QSqffmx';
  2. local function Instance_2(c,p)if not c then return;end;p=p or {};
  3. local a=Instance.new(c,p.Parent);for b,c in pairs(p)do local _,d= pcall(function()a[b]=c;end);
  4. if d then print(d);end;end;return a;end;
  5. local function Ragdoll_v2(model)local hum=model:FindFirstChildWhichIsA'Humanoid';if not hum then
  6.     return;end;hum.BreakJointsOnDeath=false;
  7.     local LArm,RArm,LLeg,RLeg,torso,head,LUA,LLA,LH,RUA,RLA,RH,LUL,LLL,LF,RUL,RLL,RF,UT,LT=
  8.         model:FindFirstChild'Left Arm',model:FindFirstChild'Right Arm',model:FindFirstChild
  9.         'Left Leg',model:FindFirstChild'Right Leg',model:FindFirstChild'Torso',model:
  10.         FindFirstChild'Head',model:FindFirstChild'LeftUpperArm',model:FindFirstChild'LeftLowerArm',
  11.         model:FindFirstChild'LeftHand',model:FindFirstChild'RightUpperArm',model:FindFirstChild
  12.         'RightLowerArm',model:FindFirstChild'RightHand',model:FindFirstChild'LeftUpperLeg',model:
  13.         FindFirstChild'LeftLowerLeg',model:FindFirstChild'LeftFoot',model:FindFirstChild
  14.         'RightUpperLeg',model:FindFirstChild'RightLowerLeg',model:FindFirstChild'RightFoot',model:
  15.         FindFirstChild'UpperTorso',model:FindFirstChild'LowerTorso';
  16.     local Set={{{LArm;{Orientation=Vector3.new(0,180,0);Position=Vector3.new(-1,1,0)};
  17.     {Orientation=Vector3.new(0,180,0);Position=Vector3.new(.5,1,0)};{LimitsEnabled=true;
  18.     UpperAngle=15;TwistLimitsEnabled=true;UpperAngle=-45;TwistLowerAngle=-45;};};{RArm;
  19.     {Orientation=Vector3.new(0,0,0);Position=Vector3.new(1,1,0);};{Orientation=
  20.     Vector3.new(0,0,0);Position=Vector3.new(-.5,1,0);};{LimitsEnabled=true;UpperAngle=15;
  21.     TwistLimitsEnabled=true;UpperAngle=-45;TwistLowerAngle=-45;};};{RLeg;{Orientation=
  22.     Vector3.new(90,0,-90);Position=Vector3.new(.5,-1,0);};{Orientation=Vector3.new(90,0,-90);
  23.     Position=Vector3.new(0,1,0);};{LimitsEnabled=true;UpperAngle=165;};};{LLeg;{Orientation=
  24.     Vector3.new(90,0,-90);Position=Vector3.new(-.5,-1,0);};{Orientation=Vector3.new(90,0,-90);
  25.     Position=Vector3.new(0,1,0);};{LimitsEnabled=true;UpperAngle=165;};};{head;{Orientation=
  26.     Vector3.new(180,90,0);Position=Vector3.new(0,1,0);};{Orientation=Vector3.new(180,90,0);
  27.     Position=Vector3.new(0,-.5,0);};{LimitsEnabled=true;UpperAngle=75;TwistLimitsEnabled=true;
  28.     UpperAngle=-45;TwistLowerAngle=-45};};};{{LF;LLL;'LeftAnkleRigAttachment';};{LLL;LUL;
  29.     'LeftKneeRigAttachment';};{LUL;LT;'LeftHipRigAttachment';};{RF;RLL;'RightAnkleRigAttachment'
  30.     ;};{RLL;RUL;'RightKneeRigAttachment';};{RUL;LT;'RightHipRigAttachment';};{LH;LLA;
  31.     'LeftWristRigAttachment';};{LLA;LUA;'LeftElbowRigAttachment';};{LUA;UT;
  32.     'LeftShoulderAttachment';'LeftCollarAttachment'};{RH;RLA;'RightWristRigAttachment';};{RLA;
  33.     RUA;'RightElbowRigAttachment';};{RUA;UT;'RightShoulderAttachment';'RightCollarAttachment'};
  34.     {LT;UT;'WaistRigAttachment'};{UT;head;'NeckRigAttachment';nil;{LimitsEnabled=true;
  35.     UpperAngle=-75;TwistLimitsEnabled=true;UpperAngle=-45;TwistLowerAngle=-45;};};};};
  36.     hum.Died:Connect(function()for _,a in pairs(model:GetDescendants())do if a:IsA'Motor6D'then
  37.     a:Destroy();end;end;if hum.RigType==Enum.HumanoidRigType.R6 then for _,a in pairs(Set[1])do
  38.     local b,c;if torso then a[2].Parent,a[2].Orientation=torso,a[2].Orientation+torso.Orientation;
  39.     b=Instance_2('Attachment',a[2]);end;if a[1]then
  40.     a[3].Parent,a[3].Orientation=a[1],a[3].Orientation+a[1].Orientation;
  41.     c=Instance_2('Attachment',a[3])end;a[4].Parent,a[4].Attachment0,a[4].Attachment1=torso,b,c;
  42.     Instance_2('BallSocketConstraint',a[4])end;else for _,a in pairs(Set[2])do local b=a[5]or{};
  43.     if a[1]then b.Attachment0=a[1][a[3]];end;if a[2]then b.Attachment1=a[2][a[4]or a[3]];end;
  44.     b.Parent=UT;Instance_2('BallSocketConstraint',b);end;end;end);  
  45. end;
  46. for _,a in pairs(workspace:GetChildren())do
  47.     Ragdoll_v2(a)
  48. end;
  49. workspace.ChildAdded:Connect(Ragdoll_v2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement