Advertisement
InTesting

Dummy Function (returns a dummy ofc (and a table of func_S))

Jul 9th, 2019
332
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 11.35 KB | None | 0 0
  1. print'https://pastebin.com/8JMb5Xzv'
  2.  
  3. local function Make_R6_Rig()
  4.     local runs = game:GetService("RunService")
  5.    
  6.     local dum_number = 1
  7.    
  8.     local is_running = false
  9.     local is_jumpping = false
  10.    
  11.     local dummy_mod = Instance.new("Model",workspace)
  12.     for _,v in pairs(workspace:GetChildren())do
  13.         local vn = v.Name
  14.         if vn:sub(1,6):lower()=='dummy_'then
  15.             local num = tonumber(vn:sub(7))
  16.             if num then
  17.                 if num>dum_number then
  18.                     dum_number = num + 1
  19.                 end
  20.             end
  21.         end
  22.     end
  23.     dummy_mod.Name = 'Dummy_'.. dum_number
  24.    
  25.     local humanoid = Instance.new("Humanoid",dummy_mod)
  26.    
  27.     local head = Instance.new("Part",dummy_mod)
  28.     head.Name = 'Head'
  29.     head.Size = Vector3.new(2, 1, 1)
  30.    
  31.     local sm_1 = Instance.new("SpecialMesh",head)
  32.     sm_1.Scale = Vector3.new(1.25,1.25,1.25)
  33.    
  34.     local face = Instance.new("Decal",head)
  35.     face.Name = 'Face'
  36.     face.Texture = 'rbxassetid://288072938'
  37.    
  38.     local hrp = Instance.new("Part",dummy_mod)
  39.     hrp.Size = Vector3.new(2, 2, 1)
  40.     hrp.Name = 'HumanoidRootPart'
  41.     hrp.Transparency = 1
  42.    
  43.     dummy_mod.PrimaryPart = hrp
  44.    
  45.     local larm = Instance.new("Part",dummy_mod)
  46.     larm.Name = 'Left Arm'
  47.     larm.Size = Vector3.new(1, 2, 1)
  48.    
  49.     local lleg = Instance.new("Part",dummy_mod)
  50.     lleg.Name = 'Left Leg'
  51.     lleg.Size = Vector3.new(1, 2, 1)
  52.    
  53.     local rarm = Instance.new("Part",dummy_mod)
  54.     rarm.Name = 'Right Arm'
  55.     rarm.Size = Vector3.new(1, 2, 1)
  56.    
  57.     local rleg = Instance.new("Part",dummy_mod)
  58.     rleg.Name = 'Right Leg'
  59.     rleg.Size = Vector3.new(1, 2, 1)
  60.    
  61.     local torso = Instance.new("Part",dummy_mod)
  62.     torso.Name = 'Torso'
  63.     torso.Size = Vector3.new(2, 2, 1)
  64.    
  65.     local rh = Instance.new("Motor6D",hrp)
  66.     rh.Name = 'Root Hip'
  67.     rh.C1 = CFrame.new(0, 0, 0)
  68.     rh.MaxVelocity = .1
  69.     rh.Part0 = hrp
  70.     rh.Part1 = torso
  71.    
  72.     local neck = Instance.new("Motor6D",torso)
  73.     neck.Name = 'Neck'
  74.     neck.C0 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
  75.     neck.C1 = CFrame.new(0, -1.5, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
  76.     neck.MaxVelocity = .1
  77.     neck.Part0 = torso
  78.     neck.Part1 = head
  79.    
  80.     local r_s = Instance.new("Motor6D",torso)
  81.     r_s.Name = 'Right Shoulder'
  82.     r_s.C0 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
  83.     r_s.C1 = CFrame.new(-1.5, 0, -2.98023224e-08, -0.999999881, 0, 0, 0, 1.78813934e-07, 1, 0, 1, -1.78813934e-07)
  84.     r_s.MaxVelocity = .1
  85.     r_s.Part0 = torso
  86.     r_s.Part1 = rarm
  87.    
  88.     local l_s = Instance.new("Motor6D",torso)
  89.     l_s.Name = 'Left Shoulder'
  90.     l_s.C0 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
  91.     l_s.C1 = CFrame.new(1.5, 0, -2.98023224e-08, -0.999999881, 0, 0, 0, 0, 1, 0, 1, 0)
  92.     l_s.MaxVelocity = .1
  93.     l_s.Part0 = torso
  94.     l_s.Part1 = larm
  95.    
  96.     local r_h = Instance.new("Motor6D",torso)
  97.     r_h.Name = 'Right Hip'
  98.     r_h.C0 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
  99.     r_h.C1 = CFrame.new(-0.5, 2, -1.1920929e-07, -0.99999994, 0, 0, 0, 5.56362707e-08, 1, 0, 1, -5.56362707e-08)
  100.     r_h.MaxVelocity = .1
  101.     r_h.Part0 = torso
  102.     r_h.Part1 = rleg
  103.    
  104.     local l_h = Instance.new("Motor6D",torso)
  105.     l_h.Name = 'Left Hip'
  106.     l_h.C0 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
  107.     l_h.C1 = CFrame.new(0.5, 2, -1.1920929e-07, -0.99999994, 0, 0, 0, 5.56362707e-08, 1, 0, 1, -5.56362707e-08)
  108.     l_h.MaxVelocity = .1
  109.     l_h.Part0 = torso
  110.     l_h.Part1 = lleg
  111.    
  112.     local bodycolors = Instance.new("BodyColors",dummy_mod)
  113.    
  114.     local function Noob_Rig()
  115.         if bodycolors then
  116.             bodycolors.HeadColor = BrickColor.new("New Yeller")
  117.             bodycolors.LeftArmColor = BrickColor.new("New Yeller")
  118.             bodycolors.RightArmColor = BrickColor.new("New Yeller")
  119.            
  120.             bodycolors.LeftLegColor = BrickColor.new("Forest green")
  121.             bodycolors.RightLegColor = BrickColor.new("Forest green")
  122.            
  123.             bodycolors.TorsoColor = BrickColor.new("Dark blue")
  124.         end
  125.     end
  126.     Noob_Rig()
  127.    
  128.     local function Anim_Stand()
  129.         rh.C1 = CFrame.new(0, 0, 0)
  130.         local increment = 2.5
  131.  
  132.         for i=1,increment do
  133.             neck.C0 = neck.C0:Lerp( CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0),i/increment )
  134.             neck.C1 = neck.C1:Lerp( CFrame.new(0, -1.5, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0),i/increment )
  135.            
  136.             r_s.C0 = r_s.C0:Lerp(CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0),i/increment )
  137.             r_s.C1 = r_s.C1:Lerp(CFrame.new(-1.5, 0, -2.98023224e-08, -0.999999881, 0, 0, 0, 1.78813934e-07, 1, 0, 1, -1.78813934e-07),i/increment )
  138.            
  139.             r_h.C0 = r_h.C0:Lerp( CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0),i/increment )
  140.             r_h.C1 = r_h.C1:Lerp( CFrame.new(-0.5, 2, -1.1920929e-07, -0.99999994, 0, 0, 0, 5.56362707e-08, 1, 0, 1, -5.56362707e-08),i/increment )
  141.            
  142.             l_s.C0 = l_s.C0:Lerp(CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0),i/increment )
  143.             l_s.C1 = l_s.C1:Lerp(CFrame.new(1.5, 0, -2.98023224e-08, -0.999999881, 0, 0, 0, 0, 1, 0, 1, 0),i/increment )
  144.            
  145.             l_h.C0 = l_h.C0:Lerp(CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0),i/increment )
  146.             l_h.C1 = l_h.C1:Lerp(CFrame.new(0.5, 2, -1.1920929e-07, -0.99999994, 0, 0, 0, 5.56362707e-08, 1, 0, 1, -5.56362707e-08),i/increment )
  147.            
  148.             wait(.0001)
  149.         end
  150.     end
  151.     local function Anim_Sit()
  152.         local rh_end_pos = CFrame.new(0, 0, 0)
  153.         local increment = 2.5
  154.  
  155.         rh.C1 = rh_end_pos
  156.         for i=1,increment  do
  157.             r_s.C0 = r_s.C0:Lerp(CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0),i/increment )
  158.             r_s.C1 = r_s.C1:Lerp(CFrame.new(-1.5, 0.5, 0.5, -0.99999994, 0, 0, 0, 1, -2.2252533e-07, 0, -2.2252533e-07, -1),i/increment )
  159.            
  160.             l_s.C0 = l_s.C0:Lerp(CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0),i/increment )
  161.             l_s.C1 = l_s.C1:Lerp(CFrame.new(1.50000012, 0.49999997, 0.5, -0.999999821, 0, 0, 0, 1, -4.37113883e-08, 0, -4.37113883e-08, -1),i/increment )
  162.            
  163.             neck.C0 = neck.C0:Lerp(CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0),i/increment )
  164.             neck.C1 = neck.C1:Lerp(CFrame.new(0, -1.5, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0),i/increment )
  165.            
  166.             l_h.C0 = l_h.C0:Lerp(CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0),i/increment )
  167.             l_h.C1 = l_h.C1:Lerp(CFrame.new(0.5, 0.999999762, -1, -0.999999881, 0, 0, 0, 1, -9.9347659e-08, 0, -9.9347659e-08, -1),i/increment )
  168.            
  169.             r_h.C0 = r_h.C0:Lerp(CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0),i/increment )
  170.             r_h.C1 = r_h.C1:Lerp(CFrame.new(-0.5, 0.999999881, -0.999999881, -0.99999994, 0, 0, 0, 0.99999994, -5.96046448e-08, 0, -5.96046448e-08, -0.99999994),i/increment )
  171.            
  172.             wait(.01)
  173.         end
  174.     end
  175.     local function Anim_Walkstep_LL_Forward()
  176.         local rh_end_pos = CFrame.new(0, 0, 0)
  177.         local increment = 2.5
  178.  
  179.         rh.C1 = rh_end_pos
  180.         for i=1,increment  do
  181.             neck.C0 = neck.C0:Lerp( CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0),i/increment )
  182.             neck.C1 = neck.C1:Lerp( CFrame.new(0, -1.5, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0),i/increment )
  183.            
  184.             r_s.C0 = r_s.C0:Lerp(CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0),i/increment )
  185.             r_s.C1 = r_s.C1:Lerp(CFrame.new(-1.49999809, 0.0855050758, 0.234923139, -0.999999285, 0, 0, 0, 0.342020124, 0.939692616, 0, 0.939692616, -0.342020124),i/increment )
  186.            
  187.             l_s.C0 = l_s.C0:Lerp(CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0),i/increment )
  188.             l_s.C1 = l_s.C1:Lerp(CFrame.new(1.49997425, 0.0855049267, -0.234923184, -0.999997616, 0, 0, 0, -0.342019886, 0.939692676, 0, 0.939692676, 0.342019886),i/increment )
  189.            
  190.             l_h.C0 = l_h.C0:lerp(CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0),i/increment )
  191.             l_h.C1 = l_h.C1:Lerp(CFrame.new(0.49999547, 1.91449487, -0.234923124, -0.999998331, 0, 0, 0, 0.342019796, 0.939692736, 0, 0.939692736, -0.342019796),i/increment )
  192.            
  193.             r_h.C0 = r_h.C0:Lerp(CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0),i/increment )
  194.             r_h.C1 = r_h.C1:Lerp(CFrame.new(-0.499967217, 1.91449142, 0.234921545, -0.999995232, 0, 0, 0, -0.342019886, 0.939692676, 0, 0.939692676, 0.342019886),i/increment )
  195.             wait(.0001)
  196.         end
  197.     end
  198.     local function Anim_Walkstep_RL_Forward()
  199.         local rh_end_pos = CFrame.new(0, 0, 0)
  200.         local increment = 2.5
  201.  
  202.         rh.C1 = rh_end_pos
  203.         for i=1,increment  do
  204.             neck.C0 = neck.C0:Lerp( CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0),i/increment )
  205.             neck.C1 = neck.C1:Lerp( CFrame.new(0, -1.5, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0),i/increment )
  206.            
  207.             r_s.C0 = r_s.C0:Lerp(CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0),i/increment )
  208.             r_s.C1 = r_s.C1:Lerp(CFrame.new(-1.49997365, 0.0855049565, -0.234923184, -0.999997377, 0, 0, 0, -0.342019975, 0.939692676, 0, 0.939692676, 0.342019975),i/increment )
  209.            
  210.             l_s.C0 = l_s.C0:Lerp(CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0),i/increment )
  211.             l_s.C1 = l_s.C1:Lerp(CFrame.new(1.49999738, 0.0855051354, 0.234923124, -0.999999285, 0, 0, 0, 0.342020363, 0.939692557, 0, 0.939692557, -0.342020363),i/increment )
  212.            
  213.             l_h.C0 = l_h.C0:lerp(CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0),i/increment )
  214.             l_h.C1 = l_h.C1:Lerp(CFrame.new(0.499991179, 1.91449475, 0.234923005, -0.999997616, 0, 0, 0, -0.34202069, 0.939692438, 0, 0.939692438, 0.34202069),i/increment )
  215.            
  216.             r_h.C0 = r_h.C0:Lerp(CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0),i/increment )
  217.             r_h.C1 = r_h.C1:Lerp(CFrame.new(-0.499979973, 1.91449165, -0.234922379, -0.999996424, 0, 0, 0, 0.342020541, 0.939692378, 0, 0.939692378, -0.342020541),i/increment )
  218.            
  219.             wait(.0001)
  220.         end
  221.     end
  222.    
  223.     local function Anim_Walk_Cycle_Run_Once()
  224.         Anim_Walkstep_LL_Forward()
  225.         wait(.01)
  226.         Anim_Stand()
  227.         wait(.01)
  228.         Anim_Walkstep_RL_Forward()
  229.         wait(.01)
  230.         Anim_Stand()
  231.         wait(.01)
  232.     end
  233.    
  234.     local function Anim_Jump_Force_Up()
  235.         local rh_end_pos = CFrame.new(0, 0, 0)
  236.         local increment = 10
  237.  
  238.         rh.C1 = rh_end_pos
  239.         for i=1,increment  do
  240.             neck.C0 = neck.C0:Lerp(CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0),i/increment)
  241.             neck.C1 = neck.C1:Lerp(CFrame.new(0, -1.5, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0),i/increment)
  242.            
  243.             r_s.C0 = r_s.C0:Lerp(CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0),i/increment)
  244.             r_s.C1 = r_s.C1:Lerp(CFrame.new(-1.49998295, 1.73428547, 0.205556601, -0.999998093, 0, 0, 0, 0.342020035, -0.939692676, -0, -0.939692676, -0.342020035),i/increment)
  245.            
  246.             l_s.C0 = l_s.C0:Lerp(CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0),i/increment)
  247.             l_s.C1 = l_s.C1:Lerp(CFrame.new(1.49977911, 1.73428452, 0.205555528, -0.999993086, 0, 0, 0, 0.342019558, -0.939692795, -0, -0.939692795, -0.342019558),i/increment)
  248.            
  249.             l_h.C0 = l_h.C0:Lerp(CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0),i/increment)
  250.             l_h.C1 = l_h.C1:Lerp(CFrame.new(0.499999523, 1.96527028, 0.196961537, -0.999999523, 0, 0, 0, -0.173648179, 0.98480773, 0, 0.98480773, 0.173648179),i/increment)
  251.            
  252.             r_h.C0 = r_h.C0:Lerp(CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0),i/increment)
  253.             r_h.C1 = r_h.C1:Lerp(CFrame.new(-0.499999881, 1.9652704, 0.196961552, -0.999999762, 0, 0, 0, -0.173648179, 0.98480773, 0, 0.98480773, 0.173648179),i/increment)
  254.            
  255.             wait(.0001)
  256.         end
  257.     end
  258.    
  259.     humanoid.StateChanged:Connect(function(s)
  260.         if (s==Enum.HumanoidStateType.Running or
  261.             s==Enum.HumanoidStateType.RunningNoPhysics)and
  262.             is_running==false then
  263.             is_running = true
  264.             while is_running==true do
  265.                 Anim_Walk_Cycle_Run_Once()
  266.                 if humanoid:GetState()~=Enum.HumanoidStateType.Running and
  267.                     humanoid:GetState()~=Enum.HumanoidStateType.RunningNoPhysics then
  268.                     is_running = false
  269.                     break
  270.                 end
  271.                 wait(.1)
  272.             end
  273.         elseif Enum.HumanoidStateType.Jumping==s and is_jumpping==false then
  274.             Anim_Jump_Force_Up()
  275.             is_jumpping = true
  276.         elseif s==Enum.HumanoidStateType.Landed and is_jumpping then
  277.             is_jumpping = false
  278.             Anim_Stand()
  279.         end
  280.     end)   
  281.  
  282.     humanoid:MoveTo(Vector3.new(100,0,0))
  283.  
  284.     return dummy_mod,{Anim_Stand,
  285.         Anim_Sit,
  286.         Anim_Walkstep_LL_Forward,
  287.         Anim_Walkstep_RL_Forward,
  288.         Anim_Jump_Force_Up}
  289. end
  290. Make_R6_Rig()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement