Advertisement
mr2meows

2013

Jun 26th, 2022 (edited)
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.50 KB | None | 0 0
  1. owner.Character:FindFirstChildWhichIsA("Script"):Destroy()
  2. for i,v in pairs(owner.Character.Humanoid:FindFirstChildWhichIsA("Animator"):GetPlayingAnimationTracks()) do
  3.     v:Stop()
  4. end
  5. print("scripts taken from version 95d80c003e3a4601 of the roblox client")
  6. --these are cool november 2013 scrips
  7.  
  8. function waitForChild(parent, childName)
  9.     local child = parent:findFirstChild(childName)
  10.     if child then return child end
  11.     while true do
  12.         child = parent.ChildAdded:wait()
  13.         if child.Name==childName then return child end
  14.     end
  15. end
  16.  
  17. -- ANIMATION
  18.  
  19. -- declarations
  20.  
  21. local Figure = owner.Character
  22. local Torso = waitForChild(Figure, "Torso")
  23. local RightShoulder = waitForChild(Torso, "Right Shoulder")
  24. local LeftShoulder = waitForChild(Torso, "Left Shoulder")
  25. local RightHip = waitForChild(Torso, "Right Hip")
  26. local LeftHip = waitForChild(Torso, "Left Hip")
  27. local Neck = waitForChild(Torso, "Neck")
  28. local Humanoid = waitForChild(Figure, "Humanoid")
  29. local pose = "Standing"
  30.  
  31. local toolAnim = "None"
  32. local toolAnimTime = 0
  33.  
  34. local jumpMaxLimbVelocity = 0.75
  35.  
  36. -- functions
  37.  
  38. function onRunning(speed)
  39.     if speed>0 then
  40.         pose = "Running"
  41.     else
  42.         pose = "Standing"
  43.     end
  44. end
  45.  
  46. function onDied()
  47.     pose = "Dead"
  48. end
  49.  
  50. function onJumping()
  51.     pose = "Jumping"
  52. end
  53.  
  54. function onClimbing()
  55.     pose = "Climbing"
  56. end
  57.  
  58. function onGettingUp()
  59.     pose = "GettingUp"
  60. end
  61.  
  62. function onFreeFall()
  63.     pose = "FreeFall"
  64. end
  65.  
  66. function onFallingDown()
  67.     pose = "FallingDown"
  68. end
  69.  
  70. function onSeated()
  71.     pose = "Seated"
  72. end
  73.  
  74. function onPlatformStanding()
  75.     pose = "PlatformStanding"
  76. end
  77.  
  78. function onSwimming(speed)
  79.     if speed>0 then
  80.         pose = "Running"
  81.     else
  82.         pose = "Standing"
  83.     end
  84. end
  85.  
  86. function moveJump()
  87.     RightShoulder.MaxVelocity = jumpMaxLimbVelocity
  88.     LeftShoulder.MaxVelocity = jumpMaxLimbVelocity
  89.   RightShoulder:SetDesiredAngle(3.14)
  90.     LeftShoulder:SetDesiredAngle(-3.14)
  91.     RightHip:SetDesiredAngle(0)
  92.     LeftHip:SetDesiredAngle(0)
  93. end
  94.  
  95.  
  96. -- same as jump for now
  97.  
  98. function moveFreeFall()
  99.     RightShoulder.MaxVelocity = jumpMaxLimbVelocity
  100.     LeftShoulder.MaxVelocity = jumpMaxLimbVelocity
  101.     RightShoulder:SetDesiredAngle(3.14)
  102.     LeftShoulder:SetDesiredAngle(-3.14)
  103.     RightHip:SetDesiredAngle(0)
  104.     LeftHip:SetDesiredAngle(0)
  105. end
  106.  
  107. function moveSit()
  108.     RightShoulder.MaxVelocity = 0.15
  109.     LeftShoulder.MaxVelocity = 0.15
  110.     RightShoulder:SetDesiredAngle(3.14 /2)
  111.     LeftShoulder:SetDesiredAngle(-3.14 /2)
  112.     RightHip:SetDesiredAngle(3.14 /2)
  113.     LeftHip:SetDesiredAngle(-3.14 /2)
  114. end
  115.  
  116. function getTool() 
  117.     for _, kid in ipairs(Figure:GetChildren()) do
  118.         if kid.className == "Tool" then return kid end
  119.     end
  120.     return nil
  121. end
  122.  
  123. function getToolAnim(tool)
  124.     for _, c in ipairs(tool:GetChildren()) do
  125.         if c.Name == "toolanim" and c.className == "StringValue" then
  126.             return c
  127.         end
  128.     end
  129.     return nil
  130. end
  131.  
  132. function animateTool()
  133.    
  134.     if (toolAnim == "None") then
  135.         RightShoulder:SetDesiredAngle(1.57)
  136.         return
  137.     end
  138.  
  139.     if (toolAnim == "Slash") then
  140.         RightShoulder.MaxVelocity = 0.5
  141.         RightShoulder:SetDesiredAngle(0)
  142.         return
  143.     end
  144.  
  145.     if (toolAnim == "Lunge") then
  146.         RightShoulder.MaxVelocity = 0.5
  147.         LeftShoulder.MaxVelocity = 0.5
  148.         RightHip.MaxVelocity = 0.5
  149.         LeftHip.MaxVelocity = 0.5
  150.         RightShoulder:SetDesiredAngle(1.57)
  151.         LeftShoulder:SetDesiredAngle(1.0)
  152.         RightHip:SetDesiredAngle(1.57)
  153.         LeftHip:SetDesiredAngle(1.0)
  154.         return
  155.     end
  156. end
  157.  
  158. function move(time)
  159.     local amplitude
  160.     local frequency
  161.  
  162.     if (pose == "Jumping") then
  163.         moveJump()
  164.         return
  165.     end
  166.  
  167.     if (pose == "FreeFall") then
  168.         moveFreeFall()
  169.         return
  170.     end
  171.  
  172.     if (pose == "Seated") then
  173.         moveSit()
  174.         return
  175.     end
  176.  
  177.     local climbFudge = 0
  178.    
  179.     if (pose == "Running") then
  180.     if (RightShoulder.CurrentAngle > 1.5 or RightShoulder.CurrentAngle < -1.5) then
  181.             RightShoulder.MaxVelocity = jumpMaxLimbVelocity
  182.         else           
  183.             RightShoulder.MaxVelocity = 0.15
  184.         end
  185.         if (LeftShoulder.CurrentAngle > 1.5 or LeftShoulder.CurrentAngle < -1.5) then
  186.             LeftShoulder.MaxVelocity = jumpMaxLimbVelocity
  187.         else           
  188.             LeftShoulder.MaxVelocity = 0.15
  189.         end
  190.         amplitude = 1
  191.         frequency = 9
  192.     elseif (pose == "Climbing") then
  193.         RightShoulder.MaxVelocity = 0.5
  194.         LeftShoulder.MaxVelocity = 0.5
  195.         amplitude = 1
  196.         frequency = 9
  197.         climbFudge = 3.14
  198.     else
  199.         amplitude = 0.1
  200.         frequency = 1
  201.     end
  202.  
  203.     desiredAngle = amplitude * math.sin(time*frequency)
  204.  
  205.     RightShoulder:SetDesiredAngle(desiredAngle + climbFudge)
  206.     LeftShoulder:SetDesiredAngle(desiredAngle - climbFudge)
  207.     RightHip:SetDesiredAngle(-desiredAngle)
  208.     LeftHip:SetDesiredAngle(-desiredAngle)
  209.  
  210.  
  211.     local tool = getTool()
  212.  
  213.     if tool then
  214.    
  215.         animStringValueObject = getToolAnim(tool)
  216.  
  217.         if animStringValueObject then
  218.             toolAnim = animStringValueObject.Value
  219.             -- message recieved, delete StringValue
  220.             animStringValueObject.Parent = nil
  221.             toolAnimTime = time + .3
  222.         end
  223.  
  224.         if time > toolAnimTime then
  225.             toolAnimTime = 0
  226.             toolAnim = "None"
  227.         end
  228.  
  229.         animateTool()
  230.  
  231.        
  232.     else
  233.         toolAnim = "None"
  234.         toolAnimTime = 0
  235.     end
  236. end
  237.  
  238.  
  239. -- connect events
  240.  
  241. Humanoid.Died:connect(onDied)
  242. Humanoid.Running:connect(onRunning)
  243. Humanoid.Jumping:connect(onJumping)
  244. Humanoid.Climbing:connect(onClimbing)
  245. Humanoid.GettingUp:connect(onGettingUp)
  246. Humanoid.FreeFalling:connect(onFreeFall)
  247. Humanoid.FallingDown:connect(onFallingDown)
  248. Humanoid.Seated:connect(onSeated)
  249. Humanoid.PlatformStanding:connect(onPlatformStanding)
  250. Humanoid.Swimming:connect(onSwimming)
  251. -- main program
  252.  
  253. local runService = game:service("RunService");
  254.  
  255. while Figure.Parent~=nil do
  256.     local _, time = wait(0.1)
  257.     move(time)
  258. end
  259.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement