Advertisement
ERROR_CODE

Surviver

Feb 6th, 2024 (edited)
895
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 44.57 KB | None | 0 0
  1. function createZombie()
  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. Model0 = Instance.new("Model")
  19. Part1 = Instance.new("Part")
  20. SpecialMesh2 = Instance.new("SpecialMesh")
  21. Vector3Value3 = Instance.new("Vector3Value")
  22. Motor6D4 = Instance.new("Motor6D")
  23. Decal5 = Instance.new("Decal")
  24. Sound6 = Instance.new("Sound")
  25. Sound7 = Instance.new("Sound")
  26. Sound8 = Instance.new("Sound")
  27. Sound9 = Instance.new("Sound")
  28. Sound10 = Instance.new("Sound")
  29. Part11 = Instance.new("Part")
  30. Vector3Value12 = Instance.new("Vector3Value")
  31. BodyColors13 = Instance.new("BodyColors")
  32. MeshPart14 = Instance.new("MeshPart")
  33. Vector3Value15 = Instance.new("Vector3Value")
  34. Motor6D16 = Instance.new("Motor6D")
  35. Script17 = Instance.new("Script")
  36. Humanoid18 = Instance.new("Humanoid")
  37. Script19 = Instance.new("Script")
  38. MeshPart20 = Instance.new("MeshPart")
  39. Vector3Value21 = Instance.new("Vector3Value")
  40. Motor6D22 = Instance.new("Motor6D")
  41. MeshPart23 = Instance.new("MeshPart")
  42. Vector3Value24 = Instance.new("Vector3Value")
  43. Motor6D25 = Instance.new("Motor6D")
  44. MeshPart26 = Instance.new("MeshPart")
  45. Vector3Value27 = Instance.new("Vector3Value")
  46. Motor6D28 = Instance.new("Motor6D")
  47. MeshPart29 = Instance.new("MeshPart")
  48. Vector3Value30 = Instance.new("Vector3Value")
  49. Motor6D31 = Instance.new("Motor6D")
  50. MeshPart32 = Instance.new("MeshPart")
  51. Vector3Value33 = Instance.new("Vector3Value")
  52. Motor6D34 = Instance.new("Motor6D")
  53. MeshPart35 = Instance.new("MeshPart")
  54. Vector3Value36 = Instance.new("Vector3Value")
  55. Motor6D37 = Instance.new("Motor6D")
  56. MeshPart38 = Instance.new("MeshPart")
  57. Vector3Value39 = Instance.new("Vector3Value")
  58. Motor6D40 = Instance.new("Motor6D")
  59. MeshPart41 = Instance.new("MeshPart")
  60. Vector3Value42 = Instance.new("Vector3Value")
  61. Motor6D43 = Instance.new("Motor6D")
  62. Script44 = Instance.new("Script")
  63. MeshPart45 = Instance.new("MeshPart")
  64. Vector3Value46 = Instance.new("Vector3Value")
  65. Motor6D47 = Instance.new("Motor6D")
  66. MeshPart48 = Instance.new("MeshPart")
  67. Vector3Value49 = Instance.new("Vector3Value")
  68. Motor6D50 = Instance.new("Motor6D")
  69. MeshPart51 = Instance.new("MeshPart")
  70. Vector3Value52 = Instance.new("Vector3Value")
  71. Motor6D53 = Instance.new("Motor6D")
  72. MeshPart54 = Instance.new("MeshPart")
  73. Vector3Value55 = Instance.new("Vector3Value")
  74. Motor6D56 = Instance.new("Motor6D")
  75. MeshPart57 = Instance.new("MeshPart")
  76. Vector3Value58 = Instance.new("Vector3Value")
  77. Motor6D59 = Instance.new("Motor6D")
  78. Script60 = Instance.new("Script")
  79. Script61 = Instance.new("Script")
  80. Script62 = Instance.new("Script")
  81. StringValue63 = Instance.new("StringValue")
  82. StringValue64 = Instance.new("StringValue")
  83. Animation65 = Instance.new("Animation")
  84. StringValue66 = Instance.new("StringValue")
  85. Animation67 = Instance.new("Animation")
  86. StringValue68 = Instance.new("StringValue")
  87. Animation69 = Instance.new("Animation")
  88. NumberValue70 = Instance.new("NumberValue")
  89. Animation71 = Instance.new("Animation")
  90. NumberValue72 = Instance.new("NumberValue")
  91. StringValue73 = Instance.new("StringValue")
  92. Animation74 = Instance.new("Animation")
  93. StringValue75 = Instance.new("StringValue")
  94. Animation76 = Instance.new("Animation")
  95. StringValue77 = Instance.new("StringValue")
  96. Animation78 = Instance.new("Animation")
  97. StringValue79 = Instance.new("StringValue")
  98. Animation80 = Instance.new("Animation")
  99. StringValue81 = Instance.new("StringValue")
  100. Animation82 = Instance.new("Animation")
  101. StringValue83 = Instance.new("StringValue")
  102. Animation84 = Instance.new("Animation")
  103. Script85 = Instance.new("Script")
  104. Model0.Name = "Zombie"
  105. Model0.Parent = mas
  106. Part1.Name = "Head"
  107. Part1.Parent = Model0
  108. Part1.CFrame = CFrame.new(-0.695644557, 4.56509781, -2.19861078, -0.00241400092, 3.49997972e-05, 0.999997497, 0, 1, -3.499991e-05, -0.999997497, -8.44897698e-08, -0.00241400092)
  109. Part1.Orientation = Vector3.new(0, 90.1399994, 0)
  110. Part1.Position = Vector3.new(-0.695644557, 4.56509781, -2.19861078)
  111. Part1.Rotation = Vector3.new(179.169998, 89.8700027, -179.169998)
  112. Part1.Color = Color3.new(0.541176, 0.670588, 0.521569)
  113. Part1.Size = Vector3.new(1, 1, 1)
  114. Part1.BottomSurface = Enum.SurfaceType.Smooth
  115. Part1.BrickColor = BrickColor.new("Artichoke")
  116. Part1.TopSurface = Enum.SurfaceType.Smooth
  117. Part1.brickColor = BrickColor.new("Artichoke")
  118. Part1.FormFactor = Enum.FormFactor.Custom
  119. Part1.formFactor = Enum.FormFactor.Custom
  120. SpecialMesh2.Parent = Part1
  121. SpecialMesh2.MeshId = "http://www.roblox.com/asset?id=419776358"
  122. SpecialMesh2.MeshType = Enum.MeshType.FileMesh
  123. Vector3Value3.Name = "OriginalSize"
  124. Vector3Value3.Parent = Part1
  125. Vector3Value3.Value = Vector3.new(1, 1, 1)
  126. Motor6D4.Name = "Neck"
  127. Motor6D4.Parent = Part1
  128. Motor6D4.C0 = CFrame.new(0.000338107347, 0.806032121, -0.015560925, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  129. Motor6D4.C1 = CFrame.new(-2.72095203e-05, -0.565615535, 0.00386685133, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  130. Motor6D4.Part0 = MeshPart14
  131. Motor6D4.Part1 = Part1
  132. Motor6D4.part1 = Part1
  133. Decal5.Parent = Part1
  134. Decal5.Texture = "http://www.roblox.com/asset/?id=174393211"
  135. Sound6.Name = "Moan"
  136. Sound6.Parent = Part1
  137. Sound6.SoundId = "rbxassetid://131060249"
  138. Sound6.Volume = 1
  139. Sound7.Name = "Moan2"
  140. Sound7.Parent = Part1
  141. Sound7.SoundId = "rbxassetid://131060145"
  142. Sound7.Volume = 1
  143. Sound8.Name = "Moan3"
  144. Sound8.Parent = Part1
  145. Sound8.SoundId = "rbxassetid://131060210"
  146. Sound8.Volume = 1
  147. Sound9.Name = "Moan4"
  148. Sound9.Parent = Part1
  149. Sound9.SoundId = "rbxassetid://131138835"
  150. Sound9.Volume = 1
  151. Sound10.Name = "Death"
  152. Sound10.Parent = Part1
  153. Part11.Name = "HumanoidRootPart"
  154. Part11.Parent = Model0
  155. Part11.CFrame = CFrame.new(-0.691856027, 2.32588005, -2.1985929, -0.00241400092, 3.49997972e-05, 0.999997497, 0, 1, -3.499991e-05, -0.999997497, -8.44897698e-08, -0.00241400092)
  156. Part11.Orientation = Vector3.new(0, 90.1399994, 0)
  157. Part11.CFrame = game.Players.LocalPlayer.Character.Torso.CFrame * CFrame.new(Vector3.new(0, -2.5, 10))
  158. Part11.Rotation = Vector3.new(179.169998, 89.8700027, -179.169998)
  159. Part11.Transparency = 1
  160. Part11.Size = Vector3.new(2, 2, 1)
  161. Part11.CanCollide = false
  162. Vector3Value12.Name = "OriginalSize"
  163. Vector3Value12.Parent = Part11
  164. Vector3Value12.Value = Vector3.new(2, 2, 1)
  165. BodyColors13.Parent = Model0
  166. BodyColors13.HeadColor = BrickColor.new("Artichoke")
  167. BodyColors13.HeadColor3 = Color3.new(0.541176, 0.670588, 0.521569)
  168. BodyColors13.LeftArmColor = BrickColor.new("Artichoke")
  169. BodyColors13.LeftArmColor3 = Color3.new(0.541176, 0.670588, 0.521569)
  170. BodyColors13.LeftLegColor = BrickColor.new("Burnt Sienna")
  171. BodyColors13.LeftLegColor3 = Color3.new(0.415686, 0.223529, 0.0352941)
  172. BodyColors13.RightArmColor = BrickColor.new("Artichoke")
  173. BodyColors13.RightArmColor3 = Color3.new(0.541176, 0.670588, 0.521569)
  174. BodyColors13.RightLegColor = BrickColor.new("Burnt Sienna")
  175. BodyColors13.RightLegColor3 = Color3.new(0.415686, 0.223529, 0.0352941)
  176. BodyColors13.TorsoColor = BrickColor.new("Burnt Sienna")
  177. BodyColors13.TorsoColor3 = Color3.new(0.415686, 0.223529, 0.0352941)
  178. MeshPart14.Name = "UpperTorso"
  179. MeshPart14.Parent = Model0
  180. MeshPart14.CFrame = CFrame.new(-0.676263928, 3.1934495, -2.19829226, -0.00241400092, 3.49997972e-05, 0.999997497, 0, 1, -3.499991e-05, -0.999997497, -8.44897698e-08, -0.00241400092)
  181. MeshPart14.Orientation = Vector3.new(0, 90.1399994, 0)
  182. MeshPart14.Position = Vector3.new(-0.676263928, 3.1934495, -2.19829226)
  183. MeshPart14.Rotation = Vector3.new(179.169998, 89.8700027, -179.169998)
  184. MeshPart14.Color = Color3.new(0.156863, 0.498039, 0.278431)
  185. MeshPart14.Size = Vector3.new(2.00029206, 1.60093355, 1.0005368)
  186. MeshPart14.BrickColor = BrickColor.new("Dark green")
  187. MeshPart14.brickColor = BrickColor.new("Dark green")
  188. Vector3Value15.Name = "OriginalSize"
  189. Vector3Value15.Parent = MeshPart14
  190. Vector3Value15.Value = Vector3.new(2.00029206, 1.60093355, 1.0005368)
  191. Motor6D16.Name = "Waist"
  192. Motor6D16.Parent = MeshPart14
  193. Motor6D16.C0 = CFrame.new(0.000280171633, 0.537143946, -0.0142721087, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  194. Motor6D16.C1 = CFrame.new(0.000338107347, -0.463463932, -0.015560925, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  195. Motor6D16.Part0 = MeshPart41
  196. Motor6D16.Part1 = MeshPart14
  197. Motor6D16.part1 = MeshPart14
  198. Script17.Name = "Damage Script"
  199. Script17.Parent = MeshPart14
  200. table.insert(cors,sandbox(Script17,function()
  201. function onTouched(hit)
  202.         local human = hit.Parent:findFirstChild("Humanoid")
  203.         if (human ~= nil) then
  204.                 human.Health = human.Health - 999999999
  205.         end
  206. end
  207. script.Parent.Touched:connect(onTouched)
  208. end))
  209. Humanoid18.Name = "Zombie"
  210. Humanoid18.Parent = Model0
  211. Humanoid18.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.Subject
  212. Humanoid18.Health = 125
  213. Humanoid18.HealthDisplayType = Enum.HumanoidHealthDisplayType.AlwaysOff
  214. Humanoid18.HipHeight = 1.3500000238419
  215. Humanoid18.LeftLeg = MeshPart45
  216. Humanoid18.MaxHealth = 125
  217. Humanoid18.NameOcclusion = Enum.NameOcclusion.NoOcclusion
  218. Humanoid18.RigType = Enum.HumanoidRigType.R15
  219. Humanoid18.RightLeg = MeshPart20
  220. Humanoid18.Torso = Part11
  221. Humanoid18.WalkSpeed = 20
  222. Humanoid18.maxHealth = 125
  223. Script19.Parent = Model0
  224. table.insert(cors,sandbox(Script19,function()
  225. local larm = script.Parent:FindFirstChild("HumanoidRootPart")
  226. local rarm = script.Parent:FindFirstChild("HumanoidRootPart")
  227. local char = script.Parent
  228. local pathFinder = game:GetService("PathfindingService")
  229. local path = pathFinder:CreatePath()
  230.  
  231. function findNearestTorso(pos)
  232.     local list = game.Workspace:children()
  233.     local torso = nil
  234.     local dist = 100
  235.     local temp = nil
  236.     local human = nil
  237.     local temp2 = nil
  238.     for x = 1, #list do
  239.         temp2 = list[x]
  240.         if (temp2.className == "Model") and (temp2 ~= script.Parent) then
  241.             temp = temp2:findFirstChild("HumanoidRootPart")
  242.             human = temp2:findFirstChild("Humanoid")
  243.             if (temp ~= nil) and (human ~= nil) and (human.Health > 0) then
  244.                 if (temp.Position - pos).magnitude < dist then
  245.                     torso = temp
  246.                     dist = (temp.Position - pos).magnitude
  247.                 end
  248.             end
  249.         end
  250.     end
  251.     return torso
  252. end
  253.  
  254. while true do
  255.     wait()
  256.     local target = findNearestTorso(script.Parent.HumanoidRootPart.Position)
  257.     if target ~= nil then
  258.         path:ComputeAsync(char.HumanoidRootPart.Position, target.Position)
  259.  
  260.         for i, wayPoint in pairs(path:GetWaypoints()) do
  261.             char.Zombie:MoveTo(wayPoint.Position)
  262.  
  263.             if wayPoint.Action == Enum.PathWaypointAction.Jump then
  264.                 char.Zombie:ChangeState(Enum.HumanoidStateType.Jumping)
  265.             end
  266.  
  267.             char.Zombie.MoveToFinished:wait()
  268.         end
  269.     end
  270. end
  271.  
  272. end))
  273. MeshPart20.Name = "RightUpperLeg"
  274. MeshPart20.Parent = Model0
  275. MeshPart20.CFrame = CFrame.new(-0.67828238, 1.46466565, -2.69960117, -0.00241400092, 3.49997972e-05, 0.999997497, 0, 1, -3.499991e-05, -0.999997497, -8.44897698e-08, -0.00241400092)
  276. MeshPart20.Orientation = Vector3.new(0, 90.1399994, 0)
  277. MeshPart20.Position = Vector3.new(-0.67828238, 1.46466565, -2.69960117)
  278. MeshPart20.Rotation = Vector3.new(179.169998, 89.8700027, -179.169998)
  279. MeshPart20.Color = Color3.new(0.0509804, 0.411765, 0.67451)
  280. MeshPart20.Size = Vector3.new(1.00027561, 1.5362649, 1.00092912)
  281. MeshPart20.BrickColor = BrickColor.new("Bright blue")
  282. MeshPart20.CanCollide = false
  283. MeshPart20.brickColor = BrickColor.new("Bright blue")
  284. Vector3Value21.Name = "OriginalSize"
  285. Vector3Value21.Parent = MeshPart20
  286. Vector3Value21.Value = Vector3.new(1.00027561, 1.5362649, 1.00092912)
  287. Motor6D22.Name = "RightHip"
  288. Motor6D22.Parent = MeshPart20
  289. Motor6D22.C0 = CFrame.new(0.505080223, -0.243262246, 0.00102789141, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  290. Motor6D22.C1 = CFrame.new(0.00382620096, 0.484913796, 0.000486815348, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  291. Motor6D22.Part0 = MeshPart41
  292. Motor6D22.Part1 = MeshPart20
  293. Motor6D22.part1 = MeshPart20
  294. MeshPart23.Name = "RightUpperArm"
  295. MeshPart23.Parent = Model0
  296. MeshPart23.CFrame = CFrame.new(-0.685997844, 3.29312539, -3.69646788, -0.00241400092, 3.49997972e-05, 0.999997497, 0, 1, -3.499991e-05, -0.999997497, -8.44897698e-08, -0.00241400092)
  297. MeshPart23.Orientation = Vector3.new(0, 90.1399994, 0)
  298. MeshPart23.Position = Vector3.new(-0.685997844, 3.29312539, -3.69646788)
  299. MeshPart23.Rotation = Vector3.new(179.169998, 89.8700027, -179.169998)
  300. MeshPart23.Color = Color3.new(0.992157, 0.917647, 0.552941)
  301. MeshPart23.Size = Vector3.new(1.00027633, 1.39554, 1.00025082)
  302. MeshPart23.BrickColor = BrickColor.new("Cool yellow")
  303. MeshPart23.CanCollide = false
  304. MeshPart23.brickColor = BrickColor.new("Cool yellow")
  305. Vector3Value24.Name = "OriginalSize"
  306. Vector3Value24.Parent = MeshPart23
  307. Vector3Value24.Value = Vector3.new(1.00027633, 1.39554, 1.00025082)
  308. Motor6D25.Name = "RightShoulder"
  309. Motor6D25.Parent = MeshPart23
  310. Motor6D25.C0 = CFrame.new(1.25031853, 0.5565539, -0.015560925, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  311. Motor6D25.C1 = CFrame.new(-0.24787569, 0.456878304, -0.00944012403, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  312. Motor6D25.Part0 = MeshPart14
  313. Motor6D25.Part1 = MeshPart23
  314. Motor6D25.part1 = MeshPart23
  315. MeshPart26.Name = "RightLowerLeg"
  316. MeshPart26.Parent = Model0
  317. MeshPart26.CFrame = CFrame.new(-0.678020656, 0.910310864, -2.69960189, -0.00241400092, 3.49997972e-05, 0.999997497, 0, 1, -3.499991e-05, -0.999997497, -8.44897698e-08, -0.00241400092)
  318. MeshPart26.Orientation = Vector3.new(0, 90.1399994, 0)
  319. MeshPart26.Position = Vector3.new(-0.678020656, 0.910310864, -2.69960189)
  320. MeshPart26.Rotation = Vector3.new(179.169998, 89.8700027, -179.169998)
  321. MeshPart26.Color = Color3.new(0.0509804, 0.411765, 0.67451)
  322. MeshPart26.Size = Vector3.new(1.00027585, 1.48964536, 1.00032854)
  323. MeshPart26.BrickColor = BrickColor.new("Bright blue")
  324. MeshPart26.CanCollide = false
  325. MeshPart26.brickColor = BrickColor.new("Bright blue")
  326. Vector3Value27.Name = "OriginalSize"
  327. Vector3Value27.Parent = MeshPart26
  328. Vector3Value27.Value = Vector3.new(1.00027585, 1.48964536, 1.00032854)
  329. Motor6D28.Name = "RightKnee"
  330. Motor6D28.Parent = MeshPart26
  331. Motor6D28.C0 = CFrame.new(0.00382620096, -0.265086174, 0.000426991843, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  332. Motor6D28.C1 = CFrame.new(0.00382620096, 0.289268613, 0.000145851634, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  333. Motor6D28.Part0 = MeshPart20
  334. Motor6D28.Part1 = MeshPart26
  335. Motor6D28.part1 = MeshPart26
  336. MeshPart29.Name = "RightLowerArm"
  337. MeshPart29.Parent = Model0
  338. MeshPart29.CFrame = CFrame.new(-0.685555518, 2.90703535, -3.69646835, -0.00241400092, 3.49997972e-05, 0.999997497, 0, 1, -3.499991e-05, -0.999997497, -8.44897698e-08, -0.00241400092)
  339. MeshPart29.Orientation = Vector3.new(0, 90.1399994, 0)
  340. MeshPart29.Position = Vector3.new(-0.685555518, 2.90703535, -3.69646835)
  341. MeshPart29.Rotation = Vector3.new(179.169998, 89.8700027, -179.169998)
  342. MeshPart29.Color = Color3.new(0.992157, 0.917647, 0.552941)
  343. MeshPart29.Size = Vector3.new(1.00027657, 1.26567209, 1.00025082)
  344. MeshPart29.BrickColor = BrickColor.new("Cool yellow")
  345. MeshPart29.CanCollide = false
  346. MeshPart29.brickColor = BrickColor.new("Cool yellow")
  347. Vector3Value30.Name = "OriginalSize"
  348. Vector3Value30.Parent = MeshPart29
  349. Vector3Value30.Value = Vector3.new(1.00027657, 1.26567209, 1.00025082)
  350. Motor6D31.Name = "RightElbow"
  351. Motor6D31.Parent = MeshPart29
  352. Motor6D31.C0 = CFrame.new(0.00214397907, -0.263139546, -0.00944012403, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  353. Motor6D31.C1 = CFrame.new(0.00214457512, 0.122950554, -0.00989595056, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  354. Motor6D31.Part0 = MeshPart23
  355. Motor6D31.Part1 = MeshPart29
  356. Motor6D31.part1 = MeshPart29
  357. MeshPart32.Name = "RightHand"
  358. MeshPart32.Parent = Model0
  359. MeshPart32.CFrame = CFrame.new(-0.680041432, 2.1668787, -3.69776106, -0.00241400092, 3.49997972e-05, 0.999997497, 0, 1, -3.499991e-05, -0.999997497, -8.44897698e-08, -0.00241400092)
  360. MeshPart32.Orientation = Vector3.new(0, 90.1399994, 0)
  361. MeshPart32.Position = Vector3.new(-0.680041432, 2.1668787, -3.69776106)
  362. MeshPart32.Rotation = Vector3.new(179.169998, 89.8700027, -179.169998)
  363. MeshPart32.Color = Color3.new(0.992157, 0.917647, 0.552941)
  364. MeshPart32.Size = Vector3.new(0.999299049, 0.335255772, 1.00029743)
  365. MeshPart32.BrickColor = BrickColor.new("Cool yellow")
  366. MeshPart32.CanCollide = false
  367. MeshPart32.brickColor = BrickColor.new("Cool yellow")
  368. Vector3Value33.Name = "OriginalSize"
  369. Vector3Value33.Parent = MeshPart32
  370. Vector3Value33.Value = Vector3.new(0.999299049, 0.335255772, 1.00029743)
  371. Motor6D34.Name = "RightWrist"
  372. Motor6D34.Parent = MeshPart32
  373. Motor6D34.C0 = CFrame.new(0.00214457512, -0.682049513, -0.00989595056, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  374. Motor6D34.C1 = CFrame.new(0.000865101814, 0.058106944, -0.0154390335, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  375. Motor6D34.Part0 = MeshPart29
  376. Motor6D34.Part1 = MeshPart32
  377. Motor6D34.part1 = MeshPart32
  378. MeshPart35.Name = "RightFoot"
  379. MeshPart35.Parent = Model0
  380. MeshPart35.CFrame = CFrame.new(-0.677906275, 0.167736173, -2.69441152, -0.00241400092, 3.49997972e-05, 0.999997497, 0, 1, -3.499991e-05, -0.999997497, -8.44897698e-08, -0.00241400092)
  381. MeshPart35.Orientation = Vector3.new(0, 90.1399994, 0)
  382. MeshPart35.Position = Vector3.new(-0.677906275, 0.167736173, -2.69441152)
  383. MeshPart35.Rotation = Vector3.new(179.169998, 89.8700027, -179.169998)
  384. MeshPart35.Color = Color3.new(0.0509804, 0.411765, 0.67451)
  385. MeshPart35.Size = Vector3.new(1.00063133, 0.335407376, 1.00020337)
  386. MeshPart35.BrickColor = BrickColor.new("Bright blue")
  387. MeshPart35.CanCollide = false
  388. MeshPart35.brickColor = BrickColor.new("Bright blue")
  389. Vector3Value36.Name = "OriginalSize"
  390. Vector3Value36.Parent = MeshPart35
  391. Vector3Value36.Value = Vector3.new(1.00063133, 0.335407376, 1.00020337)
  392. Motor6D37.Name = "RightAnkle"
  393. Motor6D37.Parent = MeshPart35
  394. Motor6D37.C0 = CFrame.new(0.00382620096, -0.710731506, 0.000283418223, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  395. Motor6D37.C1 = CFrame.new(0.00901681185, 0.0318431854, 0.000155551359, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  396. Motor6D37.Part0 = MeshPart26
  397. Motor6D37.Part1 = MeshPart35
  398. Motor6D37.part1 = MeshPart35
  399. MeshPart38.Name = "LeftFoot"
  400. MeshPart38.Parent = Model0
  401. MeshPart38.CFrame = CFrame.new(-0.675512314, 0.167736173, -1.70284736, -0.00241400092, 3.49997972e-05, 0.999997497, 0, 1, -3.499991e-05, -0.999997497, -8.44897698e-08, -0.00241400092)
  402. MeshPart38.Orientation = Vector3.new(0, 90.1399994, 0)
  403. MeshPart38.Position = Vector3.new(-0.675512314, 0.167736173, -1.70284736)
  404. MeshPart38.Rotation = Vector3.new(179.169998, 89.8700027, -179.169998)
  405. MeshPart38.Color = Color3.new(0.0509804, 0.411765, 0.67451)
  406. MeshPart38.Size = Vector3.new(1.00063133, 0.335407257, 1.00020337)
  407. MeshPart38.BrickColor = BrickColor.new("Bright blue")
  408. MeshPart38.CanCollide = false
  409. MeshPart38.brickColor = BrickColor.new("Bright blue")
  410. Vector3Value39.Name = "OriginalSize"
  411. Vector3Value39.Parent = MeshPart38
  412. Vector3Value39.Value = Vector3.new(1.00063133, 0.335407257, 1.00020337)
  413. Motor6D40.Name = "LeftAnkle"
  414. Motor6D40.Parent = MeshPart38
  415. Motor6D40.C0 = CFrame.new(-0.00382620096, -0.710131407, 0.00030554086, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  416. Motor6D40.C1 = CFrame.new(-0.00901681185, 0.032443285, 0.000177569687, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  417. Motor6D40.Part0 = MeshPart51
  418. Motor6D40.Part1 = MeshPart38
  419. Motor6D40.part1 = MeshPart38
  420. MeshPart41.Name = "LowerTorso"
  421. MeshPart41.Parent = Model0
  422. MeshPart41.CFrame = CFrame.new(-0.677587926, 2.19284177, -2.19834709, -0.00241400092, 3.49997972e-05, 0.999997497, 0, 1, -3.499991e-05, -0.999997497, -8.44897698e-08, -0.00241400092)
  423. MeshPart41.Orientation = Vector3.new(0, 90.1399994, 0)
  424. MeshPart41.Position = Vector3.new(-0.677587926, 2.19284177, -2.19834709)
  425. MeshPart41.Rotation = Vector3.new(179.169998, 89.8700027, -179.169998)
  426. MeshPart41.Color = Color3.new(0.156863, 0.498039, 0.278431)
  427. MeshPart41.Size = Vector3.new(2.00017595, 0.400037616, 1.00021255)
  428. MeshPart41.BrickColor = BrickColor.new("Dark green")
  429. MeshPart41.brickColor = BrickColor.new("Dark green")
  430. Vector3Value42.Name = "OriginalSize"
  431. Vector3Value42.Parent = MeshPart41
  432. Vector3Value42.Value = Vector3.new(2.00017595, 0.400037616, 1.00021255)
  433. Motor6D43.Name = "Root"
  434. Motor6D43.Parent = MeshPart41
  435. Motor6D43.C1 = CFrame.new(0.000280171633, 0.133037761, -0.0142721087, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  436. Motor6D43.Part0 = Part11
  437. Motor6D43.Part1 = MeshPart41
  438. Motor6D43.part1 = MeshPart41
  439. Script44.Name = "Damage Script"
  440. Script44.Parent = MeshPart41
  441. table.insert(cors,sandbox(Script44,function()
  442. function onTouched(hit)
  443.         local human = hit.Parent:findFirstChild("Humanoid")
  444.         if (human ~= nil) then
  445.                 human.Health = human.Health - 999
  446.         end
  447. end
  448. script.Parent.Touched:connect(onTouched)
  449. end))
  450. MeshPart45.Name = "LeftUpperLeg"
  451. MeshPart45.Parent = Model0
  452. MeshPart45.CFrame = CFrame.new(-0.675863564, 1.46466565, -1.69765592, -0.00241400092, 3.49997972e-05, 0.999997497, 0, 1, -3.499991e-05, -0.999997497, -8.44897698e-08, -0.00241400092)
  453. MeshPart45.Orientation = Vector3.new(0, 90.1399994, 0)
  454. MeshPart45.Position = Vector3.new(-0.675863564, 1.46466565, -1.69765592)
  455. MeshPart45.Rotation = Vector3.new(179.169998, 89.8700027, -179.169998)
  456. MeshPart45.Color = Color3.new(0.0509804, 0.411765, 0.67451)
  457. MeshPart45.Size = Vector3.new(1.00027561, 1.5362649, 1.00092912)
  458. MeshPart45.BrickColor = BrickColor.new("Bright blue")
  459. MeshPart45.CanCollide = false
  460. MeshPart45.brickColor = BrickColor.new("Bright blue")
  461. Vector3Value46.Name = "OriginalSize"
  462. Vector3Value46.Parent = MeshPart45
  463. Vector3Value46.Value = Vector3.new(1.00027561, 1.5362649, 1.00092912)
  464. Motor6D47.Name = "LeftHip"
  465. Motor6D47.Parent = MeshPart45
  466. Motor6D47.C0 = CFrame.new(-0.50451982, -0.243062243, 0.00122789107, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  467. Motor6D47.C1 = CFrame.new(-0.00382620096, 0.4851138, 0.000686740503, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  468. Motor6D47.Part0 = MeshPart41
  469. Motor6D47.Part1 = MeshPart45
  470. Motor6D47.part1 = MeshPart45
  471. MeshPart48.Name = "LeftUpperArm"
  472. MeshPart48.Parent = Model0
  473. MeshPart48.CFrame = CFrame.new(-0.678766429, 3.29312539, -0.700763106, -0.00241400092, 3.49997972e-05, 0.999997497, 0, 1, -3.499991e-05, -0.999997497, -8.44897698e-08, -0.00241400092)
  474. MeshPart48.Orientation = Vector3.new(0, 90.1399994, 0)
  475. MeshPart48.Position = Vector3.new(-0.678766429, 3.29312539, -0.700763106)
  476. MeshPart48.Rotation = Vector3.new(179.169998, 89.8700027, -179.169998)
  477. MeshPart48.Color = Color3.new(0.992157, 0.917647, 0.552941)
  478. MeshPart48.Size = Vector3.new(1.00027633, 1.39554, 1.00025082)
  479. MeshPart48.BrickColor = BrickColor.new("Cool yellow")
  480. MeshPart48.CanCollide = false
  481. MeshPart48.brickColor = BrickColor.new("Cool yellow")
  482. Vector3Value49.Name = "OriginalSize"
  483. Vector3Value49.Parent = MeshPart48
  484. Vector3Value49.Value = Vector3.new(1.00027633, 1.39554, 1.00025082)
  485. Motor6D50.Name = "LeftShoulder"
  486. Motor6D50.Parent = MeshPart48
  487. Motor6D50.C0 = CFrame.new(-1.24955308, 0.556408584, -0.015560925, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  488. Motor6D50.C1 = CFrame.new(0.247964978, 0.456732988, -0.00943991542, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  489. Motor6D50.Part0 = MeshPart14
  490. Motor6D50.Part1 = MeshPart48
  491. Motor6D50.part1 = MeshPart48
  492. MeshPart51.Name = "LeftLowerLeg"
  493. MeshPart51.Parent = Model0
  494. MeshPart51.CFrame = CFrame.new(-0.67560178, 0.910310864, -1.69765651, -0.00241400092, 3.49997972e-05, 0.999997497, 0, 1, -3.499991e-05, -0.999997497, -8.44897698e-08, -0.00241400092)
  495. MeshPart51.Orientation = Vector3.new(0, 90.1399994, 0)
  496. MeshPart51.Position = Vector3.new(-0.67560178, 0.910310864, -1.69765651)
  497. MeshPart51.Rotation = Vector3.new(179.169998, 89.8700027, -179.169998)
  498. MeshPart51.Color = Color3.new(0.0509804, 0.411765, 0.67451)
  499. MeshPart51.Size = Vector3.new(1.00027585, 1.48964536, 1.00032866)
  500. MeshPart51.BrickColor = BrickColor.new("Bright blue")
  501. MeshPart51.CanCollide = false
  502. MeshPart51.brickColor = BrickColor.new("Bright blue")
  503. Vector3Value52.Name = "OriginalSize"
  504. Vector3Value52.Parent = MeshPart51
  505. Vector3Value52.Value = Vector3.new(1.00027585, 1.48964536, 1.00032866)
  506. Motor6D53.Name = "LeftKnee"
  507. Motor6D53.Parent = MeshPart51
  508. Motor6D53.C0 = CFrame.new(-0.00382620096, -0.264486194, 0.000586740673, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  509. Motor6D53.C1 = CFrame.new(-0.00382620096, 0.289868593, 0.00030554086, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  510. Motor6D53.Part0 = MeshPart45
  511. Motor6D53.Part1 = MeshPart51
  512. Motor6D53.part1 = MeshPart51
  513. MeshPart54.Name = "LeftLowerArm"
  514. MeshPart54.Parent = Model0
  515. MeshPart54.CFrame = CFrame.new(-0.678323925, 2.90703535, -0.700764775, -0.00241400092, 3.49997972e-05, 0.999997497, 0, 1, -3.499991e-05, -0.999997497, -8.44897698e-08, -0.00241400092)
  516. MeshPart54.Orientation = Vector3.new(0, 90.1399994, 0)
  517. MeshPart54.Position = Vector3.new(-0.678323925, 2.90703535, -0.700764775)
  518. MeshPart54.Rotation = Vector3.new(179.169998, 89.8700027, -179.169998)
  519. MeshPart54.Color = Color3.new(0.992157, 0.917647, 0.552941)
  520. MeshPart54.Size = Vector3.new(1.00027657, 1.26567209, 1.00025082)
  521. MeshPart54.BrickColor = BrickColor.new("Cool yellow")
  522. MeshPart54.CanCollide = false
  523. MeshPart54.brickColor = BrickColor.new("Cool yellow")
  524. Vector3Value55.Name = "OriginalSize"
  525. Vector3Value55.Parent = MeshPart54
  526. Vector3Value55.Value = Vector3.new(1.00027657, 1.26567209, 1.00025082)
  527. Motor6D56.Name = "LeftElbow"
  528. Motor6D56.Parent = MeshPart54
  529. Motor6D56.C0 = CFrame.new(-0.00166511536, -0.263139546, -0.00943991542, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  530. Motor6D56.C1 = CFrame.new(-0.0016657114, 0.122950554, -0.00989592075, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  531. Motor6D56.Part0 = MeshPart48
  532. Motor6D56.Part1 = MeshPart54
  533. Motor6D56.part1 = MeshPart54
  534. MeshPart57.Name = "LeftHand"
  535. MeshPart57.Parent = Model0
  536. MeshPart57.CFrame = CFrame.new(-0.67280364, 2.1668787, -0.699498653, -0.00241400092, 3.49997972e-05, 0.999997497, 0, 1, -3.499991e-05, -0.999997497, -8.44897698e-08, -0.00241400092)
  537. MeshPart57.Orientation = Vector3.new(0, 90.1399994, 0)
  538. MeshPart57.Position = Vector3.new(-0.67280364, 2.1668787, -0.699498653)
  539. MeshPart57.Rotation = Vector3.new(179.169998, 89.8700027, -179.169998)
  540. MeshPart57.Color = Color3.new(0.992157, 0.917647, 0.552941)
  541. MeshPart57.Size = Vector3.new(0.999299049, 0.335255831, 1.00029743)
  542. MeshPart57.BrickColor = BrickColor.new("Cool yellow")
  543. MeshPart57.CanCollide = false
  544. MeshPart57.brickColor = BrickColor.new("Cool yellow")
  545. Vector3Value58.Name = "OriginalSize"
  546. Vector3Value58.Parent = MeshPart57
  547. Vector3Value58.Value = Vector3.new(0.999299049, 0.335255831, 1.00029743)
  548. Motor6D59.Name = "LeftWrist"
  549. Motor6D59.Parent = MeshPart57
  550. Motor6D59.C0 = CFrame.new(-0.0016657114, -0.682255626, -0.00989592075, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  551. Motor6D59.C1 = CFrame.new(-0.000386238098, 0.0579008311, -0.0154390335, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  552. Motor6D59.Part0 = MeshPart54
  553. Motor6D59.Part1 = MeshPart57
  554. Motor6D59.part1 = MeshPart57
  555. Script60.Name = "Respawn"
  556. Script60.Parent = Model0
  557. table.insert(cors,sandbox(Script60,function()
  558. z = script.Parent
  559.  
  560. backup = z:clone()
  561.  
  562. while true do
  563.     wait(5)
  564.     if z.Zombie.Health == 0 then
  565.         z:Remove()
  566.         wait(4)
  567.         backup.Parent = game.Workspace
  568.         backup.Head:MakeJoints()
  569.         backup.Torso:MakeJoints()
  570.     end
  571.     if z == nil then
  572.         wait(4)
  573.         backup.Parent = game.Workspace
  574.         backup.Head:MakeJoints()
  575.         backup.Torso:MakeJoints()
  576.     end
  577. end
  578. end))
  579. Script61.Name = "Health"
  580. Script61.Parent = Model0
  581. table.insert(cors,sandbox(Script61,function()
  582. --Responsible for regening a player's humanoid's health
  583.  
  584. -- declarations
  585. local Figure = script.Parent
  586. local Head = Figure:WaitForChild("Head")
  587. local Humanoid = Figure:WaitForChild("Humanoid")
  588. local regening = false
  589.  
  590. -- regeneration
  591. function regenHealth()
  592.     if regening then return end
  593.     regening = true
  594.    
  595.     while Humanoid.Health < Humanoid.MaxHealth do
  596.         local s = wait(1)
  597.         local health = Humanoid.Health
  598.         if health > 0 and health < Humanoid.MaxHealth then
  599.             local newHealthDelta = 0.01 * s * Humanoid.MaxHealth
  600.             health = health + newHealthDelta
  601.             Humanoid.Health = math.min(health,Humanoid.MaxHealth)
  602.         end
  603.     end
  604.    
  605.     if Humanoid.Health > Humanoid.MaxHealth then
  606.         Humanoid.Health = Humanoid.MaxHealth
  607.     end
  608.    
  609.     regening = false
  610. end
  611.  
  612. Humanoid.HealthChanged:connect(regenHealth)
  613.  
  614. end))
  615. Script62.Name = "Animate"
  616. Script62.Parent = Model0
  617. table.insert(cors,sandbox(Script62,function()
  618. function   waitForChild(parent, childName)
  619.     local child = parent:findFirstChild(childName)
  620.     if child then return child end
  621.     while true do
  622.         child = parent.ChildAdded:wait()
  623.         if child.Name==childName then return child end
  624.     end
  625. end
  626.  
  627. local Figure = script.Parent
  628. local Humanoid = waitForChild(Figure, "Zombie")
  629. local pose = "Standing"
  630.  
  631. local currentAnim = ""
  632. local currentAnimInstance = nil
  633. local currentAnimTrack = nil
  634. local currentAnimKeyframeHandler = nil
  635. local currentAnimSpeed = 1.0
  636. local animTable = {}
  637. local animNames = {
  638.     idle =  {  
  639.                 { id = "http://www.roblox.com/asset/?id=507766666", weight = 1 },
  640.                 { id = "http://www.roblox.com/asset/?id=507766951", weight = 1 },
  641.                 { id = "http://www.roblox.com/asset/?id=507766388", weight = 9 }
  642.             },
  643.     walk =  {  
  644.                 { id = "http://www.roblox.com/asset/?id=507777826", weight = 10 }
  645.             },
  646.     run =   {
  647.                 { id = "http://www.roblox.com/asset/?id=507767714", weight = 10 }
  648.             },
  649.     swim =  {
  650.                 { id = "http://www.roblox.com/asset/?id=507784897", weight = 10 }
  651.             },
  652.     swimidle =  {
  653.                 { id = "http://www.roblox.com/asset/?id=507785072", weight = 10 }
  654.             },
  655.     jump =  {
  656.                 { id = "http://www.roblox.com/asset/?id=507765000", weight = 10 }
  657.             },
  658.     fall =  {
  659.                 { id = "http://www.roblox.com/asset/?id=507767968", weight = 10 }
  660.             },
  661.     climb = {
  662.                 { id = "http://www.roblox.com/asset/?id=507765644", weight = 10 }
  663.             },
  664.     sit =   {
  665.                 { id = "http://www.roblox.com/asset/?id=507768133", weight = 10 }
  666.             }, 
  667.     toolnone = {
  668.                 { id = "http://www.roblox.com/asset/?id=507768375", weight = 10 }
  669.             },
  670.     toolslash = {
  671.                 { id = "http://www.roblox.com/asset/?id=507768375", weight = 10 }
  672. --              { id = "slash.xml", weight = 10 }
  673.             },
  674.     toollunge = {
  675.                 { id = "http://www.roblox.com/asset/?id=507768375", weight = 10 }
  676.             },
  677.     wave = {
  678.                 { id = "http://www.roblox.com/asset/?id=507770239", weight = 10 }
  679.             },
  680.     point = {
  681.                 { id = "http://www.roblox.com/asset/?id=507770453", weight = 10 }
  682.             },
  683.     dance = {
  684.                 { id = "http://www.roblox.com/asset/?id=507771019", weight = 10 },
  685.                 { id = "http://www.roblox.com/asset/?id=507771955", weight = 10 },
  686.                 { id = "http://www.roblox.com/asset/?id=507772104", weight = 10 }
  687.             },
  688.     dance2 = {
  689.                 { id = "http://www.roblox.com/asset/?id=507776043", weight = 10 },
  690.                 { id = "http://www.roblox.com/asset/?id=507776720", weight = 10 },
  691.                 { id = "http://www.roblox.com/asset/?id=507776879", weight = 10 }
  692.             },
  693.     dance3 = {
  694.                 { id = "http://www.roblox.com/asset/?id=507777268", weight = 10 },
  695.                 { id = "http://www.roblox.com/asset/?id=507777451", weight = 10 },
  696.                 { id = "http://www.roblox.com/asset/?id=507777623", weight = 10 }
  697.             },
  698.     laugh = {
  699.                 { id = "http://www.roblox.com/asset/?id=507770818", weight = 10 }
  700.             },
  701.     cheer = {
  702.                 { id = "http://www.roblox.com/asset/?id=507770677", weight = 10 }
  703.             },
  704. }
  705.  
  706. -- Existance in this list signifies that it is an emote, the value indicates if it is a looping emote
  707. local emoteNames = { wave = false, point = false, dance = true, dance2 = true, dance3 = true, laugh = false, cheer = false}
  708.  
  709. math.randomseed(tick())
  710.  
  711. function configureAnimationSet(name, fileList)
  712.     if (animTable[name] ~= nil) then
  713.         for _, connection in pairs(animTable[name].connections) do
  714.             connection:disconnect()
  715.         end
  716.     end
  717.     animTable[name] = {}
  718.     animTable[name].count = 0
  719.     animTable[name].totalWeight = 0
  720.     animTable[name].connections = {}
  721.  
  722.     -- check for config values
  723.     local config = script:FindFirstChild(name)
  724.     if (config ~= nil) then
  725. --      print("Loading anims " .. name)
  726.         table.insert(animTable[name].connections, config.ChildAdded:connect(function(child) configureAnimationSet(name, fileList) end))
  727.         table.insert(animTable[name].connections, config.ChildRemoved:connect(function(child) configureAnimationSet(name, fileList) end))
  728.         local idx = 1
  729.         for _, childPart in pairs(config:GetChildren()) do
  730.             if (childPart:IsA("Animation")) then
  731.                 table.insert(animTable[name].connections, childPart.Changed:connect(function(property) configureAnimationSet(name, fileList) end))
  732.                 animTable[name][idx] = {}
  733.                 animTable[name][idx].anim = childPart
  734.                 local weightObject = childPart:FindFirstChild("Weight")
  735.                 if (weightObject == nil) then
  736.                     animTable[name][idx].weight = 1
  737.                 else
  738.                     animTable[name][idx].weight = weightObject.Value
  739.                 end
  740.                 animTable[name].count = animTable[name].count + 1
  741.                 animTable[name].totalWeight = animTable[name].totalWeight + animTable[name][idx].weight
  742. --              print(name .. " [" .. idx .. "] " .. animTable[name][idx].anim.AnimationId .. " (" .. animTable[name][idx].weight .. ")")
  743.                 idx = idx + 1
  744.             end
  745.         end
  746.     end
  747.  
  748.     -- fallback to defaults
  749.     if (animTable[name].count <= 0) then
  750.         for idx, anim in pairs(fileList) do
  751.             animTable[name][idx] = {}
  752.             animTable[name][idx].anim = Instance.new("Animation")
  753.             animTable[name][idx].anim.Name = name
  754.             animTable[name][idx].anim.AnimationId = anim.id
  755.             animTable[name][idx].weight = anim.weight
  756.             animTable[name].count = animTable[name].count + 1
  757.             animTable[name].totalWeight = animTable[name].totalWeight + anim.weight
  758. --          print(name .. " [" .. idx .. "] " .. anim.id .. " (" .. anim.weight .. ")")
  759.         end
  760.     end
  761. end
  762.  
  763. -- Setup animation objects
  764. function scriptChildModified(child)
  765.     local fileList = animNames[child.Name]
  766.     if (fileList ~= nil) then
  767.         configureAnimationSet(child.Name, fileList)
  768.     end
  769. end
  770.  
  771. script.ChildAdded:connect(scriptChildModified)
  772. script.ChildRemoved:connect(scriptChildModified)
  773.  
  774.  
  775. for name, fileList in pairs(animNames) do
  776.     configureAnimationSet(name, fileList)
  777. end
  778.  
  779. -- ANIMATION
  780.  
  781. -- declarations
  782. local toolAnim = "None"
  783. local toolAnimTime = 0
  784.  
  785. local jumpAnimTime = 0
  786. local jumpAnimDuration = 0.31
  787.  
  788. local toolTransitionTime = 0.1
  789. local fallTransitionTime = 0.2
  790.  
  791. -- functions
  792.  
  793. function stopAllAnimations()
  794.     local oldAnim = currentAnim
  795.  
  796.     -- return to idle if finishing an emote
  797.     if (emoteNames[oldAnim] ~= nil and emoteNames[oldAnim] == false) then
  798.         oldAnim = "idle"
  799.     end
  800.  
  801.     currentAnim = ""
  802.     currentAnimInstance = nil
  803.     if (currentAnimKeyframeHandler ~= nil) then
  804.         currentAnimKeyframeHandler:disconnect()
  805.     end
  806.  
  807.     if (currentAnimTrack ~= nil) then
  808.         currentAnimTrack:Stop()
  809.         currentAnimTrack:Destroy()
  810.         currentAnimTrack = nil
  811.     end
  812.     return oldAnim
  813. end
  814.  
  815. function setAnimationSpeed(speed)
  816.     if speed ~= currentAnimSpeed then
  817.         currentAnimSpeed = speed
  818.         currentAnimTrack:AdjustSpeed(currentAnimSpeed)
  819.     end
  820. end
  821.  
  822. function keyFrameReachedFunc(frameName)
  823.     if (frameName == "End") then
  824. --      print("Keyframe : ".. frameName)
  825.  
  826.         local repeatAnim = currentAnim
  827.         -- return to idle if finishing an emote
  828.         if (emoteNames[repeatAnim] ~= nil and emoteNames[repeatAnim] == false) then
  829.             repeatAnim = "idle"
  830.         end
  831.        
  832.         local animSpeed = currentAnimSpeed
  833.         playAnimation(repeatAnim, 0.15, Humanoid)
  834.         setAnimationSpeed(animSpeed)
  835.     end
  836. end
  837.  
  838. -- Preload animations
  839. function playAnimation(animName, transitionTime, humanoid)
  840.        
  841.     local roll = math.random(1, animTable[animName].totalWeight)
  842.     local origRoll = roll
  843.     local idx = 1
  844.     while (roll > animTable[animName][idx].weight) do
  845.         roll = roll - animTable[animName][idx].weight
  846.         idx = idx + 1
  847.     end
  848.    
  849. --  print(animName .. " " .. idx .. " [" .. origRoll .. "]")
  850.    
  851.     local anim = animTable[animName][idx].anim
  852.  
  853.     -- switch animation    
  854.     if (anim ~= currentAnimInstance) then
  855.        
  856.         if (currentAnimTrack ~= nil) then
  857.             currentAnimTrack:Stop(transitionTime)
  858.             currentAnimTrack:Destroy()
  859.         end
  860.  
  861.         currentAnimSpeed = 1.0
  862.    
  863.         -- load it to the humanoid; get AnimationTrack
  864.         currentAnimTrack = humanoid:LoadAnimation(anim)
  865.          
  866.         -- play the animation
  867.         currentAnimTrack:Play(transitionTime)
  868.         currentAnim = animName
  869.         currentAnimInstance = anim
  870.  
  871.         -- set up keyframe name triggers
  872.         if (currentAnimKeyframeHandler ~= nil) then
  873.             currentAnimKeyframeHandler:disconnect()
  874.         end
  875.         currentAnimKeyframeHandler = currentAnimTrack.KeyframeReached:connect(keyFrameReachedFunc)
  876.        
  877.     end
  878.  
  879. end
  880.  
  881. -------------------------------------------------------------------------------------------
  882. -------------------------------------------------------------------------------------------
  883.  
  884. local toolAnimName = ""
  885. local toolAnimTrack = nil
  886. local toolAnimInstance = nil
  887. local currentToolAnimKeyframeHandler = nil
  888.  
  889. function toolKeyFrameReachedFunc(frameName)
  890.     if (frameName == "End") then
  891. --      print("Keyframe : ".. frameName)   
  892.         playToolAnimation(toolAnimName, 0.0, Humanoid)
  893.     end
  894. end
  895.  
  896.  
  897. function playToolAnimation(animName, transitionTime, humanoid)   
  898.        
  899.         local roll = math.random(1, animTable[animName].totalWeight)
  900.         local origRoll = roll
  901.         local idx = 1
  902.         while (roll > animTable[animName][idx].weight) do
  903.             roll = roll - animTable[animName][idx].weight
  904.             idx = idx + 1
  905.         end
  906. --      print(animName .. " * " .. idx .. " [" .. origRoll .. "]")
  907.         local anim = animTable[animName][idx].anim
  908.  
  909.         if (toolAnimInstance ~= anim) then
  910.            
  911.             if (toolAnimTrack ~= nil) then
  912.                 toolAnimTrack:Stop()
  913.                 toolAnimTrack:Destroy()
  914.                 transitionTime = 0
  915.             end
  916.                    
  917.             -- load it to the humanoid; get AnimationTrack
  918.             toolAnimTrack = humanoid:LoadAnimation(anim)
  919.              
  920.             -- play the animation
  921.             toolAnimTrack:Play(transitionTime)
  922.             toolAnimName = animName
  923.             toolAnimInstance = anim
  924.  
  925.             currentToolAnimKeyframeHandler = toolAnimTrack.KeyframeReached:connect(toolKeyFrameReachedFunc)
  926.         end
  927. end
  928.  
  929. function stopToolAnimations()
  930.     local oldAnim = toolAnimName
  931.  
  932.     if (currentToolAnimKeyframeHandler ~= nil) then
  933.         currentToolAnimKeyframeHandler:disconnect()
  934.     end
  935.  
  936.     toolAnimName = ""
  937.     toolAnimInstance = nil
  938.     if (toolAnimTrack ~= nil) then
  939.         toolAnimTrack:Stop()
  940.         toolAnimTrack:Destroy()
  941.         toolAnimTrack = nil
  942.     end
  943.  
  944.  
  945.     return oldAnim
  946. end
  947.  
  948. -------------------------------------------------------------------------------------------
  949. -------------------------------------------------------------------------------------------
  950.  
  951.  
  952. function onRunning(speed)
  953.     if speed > 0.01 then
  954.         local scale = 15.0
  955.         playAnimation("walk", 0.1, Humanoid)
  956.         setAnimationSpeed(speed / scale)
  957.         pose = "Running"
  958.     else
  959.         playAnimation("idle", 0.1, Humanoid)
  960.         pose = "Standing"
  961.     end
  962. end
  963.  
  964. function onDied()
  965.     pose = "Dead"
  966. end
  967.  
  968. function onJumping()
  969.     playAnimation("jump", 0.1, Humanoid)
  970.     jumpAnimTime = jumpAnimDuration
  971.     pose = "Jumping"
  972. end
  973.  
  974. function onClimbing(speed)
  975.     local scale = 5.0
  976.     playAnimation("climb", 0.1, Humanoid)
  977.     setAnimationSpeed(speed / scale)
  978.     pose = "Climbing"
  979. end
  980.  
  981. function onGettingUp()
  982.     pose = "GettingUp"
  983. end
  984.  
  985. function onFreeFall()
  986.     if (jumpAnimTime <= 0) then
  987.         playAnimation("fall", fallTransitionTime, Humanoid)
  988.     end
  989.     pose = "FreeFall"
  990. end
  991.  
  992. function onFallingDown()
  993.     pose = "FallingDown"
  994. end
  995.  
  996. function onSeated()
  997.     pose = "Seated"
  998. end
  999.  
  1000. function onPlatformStanding()
  1001.     pose = "PlatformStanding"
  1002. end
  1003.  
  1004. function onSwimming(speed)
  1005.     if speed > 1.00 then
  1006.         local scale = 10.0
  1007.         playAnimation("swim", 0.4, Humanoid)
  1008.         setAnimationSpeed(speed / scale)
  1009.         pose = "Swimming"
  1010.     else
  1011.         playAnimation("swimidle", 0.4, Humanoid)
  1012.         pose = "Standing"
  1013.     end
  1014. end
  1015.  
  1016. function getTool() 
  1017.     for _, kid in ipairs(Figure:GetChildren()) do
  1018.         if kid.className == "Tool" then return kid end
  1019.     end
  1020.     return nil
  1021. end
  1022.  
  1023. function getToolAnim(tool)
  1024.     for _, c in ipairs(tool:GetChildren()) do
  1025.         if c.Name == "toolanim" and c.className == "StringValue" then
  1026.             return c
  1027.         end
  1028.     end
  1029.     return nil
  1030. end
  1031.  
  1032. function animateTool()
  1033.    
  1034.     if (toolAnim == "None") then
  1035.         playToolAnimation("toolnone", toolTransitionTime, Humanoid)
  1036.         return
  1037.     end
  1038.  
  1039.     if (toolAnim == "Slash") then
  1040.         playToolAnimation("toolslash", 0, Humanoid)
  1041.         return
  1042.     end
  1043.  
  1044.     if (toolAnim == "Lunge") then
  1045.         playToolAnimation("toollunge", 0, Humanoid)
  1046.         return
  1047.     end
  1048. end
  1049.  
  1050. function moveSit()
  1051.     RightShoulder.MaxVelocity = 0.15
  1052.     LeftShoulder.MaxVelocity = 0.15
  1053.     RightShoulder:SetDesiredAngle(3.14 /2)
  1054.     LeftShoulder:SetDesiredAngle(-3.14 /2)
  1055.     RightHip:SetDesiredAngle(3.14 /2)
  1056.     LeftHip:SetDesiredAngle(-3.14 /2)
  1057. end
  1058.  
  1059. local lastTick = 0
  1060.  
  1061. function move(time)
  1062.     local amplitude = 1
  1063.     local frequency = 1
  1064.     local deltaTime = time - lastTick
  1065.     lastTick = time
  1066.  
  1067.     local climbFudge = 0
  1068.     local setAngles = false
  1069.  
  1070.     if (jumpAnimTime > 0) then
  1071.         jumpAnimTime = jumpAnimTime - deltaTime
  1072.     end
  1073.  
  1074.     if (pose == "FreeFall" and jumpAnimTime <= 0) then
  1075.         playAnimation("fall", fallTransitionTime, Humanoid)
  1076.     elseif (pose == "Seated") then
  1077.         playAnimation("sit", 0.5, Humanoid)
  1078.         return
  1079.     elseif (pose == "Running") then
  1080.         playAnimation("walk", 0.1, Humanoid)
  1081.     elseif (pose == "Dead" or pose == "GettingUp" or pose == "FallingDown" or pose == "Seated" or pose == "PlatformStanding") then
  1082.         stopAllAnimations()
  1083.         amplitude = 0.1
  1084.         frequency = 1
  1085.         setAngles = true
  1086.     end
  1087.  
  1088.     -- Tool Animation handling
  1089.     local tool = getTool()
  1090.     if tool then
  1091.    
  1092.         animStringValueObject = getToolAnim(tool)
  1093.  
  1094.         if animStringValueObject then
  1095.             toolAnim = animStringValueObject.Value
  1096.             -- message recieved, delete StringValue
  1097.             animStringValueObject.Parent = nil
  1098.             toolAnimTime = time + .3
  1099.         end
  1100.  
  1101.         if time > toolAnimTime then
  1102.             toolAnimTime = 0
  1103.             toolAnim = "None"
  1104.         end
  1105.  
  1106.         animateTool()      
  1107.     else
  1108.         stopToolAnimations()
  1109.         toolAnim = "None"
  1110.         toolAnimInstance = nil
  1111.         toolAnimTime = 0
  1112.     end
  1113. end
  1114.  
  1115. -- connect events
  1116. Humanoid.Died:connect(onDied)
  1117. Humanoid.Running:connect(onRunning)
  1118. Humanoid.Jumping:connect(onJumping)
  1119. Humanoid.Climbing:connect(onClimbing)
  1120. Humanoid.GettingUp:connect(onGettingUp)
  1121. Humanoid.FreeFalling:connect(onFreeFall)
  1122. Humanoid.FallingDown:connect(onFallingDown)
  1123. Humanoid.Seated:connect(onSeated)
  1124. Humanoid.PlatformStanding:connect(onPlatformStanding)
  1125. Humanoid.Swimming:connect(onSwimming)
  1126.  
  1127. -- setup emote chat hook
  1128. script.msg.Changed:connect(function(msg)
  1129.     script.msg.Value = ""
  1130.     local emote = ""
  1131.     if (string.sub(msg, 1, 3) == "/e ") then
  1132.         emote = string.sub(msg, 4)
  1133.     elseif (string.sub(msg, 1, 7) == "/emote ") then
  1134.         emote = string.sub(msg, 8)
  1135.     end
  1136.    
  1137.     if (pose == "Standing" and emoteNames[emote] ~= nil) then
  1138.         playAnimation(emote, 0.1, Humanoid)
  1139.     end
  1140. --  print("===> " .. string.sub(msg, 1, 3) .. "(" .. emote .. ")")
  1141. end)
  1142.  
  1143.  
  1144. -- main program
  1145.  
  1146. local runService = game:service("RunService");
  1147.  
  1148. -- print("bottom")
  1149.  
  1150. -- initialize to idle
  1151. playAnimation("idle", 0.1, Humanoid)
  1152. pose = "Standing"
  1153.  
  1154. while Figure.Parent~=nil do
  1155.     local _, time = wait(0.1)
  1156.     move(time)
  1157. end
  1158.  
  1159.  
  1160.  
  1161. end))
  1162. StringValue63.Name = "msg"
  1163. StringValue63.Parent = Script62
  1164. StringValue64.Name = "climb"
  1165. StringValue64.Parent = Script62
  1166. Animation65.Name = "ClimbAnim"
  1167. Animation65.Parent = StringValue64
  1168. Animation65.AnimationId = "http://www.roblox.com/asset/?id=616156119"
  1169. StringValue66.Name = "fall"
  1170. StringValue66.Parent = Script62
  1171. Animation67.Name = "FallAnim"
  1172. Animation67.Parent = StringValue66
  1173. Animation67.AnimationId = "http://www.roblox.com/asset/?id=616157476"
  1174. StringValue68.Name = "idle"
  1175. StringValue68.Parent = Script62
  1176. Animation69.Name = "Animation1"
  1177. Animation69.Parent = StringValue68
  1178. Animation69.AnimationId = "http://www.roblox.com/asset/?id=616158929"
  1179. NumberValue70.Name = "Weight"
  1180. NumberValue70.Parent = Animation69
  1181. NumberValue70.Value = 9
  1182. Animation71.Name = "Animation2"
  1183. Animation71.Parent = StringValue68
  1184. Animation71.AnimationId = "http://www.roblox.com/asset/?id=616160636"
  1185. NumberValue72.Name = "Weight"
  1186. NumberValue72.Parent = Animation71
  1187. NumberValue72.Value = 1
  1188. StringValue73.Name = "jump"
  1189. StringValue73.Parent = Script62
  1190. Animation74.Name = "JumpAnim"
  1191. Animation74.Parent = StringValue73
  1192. Animation74.AnimationId = "http://www.roblox.com/asset/?id=616161997"
  1193. StringValue75.Name = "sit"
  1194. StringValue75.Parent = Script62
  1195. Animation76.Name = "SitAnim"
  1196. Animation76.Parent = StringValue75
  1197. Animation76.AnimationId = "http://www.roblox.com/asset/?id=507768133"
  1198. StringValue77.Name = "swim"
  1199. StringValue77.Parent = Script62
  1200. Animation78.Name = "Swim"
  1201. Animation78.Parent = StringValue77
  1202. Animation78.AnimationId = "http://www.roblox.com/asset/?id=616165109"
  1203. StringValue79.Name = "swimidle"
  1204. StringValue79.Parent = Script62
  1205. Animation80.Name = "SwimIdle"
  1206. Animation80.Parent = StringValue79
  1207. Animation80.AnimationId = "http://www.roblox.com/asset/?id=616166655"
  1208. StringValue81.Name = "toolnone"
  1209. StringValue81.Parent = Script62
  1210. Animation82.Name = "ToolNoneAnim"
  1211. Animation82.Parent = StringValue81
  1212. Animation82.AnimationId = "http://www.roblox.com/asset/?id=507768375"
  1213. StringValue83.Name = "walk"
  1214. StringValue83.Parent = Script62
  1215. Animation84.Name = "RunAnim"
  1216. Animation84.Parent = StringValue83
  1217. Animation84.AnimationId = "http://www.roblox.com/asset/?id=616168032"
  1218. Script85.Name = "SoundScript"
  1219. Script85.Parent = Model0
  1220. table.insert(cors,sandbox(Script85,function()
  1221. local moan = script.Parent.Head.Moan
  1222. local moan2 = script.parent.Head.Moan2
  1223. local moan3 = script.parent.Head.Moan3
  1224. local moan4 = script.Parent.Head.Moan4
  1225.  
  1226. while true do
  1227.     moan:Play()
  1228.     wait(8)
  1229.    
  1230.     moan2:Play()
  1231.     wait(5)
  1232.    
  1233.     moan3:Play()
  1234.     wait(7)
  1235.    
  1236.     moan4:Play()
  1237.     wait(6)
  1238. end
  1239.  
  1240.  
  1241. local death = script.Parent.Head.Death
  1242.  
  1243.  
  1244. end))
  1245. for i,v in pairs(mas:GetChildren()) do
  1246.     v.Parent = workspace
  1247.     pcall(function() v:MakeJoints() end)
  1248. end
  1249. mas:Destroy()
  1250. for i,v in pairs(cors) do
  1251.     spawn(function()
  1252.         pcall(v)
  1253.     end)
  1254. end
  1255. end
  1256.  
  1257. for i = 1,5 do
  1258. createZombie()
  1259. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement