Advertisement
sorrytyler

Untitled

Jan 26th, 2020
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 47.06 KB | None | 0 0
  1. --Converted with ttyyuu12345's model to script plugin v4
  2. function sandbox(var,func)
  3. local env = getfenv(func)
  4. local newenv = setmetatable({},{
  5. __index = function(self,k)
  6. if k=="script" then
  7. return var
  8. else
  9. return env[k]
  10. end
  11. end,
  12. })
  13. setfenv(func,newenv)
  14. return func
  15. end
  16. cors = {}
  17. mas = Instance.new("Model",game:GetService("Lighting"))
  18. Script0 = Instance.new("Script")
  19. Model1 = Instance.new("Model")
  20. Part2 = Instance.new("Part")
  21. MeshPart3 = Instance.new("MeshPart")
  22. Motor6D4 = Instance.new("Motor6D")
  23. MeshPart5 = Instance.new("MeshPart")
  24. Motor6D6 = Instance.new("Motor6D")
  25. MeshPart7 = Instance.new("MeshPart")
  26. Motor6D8 = Instance.new("Motor6D")
  27. MeshPart9 = Instance.new("MeshPart")
  28. Motor6D10 = Instance.new("Motor6D")
  29. MeshPart11 = Instance.new("MeshPart")
  30. Motor6D12 = Instance.new("Motor6D")
  31. MeshPart13 = Instance.new("MeshPart")
  32. Motor6D14 = Instance.new("Motor6D")
  33. MeshPart15 = Instance.new("MeshPart")
  34. Motor6D16 = Instance.new("Motor6D")
  35. MeshPart17 = Instance.new("MeshPart")
  36. Motor6D18 = Instance.new("Motor6D")
  37. MeshPart19 = Instance.new("MeshPart")
  38. Motor6D20 = Instance.new("Motor6D")
  39. MeshPart21 = Instance.new("MeshPart")
  40. Motor6D22 = Instance.new("Motor6D")
  41. MeshPart23 = Instance.new("MeshPart")
  42. Motor6D24 = Instance.new("Motor6D")
  43. MeshPart25 = Instance.new("MeshPart")
  44. Motor6D26 = Instance.new("Motor6D")
  45. MeshPart27 = Instance.new("MeshPart")
  46. Motor6D28 = Instance.new("Motor6D")
  47. MeshPart29 = Instance.new("MeshPart")
  48. Motor6D30 = Instance.new("Motor6D")
  49. MeshPart31 = Instance.new("MeshPart")
  50. Motor6D32 = Instance.new("Motor6D")
  51. Humanoid33 = Instance.new("Humanoid")
  52. Script34 = Instance.new("Script")
  53. StringValue35 = Instance.new("StringValue")
  54. Animation36 = Instance.new("Animation")
  55. StringValue37 = Instance.new("StringValue")
  56. Animation38 = Instance.new("Animation")
  57. StringValue39 = Instance.new("StringValue")
  58. Animation40 = Instance.new("Animation")
  59. NumberValue41 = Instance.new("NumberValue")
  60. Animation42 = Instance.new("Animation")
  61. NumberValue43 = Instance.new("NumberValue")
  62. StringValue44 = Instance.new("StringValue")
  63. Animation45 = Instance.new("Animation")
  64. StringValue46 = Instance.new("StringValue")
  65. Animation47 = Instance.new("Animation")
  66. StringValue48 = Instance.new("StringValue")
  67. Animation49 = Instance.new("Animation")
  68. StringValue50 = Instance.new("StringValue")
  69. Animation51 = Instance.new("Animation")
  70. StringValue52 = Instance.new("StringValue")
  71. Animation53 = Instance.new("Animation")
  72. StringValue54 = Instance.new("StringValue")
  73. Animation55 = Instance.new("Animation")
  74. StringValue56 = Instance.new("StringValue")
  75. Animation57 = Instance.new("Animation")
  76. Script58 = Instance.new("Script")
  77. LocalScript59 = Instance.new("LocalScript")
  78. Script60 = Instance.new("Script")
  79. LocalScript61 = Instance.new("LocalScript")
  80. ObjectValue62 = Instance.new("ObjectValue")
  81. Script0.Name = "abortion"
  82. Script0.Parent = mas
  83. table.insert(cors,sandbox(Script0,function()
  84. wait(2)
  85. local plr = game.Players["sorrytyler"]
  86. local chr = script.Model
  87. script.LocalScript.Obj.Value = chr
  88. for i,v in pairs(chr:GetChildren()) do
  89. if v:IsA("MeshPart") or v:IsA("Part") then
  90. v.Anchored = false
  91. end
  92. end
  93.  
  94. plr.Character = chr
  95.  
  96. local ae = script.LocalScript:Clone()
  97. ae.Parent = chr
  98. ae.Disabled = false
  99. chr.Parent = workspace
  100. script:Destroy()
  101. end))
  102. Model1.Parent = Script0
  103. Part2.Name = "HumanoidRootPart"
  104. Part2.Parent = Model1
  105. Part2.CFrame = CFrame.new(-118.261124, 368.847595, 128.503281, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  106. Part2.Position = Vector3.new(-118.261124, 368.847595, 128.503281)
  107. Part2.Transparency = 1
  108. Part2.Size = Vector3.new(2, 2, 1)
  109. Part2.Anchored = true
  110. MeshPart3.Name = "Head"
  111. MeshPart3.Parent = Model1
  112. MeshPart3.CFrame = CFrame.new(-118.298134, 370.732788, 128.527603, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  113. MeshPart3.Position = Vector3.new(-118.298134, 370.732788, 128.527603)
  114. MeshPart3.Size = Vector3.new(0.558326721, 1.12706757, 0.824303746)
  115. MeshPart3.Anchored = true
  116. MeshPart3.TextureID = "http://roblox.com/asset/?id=1575203913 "
  117. Motor6D4.Name = "Neck"
  118. Motor6D4.Parent = MeshPart3
  119. Motor6D4.C0 = CFrame.new(-3.72726499e-05, 0.604157209, 0.0636235774, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  120. Motor6D4.C1 = CFrame.new(0.037007343, -0.297998428, -0.0244880002, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  121. Motor6D4.Part0 = MeshPart17
  122. Motor6D4.Part1 = MeshPart3
  123. Motor6D4.part1 = MeshPart3
  124. MeshPart5.Name = "LeftHand"
  125. MeshPart5.Parent = Model1
  126. MeshPart5.CFrame = CFrame.new(-119.415169, 368.669464, 128.200546, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  127. MeshPart5.Position = Vector3.new(-119.415169, 368.669464, 128.200546)
  128. MeshPart5.Size = Vector3.new(0.349442005, 0.683714926, 0.406895608)
  129. MeshPart5.Anchored = true
  130. MeshPart5.TextureID = "http://roblox.com/asset/?id=1575206613 "
  131. Motor6D6.Name = "LeftWrist"
  132. Motor6D6.Parent = MeshPart5
  133. Motor6D6.C0 = CFrame.new(0.0862908363, -0.735850811, 0.030328406, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  134. Motor6D6.C1 = CFrame.new(0.273083448, -0.162624002, 0.302725077, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  135. Motor6D6.Part0 = MeshPart7
  136. Motor6D6.Part1 = MeshPart5
  137. Motor6D6.part1 = MeshPart5
  138. MeshPart7.Name = "LeftLowerArm"
  139. MeshPart7.Parent = Model1
  140. MeshPart7.CFrame = CFrame.new(-119.228378, 369.242676, 128.472946, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  141. MeshPart7.Position = Vector3.new(-119.228378, 369.242676, 128.472946)
  142. MeshPart7.Size = Vector3.new(0.486420631, 0.680185199, 0.497122139)
  143. MeshPart7.Anchored = true
  144. MeshPart7.TextureID = "http://roblox.com/asset/?id=1575206613 "
  145. Motor6D8.Name = "LeftElbow"
  146. Motor6D8.Parent = MeshPart7
  147. Motor6D8.C0 = CFrame.new(-0.23034811, -0.515464664, -0.216402858, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  148. Motor6D8.C1 = CFrame.new(0.0862905979, 0.0953008235, 0.0303284079, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  149. Motor6D8.Part0 = MeshPart9
  150. Motor6D8.Part1 = MeshPart7
  151. Motor6D8.part1 = MeshPart7
  152. MeshPart9.Name = "LeftUpperArm"
  153. MeshPart9.Parent = Model1
  154. MeshPart9.CFrame = CFrame.new(-118.911743, 369.853455, 128.719681, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  155. MeshPart9.Position = Vector3.new(-118.911743, 369.853455, 128.719681)
  156. MeshPart9.Size = Vector3.new(0.604062498, 0.909634709, 0.639819801)
  157. MeshPart9.Anchored = true
  158. MeshPart9.TextureID = "http://roblox.com/asset/?id=1575206613 "
  159. Motor6D10.Name = "LeftShoulder"
  160. Motor6D10.Parent = MeshPart9
  161. Motor6D10.C0 = CFrame.new(-0.587371826, 0.424993038, 0.0638954192, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  162. Motor6D10.C1 = CFrame.new(0.0632876158, 0.402154207, -0.216287896, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  163. Motor6D10.Part0 = MeshPart17
  164. Motor6D10.Part1 = MeshPart9
  165. Motor6D10.part1 = MeshPart9
  166. MeshPart11.Name = "RightHand"
  167. MeshPart11.Parent = Model1
  168. MeshPart11.CFrame = CFrame.new(-117.107231, 368.66745, 128.200562, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  169. MeshPart11.Position = Vector3.new(-117.107231, 368.66745, 128.200562)
  170. MeshPart11.Size = Vector3.new(0.349441767, 0.67964983, 0.406895608)
  171. MeshPart11.Anchored = true
  172. MeshPart11.TextureID = "http://roblox.com/asset/?id=1575206613 "
  173. Motor6D12.Name = "RightWrist"
  174. Motor6D12.Parent = MeshPart11
  175. Motor6D12.C0 = CFrame.new(-0.0830709338, -0.737294018, 0.0290398747, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  176. Motor6D12.C1 = CFrame.new(-0.272919953, -0.160591334, 0.302725077, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  177. Motor6D12.Part0 = MeshPart13
  178. Motor6D12.Part1 = MeshPart11
  179. Motor6D12.part1 = MeshPart11
  180. MeshPart13.Name = "RightLowerArm"
  181. MeshPart13.Parent = Model1
  182. MeshPart13.CFrame = CFrame.new(-117.297081, 369.244141, 128.474243, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  183. MeshPart13.Position = Vector3.new(-117.297081, 369.244141, 128.474243)
  184. MeshPart13.Size = Vector3.new(0.485559523, 0.683071792, 0.499699205)
  185. MeshPart13.Anchored = true
  186. MeshPart13.TextureID = "http://roblox.com/asset/?id=1575206613 "
  187. Motor6D14.Name = "RightElbow"
  188. Motor6D14.Parent = MeshPart13
  189. Motor6D14.C0 = CFrame.new(0.225879133, -0.510890603, -0.0778696835, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  190. Motor6D14.C1 = CFrame.new(-0.0830711126, 0.0938575268, 0.0290398747, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  191. Motor6D14.Part0 = MeshPart15
  192. Motor6D14.Part1 = MeshPart13
  193. Motor6D14.part1 = MeshPart13
  194. MeshPart15.Name = "RightUpperArm"
  195. MeshPart15.Parent = Model1
  196. MeshPart15.CFrame = CFrame.new(-117.606033, 369.848877, 128.581146, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  197. MeshPart15.Position = Vector3.new(-117.606033, 369.848877, 128.581146)
  198. MeshPart15.Size = Vector3.new(0.595734, 0.918782651, 0.36275351)
  199. MeshPart15.Anchored = true
  200. MeshPart15.TextureID = "http://roblox.com/asset/?id=1575206613 "
  201. Motor6D16.Name = "RightShoulder"
  202. Motor6D16.Parent = MeshPart15
  203. Motor6D16.C0 = CFrame.new(0.587271214, 0.424993038, 0.0635934696, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  204. Motor6D16.C1 = CFrame.new(-0.0677824616, 0.406728268, -0.0780566707, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  205. Motor6D16.Part0 = MeshPart17
  206. Motor6D16.Part1 = MeshPart15
  207. Motor6D16.part1 = MeshPart15
  208. MeshPart17.Name = "UpperTorso"
  209. MeshPart17.Parent = Model1
  210. MeshPart17.CFrame = CFrame.new(-118.261086, 369.830627, 128.439499, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  211. MeshPart17.Position = Vector3.new(-118.261086, 369.830627, 128.439499)
  212. MeshPart17.Size = Vector3.new(1.14802361, 1.31227541, 0.832659066)
  213. MeshPart17.Anchored = true
  214. MeshPart17.TextureID = "http://roblox.com/asset/?id=1575206613 "
  215. Motor6D18.Name = "Waist"
  216. Motor6D18.Parent = MeshPart17
  217. Motor6D18.C0 = CFrame.new(8.15391541e-05, 0.273116827, 0.0413134396, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  218. Motor6D18.C1 = CFrame.new(-3.72827053e-05, -0.608006954, 0.0637804568, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  219. Motor6D18.Part0 = MeshPart31
  220. Motor6D18.Part1 = MeshPart17
  221. Motor6D18.part1 = MeshPart17
  222. MeshPart19.Name = "LeftFoot"
  223. MeshPart19.Parent = Model1
  224. MeshPart19.CFrame = CFrame.new(-118.787308, 366.023407, 128.407364, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  225. MeshPart19.Position = Vector3.new(-118.787308, 366.023407, 128.407364)
  226. MeshPart19.Size = Vector3.new(0.394467115, 0.446739435, 0.816779494)
  227. MeshPart19.Anchored = true
  228. MeshPart19.TextureID = "http://roblox.com/asset/?id=1575206613 "
  229. Motor6D20.Name = "LeftAnkle"
  230. Motor6D20.Parent = MeshPart19
  231. Motor6D20.C0 = CFrame.new(0.130149275, -0.794970036, -0.0444255695, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  232. Motor6D20.C1 = CFrame.new(0.216528803, 0.109665871, 0.0959113017, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  233. Motor6D20.Part0 = MeshPart21
  234. Motor6D20.Part1 = MeshPart19
  235. Motor6D20.part1 = MeshPart19
  236. MeshPart21.Name = "LeftLowerLeg"
  237. MeshPart21.Parent = Model1
  238. MeshPart21.CFrame = CFrame.new(-118.700928, 366.92804, 128.547699, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  239. MeshPart21.Position = Vector3.new(-118.700928, 366.92804, 128.547699)
  240. MeshPart21.Size = Vector3.new(0.48820281, 1.49119866, 0.566404998)
  241. MeshPart21.Anchored = true
  242. MeshPart21.TextureID = "http://roblox.com/asset/?id=1575206613 "
  243. Motor6D22.Name = "LeftKnee"
  244. Motor6D22.Parent = MeshPart21
  245. Motor6D22.C0 = CFrame.new(0.0204916298, -0.762124181, 0.0624910519, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  246. Motor6D22.C1 = CFrame.new(0.130149305, 0.588028312, -0.0444198772, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  247. Motor6D22.Part0 = MeshPart23
  248. Motor6D22.Part1 = MeshPart21
  249. Motor6D22.part1 = MeshPart21
  250. MeshPart23.Name = "LeftUpperLeg"
  251. MeshPart23.Parent = Model1
  252. MeshPart23.CFrame = CFrame.new(-118.59127, 368.278198, 128.440781, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  253. MeshPart23.Position = Vector3.new(-118.59127, 368.278198, 128.440781)
  254. MeshPart23.Size = Vector3.new(0.620733321, 1.55217934, 0.683645964)
  255. MeshPart23.Anchored = true
  256. MeshPart23.TextureID = "http://roblox.com/asset/?id=1575206613 "
  257. Motor6D24.Name = "LeftHip"
  258. Motor6D24.Parent = MeshPart23
  259. Motor6D24.C0 = CFrame.new(-0.309571236, -0.101883173, 0.0413134396, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  260. Motor6D24.C1 = CFrame.new(0.0204916, 0.569408417, 0.062496528, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  261. Motor6D24.Part0 = MeshPart31
  262. Motor6D24.Part1 = MeshPart23
  263. Motor6D24.part1 = MeshPart23
  264. MeshPart25.Name = "RightFoot"
  265. MeshPart25.Parent = Model1
  266. MeshPart25.CFrame = CFrame.new(-117.735107, 366.023376, 128.407349, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  267. MeshPart25.Position = Vector3.new(-117.735107, 366.023376, 128.407349)
  268. MeshPart25.Size = Vector3.new(0.394466639, 0.446739197, 0.816779494)
  269. MeshPart25.Anchored = true
  270. MeshPart25.TextureID = "http://roblox.com/asset/?id=1575206613 "
  271. Motor6D26.Name = "RightAnkle"
  272. Motor6D26.Parent = MeshPart25
  273. Motor6D26.C0 = CFrame.new(-0.141433001, -0.846741319, 0.0336278155, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  274. Motor6D26.C1 = CFrame.new(-0.215695024, 0.109664679, 0.0959582999, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  275. Motor6D26.Part0 = MeshPart27
  276. Motor6D26.Part1 = MeshPart25
  277. Motor6D26.part1 = MeshPart25
  278. MeshPart27.Name = "RightLowerLeg"
  279. MeshPart27.Parent = Model1
  280. MeshPart27.CFrame = CFrame.new(-117.809372, 366.979797, 128.469681, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  281. MeshPart27.Position = Vector3.new(-117.809372, 366.979797, 128.469681)
  282. MeshPart27.Size = Vector3.new(0.562960148, 1.63152242, 0.733001888)
  283. MeshPart27.Anchored = true
  284. MeshPart27.TextureID = "http://roblox.com/asset/?id=1575206613 "
  285. Motor6D28.Name = "RightKnee"
  286. Motor6D28.Parent = MeshPart27
  287. Motor6D28.C0 = CFrame.new(-0.022497654, -0.754441321, 0.0520723537, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  288. Motor6D28.C1 = CFrame.new(-0.141433001, 0.536258936, 0.0336021259, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  289. Motor6D28.Part0 = MeshPart29
  290. Motor6D28.Part1 = MeshPart27
  291. Motor6D28.part1 = MeshPart27
  292. MeshPart29.Name = "RightUpperLeg"
  293. MeshPart29.Parent = Model1
  294. MeshPart29.CFrame = CFrame.new(-117.928307, 368.270508, 128.451218, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  295. MeshPart29.Position = Vector3.new(-117.928307, 368.270508, 128.451218)
  296. MeshPart29.Size = Vector3.new(0.596929073, 1.53314316, 0.662777305)
  297. MeshPart29.Anchored = true
  298. MeshPart29.TextureID = "http://roblox.com/asset/?id=1575206613 "
  299. Motor6D30.Name = "RightHip"
  300. Motor6D30.Parent = MeshPart29
  301. Motor6D30.C0 = CFrame.new(0.310404778, -0.101883173, 0.0413134396, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  302. Motor6D30.C1 = CFrame.new(-0.022497654, 0.5770908, 0.0520622134, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  303. Motor6D30.Part0 = MeshPart31
  304. Motor6D30.Part1 = MeshPart29
  305. Motor6D30.part1 = MeshPart29
  306. MeshPart31.Name = "LowerTorso"
  307. MeshPart31.Parent = Model1
  308. MeshPart31.CFrame = CFrame.new(-118.261208, 368.949493, 128.46196, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  309. MeshPart31.Position = Vector3.new(-118.261208, 368.949493, 128.46196)
  310. MeshPart31.Size = Vector3.new(1.07167053, 0.688970566, 0.807805061)
  311. MeshPart31.Anchored = true
  312. MeshPart31.TextureID = "http://roblox.com/asset/?id=1575206613 "
  313. Motor6D32.Name = "Root"
  314. Motor6D32.Parent = MeshPart31
  315. Motor6D32.C0 = CFrame.new(-0, 3.75157256e-08, -0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  316. Motor6D32.C1 = CFrame.new(8.15391541e-05, -0.101883136, 0.0413134396, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  317. Motor6D32.Part0 = Part2
  318. Motor6D32.Part1 = MeshPart31
  319. Motor6D32.part1 = MeshPart31
  320. Humanoid33.Parent = Model1
  321. Humanoid33.HipHeight = 2
  322. Humanoid33.LeftLeg = MeshPart23
  323. Humanoid33.RigType = Enum.HumanoidRigType.R15
  324. Humanoid33.RightLeg = MeshPart29
  325. Humanoid33.Torso = Part2
  326. Script34.Name = "Animate"
  327. Script34.Parent = Model1
  328. table.insert(cors,sandbox(Script34,function()
  329. function waitForChild(parent, childName)
  330. local child = parent:findFirstChild(childName)
  331. if child then return child end
  332. while true do
  333. child = parent.ChildAdded:wait()
  334. if child.Name==childName then return child end
  335. end
  336. end
  337.  
  338. local Figure = script.Parent
  339. local Humanoid = waitForChild(Figure, "Humanoid")
  340. local pose = "Standing"
  341.  
  342. local currentAnim = ""
  343. local currentAnimInstance = nil
  344. local currentAnimTrack = nil
  345. local currentAnimKeyframeHandler = nil
  346. local currentAnimSpeed = 1.0
  347. local animTable = {}
  348. local animNames = {
  349. idle = {
  350. { id = "http://www.roblox.com/asset/?id=507766666", weight = 1 },
  351. { id = "http://www.roblox.com/asset/?id=507766951", weight = 1 },
  352. { id = "http://www.roblox.com/asset/?id=507766388", weight = 9 }
  353. },
  354. walk = {
  355. { id = "http://www.roblox.com/asset/?id=507777826", weight = 10 }
  356. },
  357. run = {
  358. { id = "http://www.roblox.com/asset/?id=507767714", weight = 10 }
  359. },
  360. swim = {
  361. { id = "http://www.roblox.com/asset/?id=507784897", weight = 10 }
  362. },
  363. swimidle = {
  364. { id = "http://www.roblox.com/asset/?id=507785072", weight = 10 }
  365. },
  366. jump = {
  367. { id = "http://www.roblox.com/asset/?id=507765000", weight = 10 }
  368. },
  369. fall = {
  370. { id = "http://www.roblox.com/asset/?id=507767968", weight = 10 }
  371. },
  372. climb = {
  373. { id = "http://www.roblox.com/asset/?id=507765644", weight = 10 }
  374. },
  375. sit = {
  376. { id = "http://www.roblox.com/asset/?id=507768133", weight = 10 }
  377. },
  378. toolnone = {
  379. { id = "http://www.roblox.com/asset/?id=507768375", weight = 10 }
  380. },
  381. toolslash = {
  382. { id = "http://www.roblox.com/asset/?id=507768375", weight = 10 }
  383. -- { id = "slash.xml", weight = 10 }
  384. },
  385. toollunge = {
  386. { id = "http://www.roblox.com/asset/?id=507768375", weight = 10 }
  387. },
  388. wave = {
  389. { id = "http://www.roblox.com/asset/?id=507770239", weight = 10 }
  390. },
  391. point = {
  392. { id = "http://www.roblox.com/asset/?id=507770453", weight = 10 }
  393. },
  394. dance = {
  395. { id = "http://www.roblox.com/asset/?id=507771019", weight = 10 },
  396. { id = "http://www.roblox.com/asset/?id=507771955", weight = 10 },
  397. { id = "http://www.roblox.com/asset/?id=507772104", weight = 10 }
  398. },
  399. dance2 = {
  400. { id = "http://www.roblox.com/asset/?id=507776043", weight = 10 },
  401. { id = "http://www.roblox.com/asset/?id=507776720", weight = 10 },
  402. { id = "http://www.roblox.com/asset/?id=507776879", weight = 10 }
  403. },
  404. dance3 = {
  405. { id = "http://www.roblox.com/asset/?id=507777268", weight = 10 },
  406. { id = "http://www.roblox.com/asset/?id=507777451", weight = 10 },
  407. { id = "http://www.roblox.com/asset/?id=507777623", weight = 10 }
  408. },
  409. laugh = {
  410. { id = "http://www.roblox.com/asset/?id=507770818", weight = 10 }
  411. },
  412. cheer = {
  413. { id = "http://www.roblox.com/asset/?id=507770677", weight = 10 }
  414. },
  415. }
  416.  
  417. -- Existance in this list signifies that it is an emote, the value indicates if it is a looping emote
  418. local emoteNames = { wave = false, point = false, dance = true, dance2 = true, dance3 = true, laugh = false, cheer = false}
  419.  
  420. math.randomseed(tick())
  421.  
  422. function configureAnimationSet(name, fileList)
  423. if (animTable[name] ~= nil) then
  424. for _, connection in pairs(animTable[name].connections) do
  425. connection:disconnect()
  426. end
  427. end
  428. animTable[name] = {}
  429. animTable[name].count = 0
  430. animTable[name].totalWeight = 0
  431. animTable[name].connections = {}
  432.  
  433. -- check for config values
  434. local config = script:FindFirstChild(name)
  435. if (config ~= nil) then
  436. -- print("Loading anims " .. name)
  437. table.insert(animTable[name].connections, config.ChildAdded:connect(function(child) configureAnimationSet(name, fileList) end))
  438. table.insert(animTable[name].connections, config.ChildRemoved:connect(function(child) configureAnimationSet(name, fileList) end))
  439. local idx = 1
  440. for _, childPart in pairs(config:GetChildren()) do
  441. if (childPart:IsA("Animation")) then
  442. table.insert(animTable[name].connections, childPart.Changed:connect(function(property) configureAnimationSet(name, fileList) end))
  443. animTable[name][idx] = {}
  444. animTable[name][idx].anim = childPart
  445. local weightObject = childPart:FindFirstChild("Weight")
  446. if (weightObject == nil) then
  447. animTable[name][idx].weight = 1
  448. else
  449. animTable[name][idx].weight = weightObject.Value
  450. end
  451. animTable[name].count = animTable[name].count + 1
  452. animTable[name].totalWeight = animTable[name].totalWeight + animTable[name][idx].weight
  453. -- print(name .. " [" .. idx .. "] " .. animTable[name][idx].anim.AnimationId .. " (" .. animTable[name][idx].weight .. ")")
  454. idx = idx + 1
  455. end
  456. end
  457. end
  458.  
  459. -- fallback to defaults
  460. if (animTable[name].count <= 0) then
  461. for idx, anim in pairs(fileList) do
  462. animTable[name][idx] = {}
  463. animTable[name][idx].anim = Instance.new("Animation")
  464. animTable[name][idx].anim.Name = name
  465. animTable[name][idx].anim.AnimationId = anim.id
  466. animTable[name][idx].weight = anim.weight
  467. animTable[name].count = animTable[name].count + 1
  468. animTable[name].totalWeight = animTable[name].totalWeight + anim.weight
  469. -- print(name .. " [" .. idx .. "] " .. anim.id .. " (" .. anim.weight .. ")")
  470. end
  471. end
  472. end
  473.  
  474. -- Setup animation objects
  475. function scriptChildModified(child)
  476. local fileList = animNames[child.Name]
  477. if (fileList ~= nil) then
  478. configureAnimationSet(child.Name, fileList)
  479. end
  480. end
  481.  
  482. script.ChildAdded:connect(scriptChildModified)
  483. script.ChildRemoved:connect(scriptChildModified)
  484.  
  485.  
  486. for name, fileList in pairs(animNames) do
  487. configureAnimationSet(name, fileList)
  488. end
  489.  
  490. -- ANIMATION
  491.  
  492. -- declarations
  493. local toolAnim = "None"
  494. local toolAnimTime = 0
  495.  
  496. local jumpAnimTime = 0
  497. local jumpAnimDuration = 0.31
  498.  
  499. local toolTransitionTime = 0.1
  500. local fallTransitionTime = 0.2
  501.  
  502. -- functions
  503.  
  504. function stopAllAnimations()
  505. local oldAnim = currentAnim
  506.  
  507. -- return to idle if finishing an emote
  508. if (emoteNames[oldAnim] ~= nil and emoteNames[oldAnim] == false) then
  509. oldAnim = "idle"
  510. end
  511.  
  512. currentAnim = ""
  513. currentAnimInstance = nil
  514. if (currentAnimKeyframeHandler ~= nil) then
  515. currentAnimKeyframeHandler:disconnect()
  516. end
  517.  
  518. if (currentAnimTrack ~= nil) then
  519. currentAnimTrack:Stop()
  520. currentAnimTrack:Destroy()
  521. currentAnimTrack = nil
  522. end
  523. return oldAnim
  524. end
  525.  
  526. function setAnimationSpeed(speed)
  527. if speed ~= currentAnimSpeed then
  528. currentAnimSpeed = speed
  529. currentAnimTrack:AdjustSpeed(currentAnimSpeed)
  530. end
  531. end
  532.  
  533. function keyFrameReachedFunc(frameName)
  534. if (frameName == "End") then
  535. -- print("Keyframe : ".. frameName)
  536.  
  537. local repeatAnim = currentAnim
  538. -- return to idle if finishing an emote
  539. if (emoteNames[repeatAnim] ~= nil and emoteNames[repeatAnim] == false) then
  540. repeatAnim = "idle"
  541. end
  542.  
  543. local animSpeed = currentAnimSpeed
  544. playAnimation(repeatAnim, 0.15, Humanoid)
  545. setAnimationSpeed(animSpeed)
  546. end
  547. end
  548.  
  549. -- Preload animations
  550. function playAnimation(animName, transitionTime, humanoid)
  551.  
  552. local roll = math.random(1, animTable[animName].totalWeight)
  553. local origRoll = roll
  554. local idx = 1
  555. while (roll > animTable[animName][idx].weight) do
  556. roll = roll - animTable[animName][idx].weight
  557. idx = idx + 1
  558. end
  559.  
  560. -- print(animName .. " " .. idx .. " [" .. origRoll .. "]")
  561.  
  562. local anim = animTable[animName][idx].anim
  563.  
  564. -- switch animation
  565. if (anim ~= currentAnimInstance) then
  566.  
  567. if (currentAnimTrack ~= nil) then
  568. currentAnimTrack:Stop(transitionTime)
  569. currentAnimTrack:Destroy()
  570. end
  571.  
  572. currentAnimSpeed = 1.0
  573.  
  574. -- load it to the humanoid; get AnimationTrack
  575. currentAnimTrack = humanoid:LoadAnimation(anim)
  576.  
  577. -- play the animation
  578. currentAnimTrack:Play(transitionTime)
  579. currentAnim = animName
  580. currentAnimInstance = anim
  581.  
  582. -- set up keyframe name triggers
  583. if (currentAnimKeyframeHandler ~= nil) then
  584. currentAnimKeyframeHandler:disconnect()
  585. end
  586. currentAnimKeyframeHandler = currentAnimTrack.KeyframeReached:connect(keyFrameReachedFunc)
  587.  
  588. end
  589.  
  590. end
  591.  
  592. -------------------------------------------------------------------------------------------
  593. -------------------------------------------------------------------------------------------
  594.  
  595. local toolAnimName = ""
  596. local toolAnimTrack = nil
  597. local toolAnimInstance = nil
  598. local currentToolAnimKeyframeHandler = nil
  599.  
  600. function toolKeyFrameReachedFunc(frameName)
  601. if (frameName == "End") then
  602. -- print("Keyframe : ".. frameName)
  603. playToolAnimation(toolAnimName, 0.0, Humanoid)
  604. end
  605. end
  606.  
  607.  
  608. function playToolAnimation(animName, transitionTime, humanoid)
  609.  
  610. local roll = math.random(1, animTable[animName].totalWeight)
  611. local origRoll = roll
  612. local idx = 1
  613. while (roll > animTable[animName][idx].weight) do
  614. roll = roll - animTable[animName][idx].weight
  615. idx = idx + 1
  616. end
  617. -- print(animName .. " * " .. idx .. " [" .. origRoll .. "]")
  618. local anim = animTable[animName][idx].anim
  619.  
  620. if (toolAnimInstance ~= anim) then
  621.  
  622. if (toolAnimTrack ~= nil) then
  623. toolAnimTrack:Stop()
  624. toolAnimTrack:Destroy()
  625. transitionTime = 0
  626. end
  627.  
  628. -- load it to the humanoid; get AnimationTrack
  629. toolAnimTrack = humanoid:LoadAnimation(anim)
  630.  
  631. -- play the animation
  632. toolAnimTrack:Play(transitionTime)
  633. toolAnimName = animName
  634. toolAnimInstance = anim
  635.  
  636. currentToolAnimKeyframeHandler = toolAnimTrack.KeyframeReached:connect(toolKeyFrameReachedFunc)
  637. end
  638. end
  639.  
  640. function stopToolAnimations()
  641. local oldAnim = toolAnimName
  642.  
  643. if (currentToolAnimKeyframeHandler ~= nil) then
  644. currentToolAnimKeyframeHandler:disconnect()
  645. end
  646.  
  647. toolAnimName = ""
  648. toolAnimInstance = nil
  649. if (toolAnimTrack ~= nil) then
  650. toolAnimTrack:Stop()
  651. toolAnimTrack:Destroy()
  652. toolAnimTrack = nil
  653. end
  654.  
  655.  
  656. return oldAnim
  657. end
  658.  
  659. -------------------------------------------------------------------------------------------
  660. -------------------------------------------------------------------------------------------
  661.  
  662.  
  663. function onRunning(speed)
  664. if speed > 0.01 then
  665. local scale = 15.0
  666. playAnimation("walk", 0.1, Humanoid)
  667. setAnimationSpeed(speed / scale)
  668. pose = "Running"
  669. else
  670. if emoteNames[currentAnim] == nil then
  671. playAnimation("idle", 0.1, Humanoid)
  672. pose = "Standing"
  673. end
  674. end
  675. end
  676.  
  677. function onDied()
  678. pose = "Dead"
  679. end
  680.  
  681. function onJumping()
  682. playAnimation("jump", 0.1, Humanoid)
  683. jumpAnimTime = jumpAnimDuration
  684. pose = "Jumping"
  685. end
  686.  
  687. function onClimbing(speed)
  688. local scale = 5.0
  689. playAnimation("climb", 0.1, Humanoid)
  690. setAnimationSpeed(speed / scale)
  691. pose = "Climbing"
  692. end
  693.  
  694. function onGettingUp()
  695. pose = "GettingUp"
  696. end
  697.  
  698. function onFreeFall()
  699. if (jumpAnimTime <= 0) then
  700. playAnimation("fall", fallTransitionTime, Humanoid)
  701. end
  702. pose = "FreeFall"
  703. end
  704.  
  705. function onFallingDown()
  706. pose = "FallingDown"
  707. end
  708.  
  709. function onSeated()
  710. pose = "Seated"
  711. end
  712.  
  713. function onPlatformStanding()
  714. pose = "PlatformStanding"
  715. end
  716.  
  717. function onSwimming(speed)
  718. if speed > 1.00 then
  719. local scale = 10.0
  720. playAnimation("swim", 0.4, Humanoid)
  721. setAnimationSpeed(speed / scale)
  722. pose = "Swimming"
  723. else
  724. playAnimation("swimidle", 0.4, Humanoid)
  725. pose = "Standing"
  726. end
  727. end
  728.  
  729. function getTool()
  730. for _, kid in ipairs(Figure:GetChildren()) do
  731. if kid.className == "Tool" then return kid end
  732. end
  733. return nil
  734. end
  735.  
  736. function getToolAnim(tool)
  737. for _, c in ipairs(tool:GetChildren()) do
  738. if c.Name == "toolanim" and c.className == "StringValue" then
  739. return c
  740. end
  741. end
  742. return nil
  743. end
  744.  
  745. function animateTool()
  746.  
  747. if (toolAnim == "None") then
  748. playToolAnimation("toolnone", toolTransitionTime, Humanoid)
  749. return
  750. end
  751.  
  752. if (toolAnim == "Slash") then
  753. playToolAnimation("toolslash", 0, Humanoid)
  754. return
  755. end
  756.  
  757. if (toolAnim == "Lunge") then
  758. playToolAnimation("toollunge", 0, Humanoid)
  759. return
  760. end
  761. end
  762.  
  763. function moveSit()
  764. RightShoulder.MaxVelocity = 0.15
  765. LeftShoulder.MaxVelocity = 0.15
  766. RightShoulder:SetDesiredAngle(3.14 /2)
  767. LeftShoulder:SetDesiredAngle(-3.14 /2)
  768. RightHip:SetDesiredAngle(3.14 /2)
  769. LeftHip:SetDesiredAngle(-3.14 /2)
  770. end
  771.  
  772. local lastTick = 0
  773.  
  774. function move(time)
  775. local amplitude = 1
  776. local frequency = 1
  777. local deltaTime = time - lastTick
  778. lastTick = time
  779.  
  780. local climbFudge = 0
  781. local setAngles = false
  782.  
  783. if (jumpAnimTime > 0) then
  784. jumpAnimTime = jumpAnimTime - deltaTime
  785. end
  786.  
  787. if (pose == "FreeFall" and jumpAnimTime <= 0) then
  788. playAnimation("fall", fallTransitionTime, Humanoid)
  789. elseif (pose == "Seated") then
  790. playAnimation("sit", 0.5, Humanoid)
  791. return
  792. elseif (pose == "Running") then
  793. playAnimation("walk", 0.1, Humanoid)
  794. elseif (pose == "Dead" or pose == "GettingUp" or pose == "FallingDown" or pose == "Seated" or pose == "PlatformStanding") then
  795. stopAllAnimations()
  796. amplitude = 0.1
  797. frequency = 1
  798. setAngles = true
  799. end
  800.  
  801. -- Tool Animation handling
  802. local tool = getTool()
  803. if tool and (tool.RequiresHandle or tool:FindFirstChild("Handle")) then
  804.  
  805. animStringValueObject = getToolAnim(tool)
  806.  
  807. if animStringValueObject then
  808. toolAnim = animStringValueObject.Value
  809. -- message recieved, delete StringValue
  810. animStringValueObject.Parent = nil
  811. toolAnimTime = time + .3
  812. end
  813.  
  814. if time > toolAnimTime then
  815. toolAnimTime = 0
  816. toolAnim = "None"
  817. end
  818.  
  819. animateTool()
  820. else
  821. stopToolAnimations()
  822. toolAnim = "None"
  823. toolAnimInstance = nil
  824. toolAnimTime = 0
  825. end
  826. end
  827.  
  828. -- connect events
  829. Humanoid.Died:connect(onDied)
  830. Humanoid.Running:connect(onRunning)
  831. Humanoid.Jumping:connect(onJumping)
  832. Humanoid.Climbing:connect(onClimbing)
  833. Humanoid.GettingUp:connect(onGettingUp)
  834. Humanoid.FreeFalling:connect(onFreeFall)
  835. Humanoid.FallingDown:connect(onFallingDown)
  836. Humanoid.Seated:connect(onSeated)
  837. Humanoid.PlatformStanding:connect(onPlatformStanding)
  838. Humanoid.Swimming:connect(onSwimming)
  839.  
  840.  
  841. -- main program
  842.  
  843. local runService = game:service("RunService");
  844.  
  845. -- print("bottom")
  846.  
  847. -- initialize to idle
  848. playAnimation("idle", 0.1, Humanoid)
  849. pose = "Standing"
  850.  
  851.  
  852. while Figure.Parent~=nil do
  853. local _, time = wait(0.1)
  854. move(time)
  855. end
  856. end))
  857. StringValue35.Name = "climb"
  858. StringValue35.Parent = Script34
  859. Animation36.Name = "ClimbAnim"
  860. Animation36.Parent = StringValue35
  861. Animation36.AnimationId = "http://www.roblox.com/asset/?id=507765644"
  862. StringValue37.Name = "fall"
  863. StringValue37.Parent = Script34
  864. Animation38.Name = "FallAnim"
  865. Animation38.Parent = StringValue37
  866. Animation38.AnimationId = "http://www.roblox.com/asset/?id=507767968"
  867. StringValue39.Name = "idle"
  868. StringValue39.Parent = Script34
  869. Animation40.Name = "Animation1"
  870. Animation40.Parent = StringValue39
  871. Animation40.AnimationId = "http://www.roblox.com/asset/?id=507766388"
  872. NumberValue41.Name = "Weight"
  873. NumberValue41.Parent = Animation40
  874. NumberValue41.Value = 9
  875. Animation42.Name = "Animation2"
  876. Animation42.Parent = StringValue39
  877. Animation42.AnimationId = "http://www.roblox.com/asset/?id=507766666"
  878. NumberValue43.Name = "Weight"
  879. NumberValue43.Parent = Animation42
  880. NumberValue43.Value = 1
  881. StringValue44.Name = "jump"
  882. StringValue44.Parent = Script34
  883. Animation45.Name = "JumpAnim"
  884. Animation45.Parent = StringValue44
  885. Animation45.AnimationId = "http://www.roblox.com/asset/?id=507765000"
  886. StringValue46.Name = "run"
  887. StringValue46.Parent = Script34
  888. Animation47.Name = "RunAnim"
  889. Animation47.Parent = StringValue46
  890. Animation47.AnimationId = "http://www.roblox.com/asset/?id=5077677142"
  891. StringValue48.Name = "sit"
  892. StringValue48.Parent = Script34
  893. Animation49.Name = "SitAnim"
  894. Animation49.Parent = StringValue48
  895. Animation49.AnimationId = "http://www.roblox.com/asset/?id=507768133"
  896. StringValue50.Name = "swim"
  897. StringValue50.Parent = Script34
  898. Animation51.Name = "Swim"
  899. Animation51.Parent = StringValue50
  900. Animation51.AnimationId = "http://www.roblox.com/asset/?id=507784897"
  901. StringValue52.Name = "swimidle"
  902. StringValue52.Parent = Script34
  903. Animation53.Name = "SwimIdle"
  904. Animation53.Parent = StringValue52
  905. Animation53.AnimationId = "http://www.roblox.com/asset/?id=481825862"
  906. StringValue54.Name = "toolnone"
  907. StringValue54.Parent = Script34
  908. Animation55.Name = "ToolNoneAnim"
  909. Animation55.Parent = StringValue54
  910. Animation55.AnimationId = "http://www.roblox.com/asset/?id=507768375"
  911. StringValue56.Name = "walk"
  912. StringValue56.Parent = Script34
  913. Animation57.Name = "RunAnim"
  914. Animation57.Parent = StringValue56
  915. Animation57.AnimationId = "http://www.roblox.com/asset/?id=507777826"
  916. Script58.Name = "Sound"
  917. Script58.Parent = Model1
  918. table.insert(cors,sandbox(Script58,function()
  919. --[[
  920. Author: @spotco
  921. This script creates sounds which are placed under the character head.
  922. These sounds are used by the "LocalSound" script.
  923.  
  924. To modify this script, copy it to your "StarterPlayer/StarterCharacterScripts" folder keeping the same script name ("Sound").
  925. The default Sound script loaded for every character will then be replaced with your copy of the script.
  926. ]]--
  927.  
  928. function CreateNewSound(name, id, looped, pitch, parent)
  929. local sound = Instance.new("Sound")
  930. sound.SoundId = id
  931. sound.Name = name
  932. sound.archivable = false
  933. sound.Parent = parent
  934. sound.Pitch = pitch
  935. sound.Looped = looped
  936.  
  937. sound.MinDistance = 5
  938. sound.MaxDistance = 150
  939. sound.Volume = 0.65
  940.  
  941. return sound
  942. end
  943.  
  944. local head = script.Parent:FindFirstChild("Head")
  945. if head == nil then
  946. error("Sound script parent has no child Head.")
  947. return
  948. end
  949.  
  950.  
  951. CreateNewSound("GettingUp", "rbxasset://sounds/action_get_up.mp3", false, 1, head)
  952. CreateNewSound("Died", "rbxasset://sounds/uuhhh.mp3", false, 1, head)
  953. CreateNewSound("FreeFalling", "rbxasset://sounds/action_falling.mp3", true, 1, head)
  954. CreateNewSound("Jumping", "rbxasset://sounds/action_jump.mp3", false, 1, head)
  955. CreateNewSound("Landing", "rbxasset://sounds/action_jump_land.mp3", false, 1, head)
  956. CreateNewSound("Splash", "rbxasset://sounds/impact_water.mp3", false, 1, head)
  957. CreateNewSound("Running", "rbxasset://sounds/action_footsteps_plastic.mp3", true, 1.85, head)
  958. CreateNewSound("Swimming", "rbxasset://sounds/action_swim.mp3", true, 1.6, head)
  959. CreateNewSound("Climbing", "rbxasset://sounds/action_footsteps_plastic.mp3", true, 1, head)
  960. end))
  961. LocalScript59.Name = "LocalSound"
  962. LocalScript59.Parent = Script58
  963. table.insert(cors,sandbox(LocalScript59,function()
  964. --[[
  965. Author: @spotco
  966. This script runs locally for the player of the given humanoid.
  967. This script triggers humanoid sound play/pause actions locally.
  968.  
  969. The Playing/TimePosition properties of Sound objects bypass FilteringEnabled, so this triggers the sound
  970. immediately for the player and is replicated to all other players.
  971.  
  972. This script is optimized to reduce network traffic through minimizing the amount of property replication.
  973. ]]--
  974.  
  975. --All sounds are referenced by this ID
  976. local SFX = {
  977. Died = 0;
  978. Running = 1;
  979. Swimming = 2;
  980. Climbing = 3,
  981. Jumping = 4;
  982. GettingUp = 5;
  983. FreeFalling = 6;
  984. FallingDown = 7;
  985. Landing = 8;
  986. Splash = 9;
  987. }
  988.  
  989. local Humanoid = nil
  990. local Head = nil
  991.  
  992. --SFX ID to Sound object
  993. local Sounds = {}
  994.  
  995. do
  996. local Figure = script.Parent.Parent
  997. Head = Figure:WaitForChild("Head")
  998. while not Humanoid do
  999. for _,NewHumanoid in pairs(Figure:GetChildren()) do
  1000. if NewHumanoid:IsA("Humanoid") then
  1001. Humanoid = NewHumanoid
  1002. break
  1003. end
  1004. end
  1005. Figure.ChildAdded:wait()
  1006. end
  1007.  
  1008. Sounds[SFX.Died] = Head:WaitForChild("Died")
  1009. Sounds[SFX.Running] = Head:WaitForChild("Running")
  1010. Sounds[SFX.Swimming] = Head:WaitForChild("Swimming")
  1011. Sounds[SFX.Climbing] = Head:WaitForChild("Climbing")
  1012. Sounds[SFX.Jumping] = Head:WaitForChild("Jumping")
  1013. Sounds[SFX.GettingUp] = Head:WaitForChild("GettingUp")
  1014. Sounds[SFX.FreeFalling] = Head:WaitForChild("FreeFalling")
  1015. Sounds[SFX.Landing] = Head:WaitForChild("Landing")
  1016. Sounds[SFX.Splash] = Head:WaitForChild("Splash")
  1017. end
  1018.  
  1019. local Util
  1020. Util = {
  1021.  
  1022. --Define linear relationship between (pt1x,pt2x) and (pt2x,pt2y). Evaluate this at x.
  1023. YForLineGivenXAndTwoPts = function(x,pt1x,pt1y,pt2x,pt2y)
  1024. --(y - y1)/(x - x1) = m
  1025. local m = (pt1y - pt2y) / (pt1x - pt2x)
  1026. --float b = pt1.y - m * pt1.x;
  1027. local b = (pt1y - m * pt1x)
  1028. return m * x + b
  1029. end;
  1030.  
  1031. --Clamps the value of "val" between the "min" and "max"
  1032. Clamp = function(val,min,max)
  1033. return math.min(max,math.max(min,val))
  1034. end;
  1035.  
  1036. --Gets the horizontal (x,z) velocity magnitude of the given part
  1037. HorizontalSpeed = function(Head)
  1038. local hVel = Head.Velocity + Vector3.new(0,-Head.Velocity.Y,0)
  1039. return hVel.magnitude
  1040. end;
  1041.  
  1042. --Gets the vertical (y) velocity magnitude of the given part
  1043. VerticalSpeed = function(Head)
  1044. return math.abs(Head.Velocity.Y)
  1045. end;
  1046.  
  1047. --Setting Playing/TimePosition values directly result in less network traffic than Play/Pause/Resume/Stop
  1048. --If these properties are enabled, use them.
  1049. Play = function(sound)
  1050. if sound.TimePosition ~= 0 then
  1051. sound.TimePosition = 0
  1052. end
  1053. if not sound.IsPlaying then
  1054. sound.Playing = true
  1055. end
  1056. end;
  1057. Pause = function(sound)
  1058. if sound.IsPlaying then
  1059. sound.Playing = false
  1060. end
  1061. end;
  1062. Resume = function(sound)
  1063. if not sound.IsPlaying then
  1064. sound.Playing = true
  1065. end
  1066. end;
  1067. Stop = function(sound)
  1068. if sound.IsPlaying then
  1069. sound.Playing = false
  1070. end
  1071. if sound.TimePosition ~= 0 then
  1072. sound.TimePosition = 0
  1073. end
  1074. end;
  1075. }
  1076.  
  1077. do
  1078. -- List of all active Looped sounds
  1079. local playingLoopedSounds = {}
  1080.  
  1081. -- Last seen Enum.HumanoidStateType
  1082. local activeState = nil
  1083.  
  1084. -- Verify and set that "sound" is in "playingLoopedSounds".
  1085. function setSoundInPlayingLoopedSounds(sound)
  1086. for i=1, #playingLoopedSounds do
  1087. if playingLoopedSounds[i] == sound then
  1088. return
  1089. end
  1090. end
  1091. table.insert(playingLoopedSounds,sound)
  1092. end
  1093.  
  1094. -- Stop all active looped sounds except parameter "except". If "except" is not passed, all looped sounds will be stopped.
  1095. function stopPlayingLoopedSoundsExcept(except)
  1096. for i=#playingLoopedSounds,1,-1 do
  1097. if playingLoopedSounds[i] ~= except then
  1098. Util.Pause(playingLoopedSounds[i])
  1099. table.remove(playingLoopedSounds,i)
  1100. end
  1101. end
  1102. end
  1103.  
  1104. -- Table of Enum.HumanoidStateType to handling function
  1105. local stateUpdateHandler = {
  1106. [Enum.HumanoidStateType.Dead] = function()
  1107. stopPlayingLoopedSoundsExcept()
  1108. local sound = Sounds[SFX.Died]
  1109. Util.Play(sound)
  1110. end;
  1111.  
  1112. [Enum.HumanoidStateType.RunningNoPhysics] = function()
  1113. stateUpdated(Enum.HumanoidStateType.Running)
  1114. end;
  1115.  
  1116. [Enum.HumanoidStateType.Running] = function()
  1117. local sound = Sounds[SFX.Running]
  1118. stopPlayingLoopedSoundsExcept(sound)
  1119.  
  1120. if Util.HorizontalSpeed(Head) > 0.5 then
  1121. Util.Resume(sound)
  1122. setSoundInPlayingLoopedSounds(sound)
  1123. else
  1124. stopPlayingLoopedSoundsExcept()
  1125. end
  1126. end;
  1127.  
  1128. [Enum.HumanoidStateType.Swimming] = function()
  1129. if activeState ~= Enum.HumanoidStateType.Swimming and Util.VerticalSpeed(Head) > 0.1 then
  1130. local splashSound = Sounds[SFX.Splash]
  1131. splashSound.Volume = Util.Clamp(
  1132. Util.YForLineGivenXAndTwoPts(
  1133. Util.VerticalSpeed(Head),
  1134. 100, 0.28,
  1135. 350, 1),
  1136. 0,1)
  1137. Util.Play(splashSound)
  1138. end
  1139.  
  1140. do
  1141. local sound = Sounds[SFX.Swimming]
  1142. stopPlayingLoopedSoundsExcept(sound)
  1143. Util.Resume(sound)
  1144. setSoundInPlayingLoopedSounds(sound)
  1145. end
  1146. end;
  1147.  
  1148. [Enum.HumanoidStateType.Climbing] = function()
  1149. local sound = Sounds[SFX.Climbing]
  1150. if Util.VerticalSpeed(Head) > 0.1 then
  1151. Util.Resume(sound)
  1152. stopPlayingLoopedSoundsExcept(sound)
  1153. else
  1154. stopPlayingLoopedSoundsExcept()
  1155. end
  1156. setSoundInPlayingLoopedSounds(sound)
  1157. end;
  1158.  
  1159. [Enum.HumanoidStateType.Jumping] = function()
  1160. if activeState == Enum.HumanoidStateType.Jumping then
  1161. return
  1162. end
  1163. stopPlayingLoopedSoundsExcept()
  1164. local sound = Sounds[SFX.Jumping]
  1165. Util.Play(sound)
  1166. end;
  1167.  
  1168. [Enum.HumanoidStateType.GettingUp] = function()
  1169. stopPlayingLoopedSoundsExcept()
  1170. local sound = Sounds[SFX.GettingUp]
  1171. Util.Play(sound)
  1172. end;
  1173.  
  1174. [Enum.HumanoidStateType.Freefall] = function()
  1175. if activeState == Enum.HumanoidStateType.Freefall then
  1176. return
  1177. end
  1178. local sound = Sounds[SFX.FreeFalling]
  1179. sound.Volume = 0
  1180. stopPlayingLoopedSoundsExcept()
  1181. end;
  1182.  
  1183. [Enum.HumanoidStateType.FallingDown] = function()
  1184. stopPlayingLoopedSoundsExcept()
  1185. end;
  1186.  
  1187. [Enum.HumanoidStateType.Landed] = function()
  1188. stopPlayingLoopedSoundsExcept()
  1189. if Util.VerticalSpeed(Head) > 75 then
  1190. local landingSound = Sounds[SFX.Landing]
  1191. landingSound.Volume = Util.Clamp(
  1192. Util.YForLineGivenXAndTwoPts(
  1193. Util.VerticalSpeed(Head),
  1194. 50, 0,
  1195. 100, 1),
  1196. 0,1)
  1197. Util.Play(landingSound)
  1198. end
  1199. end;
  1200.  
  1201. [Enum.HumanoidStateType.Seated] = function()
  1202. stopPlayingLoopedSoundsExcept()
  1203. end;
  1204. }
  1205.  
  1206. -- Handle state event fired or OnChange fired
  1207. function stateUpdated(state)
  1208. if stateUpdateHandler[state] ~= nil then
  1209. stateUpdateHandler[state]()
  1210. end
  1211. activeState = state
  1212. end
  1213.  
  1214. Humanoid.Died:connect( function() stateUpdated(Enum.HumanoidStateType.Dead) end)
  1215. Humanoid.Running:connect( function() stateUpdated(Enum.HumanoidStateType.Running) end)
  1216. Humanoid.Swimming:connect( function() stateUpdated(Enum.HumanoidStateType.Swimming) end)
  1217. Humanoid.Climbing:connect( function() stateUpdated(Enum.HumanoidStateType.Climbing) end)
  1218. Humanoid.Jumping:connect( function() stateUpdated(Enum.HumanoidStateType.Jumping) end)
  1219. Humanoid.GettingUp:connect( function() stateUpdated(Enum.HumanoidStateType.GettingUp) end)
  1220. Humanoid.FreeFalling:connect( function() stateUpdated(Enum.HumanoidStateType.Freefall) end)
  1221. Humanoid.FallingDown:connect( function() stateUpdated(Enum.HumanoidStateType.FallingDown) end)
  1222.  
  1223. -- required for proper handling of Landed event
  1224. Humanoid.StateChanged:connect(function(old, new)
  1225. stateUpdated(new)
  1226. end)
  1227.  
  1228.  
  1229. function onUpdate(stepDeltaSeconds, tickSpeedSeconds)
  1230. local stepScale = stepDeltaSeconds / tickSpeedSeconds
  1231. do
  1232. local sound = Sounds[SFX.FreeFalling]
  1233. if activeState == Enum.HumanoidStateType.Freefall then
  1234. if Head.Velocity.Y < 0 and Util.VerticalSpeed(Head) > 75 then
  1235. Util.Resume(sound)
  1236.  
  1237. --Volume takes 1.1 seconds to go from volume 0 to 1
  1238. local ANIMATION_LENGTH_SECONDS = 1.1
  1239.  
  1240. local normalizedIncrement = tickSpeedSeconds / ANIMATION_LENGTH_SECONDS
  1241. sound.Volume = Util.Clamp(sound.Volume + normalizedIncrement * stepScale, 0, 1)
  1242. else
  1243. sound.Volume = 0
  1244. end
  1245. else
  1246. Util.Pause(sound)
  1247. end
  1248. end
  1249.  
  1250. do
  1251. local sound = Sounds[SFX.Running]
  1252. if activeState == Enum.HumanoidStateType.Running then
  1253. if Util.HorizontalSpeed(Head) < 0.5 then
  1254. Util.Pause(sound)
  1255. end
  1256. end
  1257. end
  1258. end
  1259.  
  1260. local lastTick = tick()
  1261. local TICK_SPEED_SECONDS = 0.25
  1262. while true do
  1263. onUpdate(tick() - lastTick,TICK_SPEED_SECONDS)
  1264. lastTick = tick()
  1265. wait(TICK_SPEED_SECONDS)
  1266. end
  1267. end
  1268.  
  1269. end))
  1270. Script60.Name = "Health"
  1271. Script60.Parent = Model1
  1272. table.insert(cors,sandbox(Script60,function()
  1273. --Responsible for regening a player's humanoid's health
  1274.  
  1275. -- declarations
  1276. local Figure = script.Parent
  1277. local Head = Figure:WaitForChild("Head")
  1278. local Humanoid = Figure:WaitForChild("Humanoid")
  1279. local regening = false
  1280.  
  1281. -- regeneration
  1282. function regenHealth()
  1283. if regening then return end
  1284. regening = true
  1285.  
  1286. while Humanoid.Health < Humanoid.MaxHealth do
  1287. local s = wait(1)
  1288. local health = Humanoid.Health
  1289. if health > 0 and health < Humanoid.MaxHealth then
  1290. local newHealthDelta = 0.01 * s * Humanoid.MaxHealth
  1291. health = health + newHealthDelta
  1292. Humanoid.Health = math.min(health,Humanoid.MaxHealth)
  1293. end
  1294. end
  1295.  
  1296. if Humanoid.Health > Humanoid.MaxHealth then
  1297. Humanoid.Health = Humanoid.MaxHealth
  1298. end
  1299.  
  1300. regening = false
  1301. end
  1302.  
  1303. Humanoid.HealthChanged:connect(regenHealth)
  1304.  
  1305. end))
  1306. LocalScript61.Parent = Script0
  1307. table.insert(cors,sandbox(LocalScript61,function()
  1308. repeat wait() until script:FindFirstChild("Obj").Value
  1309. workspace.Camera.CameraSubject = script.Obj.Value
  1310. end))
  1311. LocalScript61.Disabled = true
  1312. ObjectValue62.Name = "Obj"
  1313. ObjectValue62.Parent = LocalScript61
  1314. ObjectValue62.Value = Model1
  1315. for i,v in pairs(mas:GetChildren()) do
  1316. v.Parent = workspace
  1317. pcall(function() v:MakeJoints() end)
  1318. end
  1319. mas:Destroy()
  1320. for i,v in pairs(cors) do
  1321. spawn(function()
  1322. pcall(v)
  1323. end)
  1324. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement