Advertisement
9Simplicity9

Untitled

Jul 20th, 2018
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.51 KB | None | 0 0
  1. local newMotor = function(part0, part1, c0, c1)
  2. local w = Instance.new('Motor', part0)
  3. w.Part0 = part0
  4. w.Part1 = part1
  5. w.C0 = c0
  6. w.C1 = c1
  7. return w
  8. end
  9.  
  10. function clerp(a, b, t)
  11. return a:lerp(b, t)
  12. end
  13.  
  14. RootCF = CFrame.fromEulerAnglesXYZ(-1.57, 0, 3.14)
  15. NeckCF = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
  16.  
  17. local RW = newMotor(Torso, RightArm, CFrame.new(1.5, 0, 0), CFrame.new(0, 0, 0))
  18. local LW = newMotor(Torso, LeftArm, CFrame.new(-1.5, 0, 0), CFrame.new(0, 0, 0))
  19. local RH = newMotor(Torso, RightLeg, CFrame.new(.5, -2, 0), CFrame.new(0, 0, 0))
  20. local LH = newMotor(Torso, LeftLeg, CFrame.new(-.5, -2, 0), CFrame.new(0, 0, 0))
  21. RootJoint.C1 = CFrame.new(0, 0, 0)
  22. RootJoint.C0 = CFrame.new(0, 0, 0)
  23. Torso.Neck.C1 = CFrame.new(0, 0, 0)
  24. Torso.Neck.C0 = CFrame.new(0, 1.5, 0)
  25.  
  26. local rarmc1 = RW.C1
  27. local larmc1 = LW.C1
  28. local rlegc1 = RH.C1
  29. local llegc1 = LH.C1
  30.  
  31. local resetc1 = false
  32.  
  33. function PlayAnimationFromTable(table, speed, bool)
  34. RootJoint.C0 = clerp(RootJoint.C0, table[1], speed)
  35. Torso.Neck.C0 = clerp(Torso.Neck.C0, table[2], speed)
  36. RW.C0 = clerp(RW.C0, table[3], speed)
  37. LW.C0 = clerp(LW.C0, table[4], speed)
  38. RH.C0 = clerp(RH.C0, table[5], speed)
  39. LH.C0 = clerp(LH.C0, table[6], speed)
  40. if bool == true then
  41. if resetc1 == false then
  42. resetc1 = true
  43. RootJoint.C1 = RootJoint.C1
  44. Torso.Neck.C1 = Torso.Neck.C1
  45. RW.C1 = rarmc1
  46. LW.C1 = larmc1
  47. RH.C1 = rlegc1
  48. LH.C1 = llegc1
  49. end
  50. end
  51. end
  52.  
  53. ArtificialHB = Instance.new("BindableEvent", script)
  54. ArtificialHB.Name = "Heartbeat"
  55.  
  56. script:WaitForChild("Heartbeat")
  57.  
  58. frame = 1 / 30
  59. tf = 0
  60. allowframeloss = false
  61. tossremainder = false
  62. lastframe = tick()
  63. script.Heartbeat:Fire()
  64.  
  65. game:GetService("RunService").Heartbeat:connect(function(s, p)
  66. tf = tf + s
  67. if tf >= frame then
  68. if allowframeloss then
  69. script.Heartbeat:Fire()
  70. lastframe = tick()
  71. else
  72. for i = 1, math.floor(tf / frame) do
  73. script.Heartbeat:Fire()
  74. end
  75. lastframe = tick()
  76. end
  77. if tossremainder then
  78. tf = 0
  79. else
  80. tf = tf - frame * math.floor(tf / frame)
  81. end
  82. end
  83. end)
  84.  
  85. function swait(num)
  86. if num == 0 or num == nil then
  87. ArtificialHB.Event:wait()
  88. else
  89. for i = 0, num do
  90. ArtificialHB.Event:wait()
  91. end
  92. end
  93. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement