Treyzotic

animfig

Mar 11th, 2016
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.67 KB | None | 0 0
  1. function Part(P, Anch, Coll, Tran, Ref, Col, X, Y, Z)
  2. local p = Instance.new("Part")
  3. p.TopSurface = 0
  4. p.BottomSurface = 0
  5. p.Transparency = Tran
  6. p.Reflectance = Ref
  7. p.CanCollide = Coll
  8. p.Anchored = Anch
  9. p.BrickColor = BrickColor.new(Col)
  10. p.formFactor = "Custom"
  11. p.Size = Vector3.new(X,Y,Z)
  12. p.Parent = P
  13. p.Locked = true
  14. p:BreakJoints()
  15. return p
  16. end
  17.  
  18. function Weld(P0, P1, X, Y, Z, A, B, C)
  19. local w = Instance.new("Weld")
  20. w.Part0 = P0
  21. w.Part1 = P1
  22. w.C1 = CN(X, Y, Z) * CA(A, B, C)
  23. w.Parent = P0
  24. return w
  25. end
  26.  
  27. CA = CFrame.Angles
  28. CN = CFrame.new
  29. V3 = Vector3.new
  30. MR = math.rad
  31. MP = math.pi
  32. MRA = math.random
  33. MH = math.huge
  34.  
  35. Asset = "http://www.roblox.com/asset/?id="
  36. Noob = nil
  37.  
  38. function MakeMotor(torso, p1, c0, c1)
  39. local mot = Instance.new("Motor6D")
  40. mot.C0 = c0
  41. mot.C1 = c1
  42. mot.Part0 = torso
  43. mot.Part1 = p1
  44. mot.Parent = torso
  45. return mot
  46. end
  47.  
  48. function Set(tab)
  49. for _,v in pairs(tab) do
  50. local motor = v[1]
  51. local vel = v[2]
  52. local des = v[3]
  53. motor.MaxVelocity = vel
  54. motor.DesiredAngle = des
  55. end
  56. end
  57.  
  58. function Animate(Hum, RSH, LSH, RH, LH)
  59. local pose = "Standing"
  60. local function sit()
  61. pose = "Seated"
  62. end
  63. local function jump()
  64. pose = "Jumping"
  65. end
  66. local function died()
  67. pose = "Dead"
  68. end
  69. local function falling()
  70. pose = "Falling"
  71. end
  72. local function climbing()
  73. pose = "Climbing"
  74. end
  75. local function run(speed)
  76. if speed > 0.5 then
  77. pose = "Running"
  78. else
  79. pose = "Standing"
  80. end
  81. end
  82. local function move(tiem)
  83. local amplitude, frequency
  84. if pose == "Seated" then
  85. Set({{RSH, 0.15, math.pi/2}, {LSH, 0.15, -math.pi/2}, {LH, 0.15, math.pi/2}, {RH, 0.15, -math.pi/2}})
  86. return
  87. end
  88. if pose == "Jumping" then
  89. Set({{RSH, 0.3, math.pi}, {LSH, 0.3, -math.pi}, {LH, 0.3, 0}, {RH, 0.3, 0}})
  90. return
  91. end
  92. if pose == "Falling" then
  93. Set({{RSH, 0.35, math.pi}, {LSH, 0.35, -math.pi}, {LH, 0.35, 0}, {RH, 0.35, 0}})
  94. return
  95. end
  96. local climb = 0
  97. if pose == "Running" then
  98. RSH.MaxVelocity = 0.15
  99. LSH.MaxVelocity = 0.15
  100. amplitude = 1
  101. frequency = 8
  102. elseif pose == "Climbing" then
  103. RSH.MaxVelocity = 0.3
  104. LSH.MaxVelocity = 0.3
  105. amplitude = 1
  106. frequency = 8
  107. climb = math.pi
  108. else
  109. amplitude = 0.1
  110. frequency = 1
  111. end
  112. des = amplitude * math.sin(tiem*frequency)
  113. RSH.DesiredAngle = des + climb
  114. LSH.DesiredAngle = des - climb
  115. RH.DesiredAngle = -des
  116. LH.DesiredAngle = -des
  117. end
  118. Hum.Jumping:connect(jump)
  119. Hum.Running:connect(run)
  120. Hum.Seated:connect(sit)
  121. Hum.Died:connect(died)
  122. Hum.FreeFalling:connect(falling)
  123. Hum.Climbing:connect(climbing)
  124. coroutine.resume(coroutine.create(function()
  125. while pose ~= "Dead" do
  126. local _, time = wait(0.1)
  127. move(time)
  128. end
  129. end))
  130. end
  131.  
  132. function MakeNoob(pos, scale)
  133. local Nub = Instance.new("Model")
  134. Nub.Name = "Narb"
  135. Noob = Nub
  136. local Torso = Part(Nub, false, false, 0, 0, "Bright blue", 2*scale, 2*scale, 1*scale)
  137. Torso.Name = "Torso"
  138. local Head = Part(Nub, false, false, 0, 0, "Bright yellow", 2*scale, 1*scale, 1*scale)
  139. Head.Name = "Head"
  140. local Neck = MakeMotor(Torso, Head, CN(0, 1*scale, 0), CN(0, -0.5*scale, 0))
  141. local HeadMesh = Instance.new("SpecialMesh",Head)
  142. HeadMesh.Scale = V3(1.25, 1.25, 1.25)
  143. local Face = Instance.new("Decal",Head)
  144. Face.Face = "Front"
  145. Face.Texture = Asset..(13038247)
  146. local Rarm = Part(Nub, false, false, 0, 0, "Bright yellow", 1*scale, 2*scale, 1*scale)
  147. Rarm.Name = "Right Arm"
  148. local Larm = Part(Nub, false, false, 0, 0, "Bright yellow", 1*scale, 2*scale, 1*scale)
  149. Larm.Name = "Left Arm"
  150. local Rleg = Part(Nub, false, false, 0, 0, "Br. yellowish green", 1*scale, 2*scale, 1*scale)
  151. Rleg.Name = "Right Leg"
  152. local Lleg = Part(Nub, false, false, 0, 0, "Br. yellowish green", 1*scale, 2*scale, 1*scale)
  153. Lleg.Name = "Left Leg"
  154. local RSH = MakeMotor(Torso, Rarm, CN(1*scale, 0.5*scale, 0) * CA(0, MR(90), 0), CN(-0.5*scale, 0.5*scale, 0) * CA(0, MR(90), 0))
  155. local LSH = MakeMotor(Torso, Larm, CN(-1*scale, 0.5*scale, 0) * CA(0, MR(-90), 0), CN(0.5*scale, 0.5*scale, 0) * CA(0, MR(-90), 0))
  156. local RH = MakeMotor(Torso, Rleg, CN(0.5*scale, -1*scale, 0) * CA(0, MR(-90), 0), CN(0, 1*scale, 0) * CA(0, MR(-90), 0))
  157. local LH = MakeMotor(Torso, Lleg, CN(-0.5*scale, -1*scale, 0) * CA(0, MR(90), 0), CN(0, 1*scale, 0) * CA(0, MR(90), 0))
  158. local Hum = Instance.new("Humanoid")
  159. Hum.MaxHealth = 40+(scale*60)
  160. Hum.Health = 100
  161. Hum.Parent = Nub
  162. Nub.Parent = workspace
  163. Nub:MakeJoints()
  164. Nub:MoveTo(pos)
  165. Animate(Hum,RSH,LSH,RH,LH)
  166. Hum.Died:connect(function()
  167. wait(6)
  168. Nub:remove()
  169. wait(4)
  170. MakeNoob(pos, scale)
  171. end)
  172. return Nub
  173. end
  174. for i = 1, 11 do
  175. local nub = MakeNoob(V3(MRA(-20, 20),10,MRA(-20, 20)), 1)
  176. end
Add Comment
Please, Sign In to add comment