Advertisement
Mediakiller7Cool

tye87

Apr 7th, 2020
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 55.92 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. local chil = workspace:GetChildren()
  19. for i,v in pairs(chil) do
  20. if not (v==script or v:IsA("Camera") or v:IsA("Terrain") or game:GetService("Players"):GetPlayerFromCharacter(v)~=nil) then
  21. v:Destroy()
  22. end
  23. end
  24. Camera0 = Instance.new("Camera")
  25. Part1 = Instance.new("Part")
  26. Model2 = Instance.new("Model")
  27. Part3 = Instance.new("Part")
  28. Motor6D4 = Instance.new("Motor6D")
  29. BodyForce5 = Instance.new("BodyForce")
  30. Part6 = Instance.new("Part")
  31. Motor6D7 = Instance.new("Motor6D")
  32. Motor6D8 = Instance.new("Motor6D")
  33. Motor6D9 = Instance.new("Motor6D")
  34. Motor6D10 = Instance.new("Motor6D")
  35. Motor6D11 = Instance.new("Motor6D")
  36. Part12 = Instance.new("Part")
  37. Part13 = Instance.new("Part")
  38. Part14 = Instance.new("Part")
  39. Part15 = Instance.new("Part")
  40. Part16 = Instance.new("Part")
  41. Decal17 = Instance.new("Decal")
  42. SpecialMesh18 = Instance.new("SpecialMesh")
  43. Humanoid19 = Instance.new("Humanoid")
  44. Script20 = Instance.new("Script")
  45. StringValue21 = Instance.new("StringValue")
  46. Animation22 = Instance.new("Animation")
  47. StringValue23 = Instance.new("StringValue")
  48. Animation24 = Instance.new("Animation")
  49. StringValue25 = Instance.new("StringValue")
  50. Animation26 = Instance.new("Animation")
  51. NumberValue27 = Instance.new("NumberValue")
  52. Animation28 = Instance.new("Animation")
  53. NumberValue29 = Instance.new("NumberValue")
  54. StringValue30 = Instance.new("StringValue")
  55. Animation31 = Instance.new("Animation")
  56. StringValue32 = Instance.new("StringValue")
  57. Animation33 = Instance.new("Animation")
  58. StringValue34 = Instance.new("StringValue")
  59. Animation35 = Instance.new("Animation")
  60. StringValue36 = Instance.new("StringValue")
  61. Animation37 = Instance.new("Animation")
  62. Script38 = Instance.new("Script")
  63. BillboardGui39 = Instance.new("BillboardGui")
  64. TextLabel40 = Instance.new("TextLabel")
  65. Configuration41 = Instance.new("Configuration")
  66. ModuleScript42 = Instance.new("ModuleScript")
  67. ModuleScript43 = Instance.new("ModuleScript")
  68. ModuleScript44 = Instance.new("ModuleScript")
  69. ModuleScript45 = Instance.new("ModuleScript")
  70. ModuleScript46 = Instance.new("ModuleScript")
  71. ModuleScript47 = Instance.new("ModuleScript")
  72. Configuration48 = Instance.new("Configuration")
  73. IntValue49 = Instance.new("IntValue")
  74. BoolValue50 = Instance.new("BoolValue")
  75. IntValue51 = Instance.new("IntValue")
  76. IntValue52 = Instance.new("IntValue")
  77. Configuration53 = Instance.new("Configuration")
  78. Animation54 = Instance.new("Animation")
  79. Animation55 = Instance.new("Animation")
  80. CharacterMesh56 = Instance.new("CharacterMesh")
  81. CharacterMesh57 = Instance.new("CharacterMesh")
  82. CharacterMesh58 = Instance.new("CharacterMesh")
  83. CharacterMesh59 = Instance.new("CharacterMesh")
  84. CharacterMesh60 = Instance.new("CharacterMesh")
  85. Sound61 = Instance.new("Sound")
  86. BodyColors62 = Instance.new("BodyColors")
  87. Camera0.Parent = mas
  88. Camera0.CFrame = CFrame.new(-2.55000973, 23.0239334, 26.12076, 0.849672437, 0.416282952, -0.323674947, 1.4901163e-08, 0.613821745, 0.789444745, 0.527311087, -0.670769453, 0.521547318)
  89. Camera0.CoordinateFrame = CFrame.new(-2.55000973, 23.0239334, 26.12076, 0.849672437, 0.416282952, -0.323674947, 1.4901163e-08, 0.613821745, 0.789444745, 0.527311087, -0.670769453, 0.521547318)
  90. Camera0.Focus = CFrame.new(-0.032825999, 16.88451, 22.0647449, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  91. Camera0.focus = CFrame.new(-0.032825999, 16.88451, 22.0647449, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  92. Part1.Name = "Baseplate"
  93. Part1.Parent = mas
  94. Part1.CFrame = CFrame.new(0, -10, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  95. Part1.Position = Vector3.new(0, -10, 0)
  96. Part1.Color = Color3.new(0.388235, 0.372549, 0.384314)
  97. Part1.Size = Vector3.new(512, 20, 512)
  98. Part1.Anchored = true
  99. Part1.BrickColor = BrickColor.new("Dark stone grey")
  100. Part1.Locked = true
  101. Part1.brickColor = BrickColor.new("Dark stone grey")
  102. Part1.FormFactor = Enum.FormFactor.Symmetric
  103. Part1.formFactor = Enum.FormFactor.Symmetric
  104. Model2.Name = "Drooling Zombie"
  105. Model2.Parent = mas
  106. Part3.Name = "HumanoidRootPart"
  107. Part3.Parent = Model2
  108. Part3.CFrame = CFrame.new(5.9671731, 3.00000715, 18.0647335, -1, -2.12045811e-27, 0, -2.12045811e-27, 1, -1.51463335e-27, 0, -1.51463335e-27, -1)
  109. Part3.Orientation = Vector3.new(0, 180, 0)
  110. Part3.Position = Vector3.new(5.9671731, 3.00000715, 18.0647335)
  111. Part3.Rotation = Vector3.new(180, 0, 180)
  112. Part3.Color = Color3.new(0.152941, 0.27451, 0.176471)
  113. Part3.Transparency = 1
  114. Part3.Size = Vector3.new(2, 2, 1)
  115. Part3.BottomSurface = Enum.SurfaceType.Smooth
  116. Part3.BrickColor = BrickColor.new("Earth green")
  117. Part3.Material = Enum.Material.WoodPlanks
  118. Part3.TopSurface = Enum.SurfaceType.Smooth
  119. Part3.brickColor = BrickColor.new("Earth green")
  120. Part3.FormFactor = Enum.FormFactor.Symmetric
  121. Part3.formFactor = Enum.FormFactor.Symmetric
  122. Motor6D4.Name = "Root Hip"
  123. Motor6D4.Parent = Part3
  124. Motor6D4.MaxVelocity = 0.10000000149012
  125. Motor6D4.C0 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
  126. Motor6D4.C1 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
  127. Motor6D4.Part0 = Part3
  128. Motor6D4.Part1 = Part6
  129. Motor6D4.part1 = Part6
  130. BodyForce5.Name = "RepulsionForce"
  131. BodyForce5.Parent = Part3
  132. BodyForce5.Force = Vector3.new(0, 0, 0)
  133. BodyForce5.force = Vector3.new(0, 0, 0)
  134. Part6.Name = "Torso"
  135. Part6.Parent = Model2
  136. Part6.CFrame = CFrame.new(5.9671731, 3.00000715, 18.0647335, -1, -2.12045811e-27, 0, -2.12045811e-27, 1, -1.51463335e-27, 0, -1.51463335e-27, -1)
  137. Part6.Orientation = Vector3.new(0, 180, 0)
  138. Part6.Position = Vector3.new(5.9671731, 3.00000715, 18.0647335)
  139. Part6.Rotation = Vector3.new(180, 0, 180)
  140. Part6.Color = Color3.new(0.152941, 0.27451, 0.176471)
  141. Part6.Size = Vector3.new(2, 2, 1)
  142. Part6.BottomSurface = Enum.SurfaceType.Smooth
  143. Part6.BrickColor = BrickColor.new("Earth green")
  144. Part6.Material = Enum.Material.WoodPlanks
  145. Part6.TopSurface = Enum.SurfaceType.Smooth
  146. Part6.brickColor = BrickColor.new("Earth green")
  147. Part6.FormFactor = Enum.FormFactor.Symmetric
  148. Part6.formFactor = Enum.FormFactor.Symmetric
  149. Motor6D7.Name = "Left Hip"
  150. Motor6D7.Parent = Part6
  151. Motor6D7.MaxVelocity = 0.10000000149012
  152. Motor6D7.C0 = CFrame.new(-1, -1, 0, -4.37113883e-08, 0, -1, 0, 0.99999994, 0, 1, 0, -4.37113883e-08)
  153. Motor6D7.C1 = CFrame.new(-0.5, 1, 0, -4.37113883e-08, 0, -1, 0, 0.99999994, 0, 1, 0, -4.37113883e-08)
  154. Motor6D7.Part0 = Part6
  155. Motor6D7.Part1 = Part12
  156. Motor6D7.part1 = Part12
  157. Motor6D8.Name = "Right Hip"
  158. Motor6D8.Parent = Part6
  159. Motor6D8.MaxVelocity = 0.10000000149012
  160. Motor6D8.C0 = CFrame.new(1, -1, 0, -4.37113883e-08, 0, 1, -0, 0.99999994, 0, -1, 0, -4.37113883e-08)
  161. Motor6D8.C1 = CFrame.new(0.5, 1, 0, -4.37113883e-08, 0, 1, 0, 0.99999994, 0, -1, 0, -4.37113883e-08)
  162. Motor6D8.Part0 = Part6
  163. Motor6D8.Part1 = Part13
  164. Motor6D8.part1 = Part13
  165. Motor6D9.Name = "Left Shoulder"
  166. Motor6D9.Parent = Part6
  167. Motor6D9.MaxVelocity = 0.10000000149012
  168. Motor6D9.C0 = CFrame.new(-1, 0.5, 0, -4.37113883e-08, 0, -1, 0, 0.99999994, 0, 1, 0, -4.37113883e-08)
  169. Motor6D9.C1 = CFrame.new(0.5, 0.5, 0, -4.37113883e-08, 0, -1, 0, 0.99999994, 0, 1, 0, -4.37113883e-08)
  170. Motor6D9.Part0 = Part6
  171. Motor6D9.Part1 = Part14
  172. Motor6D9.part1 = Part14
  173. Motor6D10.Name = "Right Shoulder"
  174. Motor6D10.Parent = Part6
  175. Motor6D10.MaxVelocity = 0.10000000149012
  176. Motor6D10.C0 = CFrame.new(1, 0.5, 0, -4.37113883e-08, 0, 1, -0, 0.99999994, 0, -1, 0, -4.37113883e-08)
  177. Motor6D10.C1 = CFrame.new(-0.5, 0.5, 0, -4.37113883e-08, 0, 1, 0, 0.99999994, 0, -1, 0, -4.37113883e-08)
  178. Motor6D10.Part0 = Part6
  179. Motor6D10.Part1 = Part15
  180. Motor6D10.part1 = Part15
  181. Motor6D11.Name = "Neck"
  182. Motor6D11.Parent = Part6
  183. Motor6D11.MaxVelocity = 0.10000000149012
  184. Motor6D11.C0 = CFrame.new(0, 1, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
  185. Motor6D11.C1 = CFrame.new(0, -0.5, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
  186. Motor6D11.Part0 = Part6
  187. Motor6D11.Part1 = Part16
  188. Motor6D11.part1 = Part16
  189. Part12.Name = "Left Leg"
  190. Part12.Parent = Model2
  191. Part12.CFrame = CFrame.new(6.4671731, 1.00000727, 18.0647335, -1, -2.12045792e-27, 0, -2.12045811e-27, 0.999999881, -1.51463335e-27, 0, -1.51463316e-27, -1)
  192. Part12.Orientation = Vector3.new(0, 180, 0)
  193. Part12.Position = Vector3.new(6.4671731, 1.00000727, 18.0647335)
  194. Part12.Rotation = Vector3.new(180, 0, 180)
  195. Part12.Color = Color3.new(0.152941, 0.27451, 0.176471)
  196. Part12.Size = Vector3.new(1, 2, 1)
  197. Part12.BottomSurface = Enum.SurfaceType.Smooth
  198. Part12.BrickColor = BrickColor.new("Earth green")
  199. Part12.CanCollide = false
  200. Part12.Material = Enum.Material.WoodPlanks
  201. Part12.TopSurface = Enum.SurfaceType.Smooth
  202. Part12.brickColor = BrickColor.new("Earth green")
  203. Part12.FormFactor = Enum.FormFactor.Symmetric
  204. Part12.formFactor = Enum.FormFactor.Symmetric
  205. Part13.Name = "Right Leg"
  206. Part13.Parent = Model2
  207. Part13.CFrame = CFrame.new(5.4671731, 1.00000727, 18.0647335, -1, -2.12045792e-27, 0, -2.12045811e-27, 0.999999881, -1.51463335e-27, 0, -1.51463316e-27, -1)
  208. Part13.Orientation = Vector3.new(0, 180, 0)
  209. Part13.Position = Vector3.new(5.4671731, 1.00000727, 18.0647335)
  210. Part13.Rotation = Vector3.new(180, 0, 180)
  211. Part13.Color = Color3.new(0.152941, 0.27451, 0.176471)
  212. Part13.Size = Vector3.new(1, 2, 1)
  213. Part13.BottomSurface = Enum.SurfaceType.Smooth
  214. Part13.BrickColor = BrickColor.new("Earth green")
  215. Part13.CanCollide = false
  216. Part13.Material = Enum.Material.WoodPlanks
  217. Part13.TopSurface = Enum.SurfaceType.Smooth
  218. Part13.brickColor = BrickColor.new("Earth green")
  219. Part13.FormFactor = Enum.FormFactor.Symmetric
  220. Part13.formFactor = Enum.FormFactor.Symmetric
  221. Part14.Name = "Left Arm"
  222. Part14.Parent = Model2
  223. Part14.CFrame = CFrame.new(7.4671731, 3.00000715, 18.0647335, -1, -2.12045792e-27, 0, -2.12045811e-27, 0.999999881, -1.51463335e-27, 0, -1.51463316e-27, -1)
  224. Part14.Orientation = Vector3.new(0, 180, 0)
  225. Part14.Position = Vector3.new(7.4671731, 3.00000715, 18.0647335)
  226. Part14.Rotation = Vector3.new(180, 0, 180)
  227. Part14.Color = Color3.new(0.152941, 0.27451, 0.176471)
  228. Part14.Size = Vector3.new(1, 2, 1)
  229. Part14.BottomSurface = Enum.SurfaceType.Smooth
  230. Part14.BrickColor = BrickColor.new("Earth green")
  231. Part14.CanCollide = false
  232. Part14.Material = Enum.Material.WoodPlanks
  233. Part14.TopSurface = Enum.SurfaceType.Smooth
  234. Part14.brickColor = BrickColor.new("Earth green")
  235. Part14.FormFactor = Enum.FormFactor.Symmetric
  236. Part14.formFactor = Enum.FormFactor.Symmetric
  237. Part15.Name = "Right Arm"
  238. Part15.Parent = Model2
  239. Part15.CFrame = CFrame.new(4.4671731, 3.00000715, 18.0647335, -1, -2.12045792e-27, 0, -2.12045811e-27, 0.999999881, -1.51463335e-27, 0, -1.51463316e-27, -1)
  240. Part15.Orientation = Vector3.new(0, 180, 0)
  241. Part15.Position = Vector3.new(4.4671731, 3.00000715, 18.0647335)
  242. Part15.Rotation = Vector3.new(180, 0, 180)
  243. Part15.Color = Color3.new(0.152941, 0.27451, 0.176471)
  244. Part15.Size = Vector3.new(1, 2, 1)
  245. Part15.BottomSurface = Enum.SurfaceType.Smooth
  246. Part15.BrickColor = BrickColor.new("Earth green")
  247. Part15.CanCollide = false
  248. Part15.Material = Enum.Material.WoodPlanks
  249. Part15.TopSurface = Enum.SurfaceType.Smooth
  250. Part15.brickColor = BrickColor.new("Earth green")
  251. Part15.FormFactor = Enum.FormFactor.Symmetric
  252. Part15.formFactor = Enum.FormFactor.Symmetric
  253. Part16.Name = "Head"
  254. Part16.Parent = Model2
  255. Part16.CFrame = CFrame.new(5.9671731, 4.50000715, 18.0647335, -1, -2.12045811e-27, 0, -2.12045811e-27, 1, -1.51463335e-27, 0, -1.51463335e-27, -1)
  256. Part16.Orientation = Vector3.new(0, 180, 0)
  257. Part16.Position = Vector3.new(5.9671731, 4.50000715, 18.0647335)
  258. Part16.Rotation = Vector3.new(180, 0, 180)
  259. Part16.Color = Color3.new(0.227451, 0.490196, 0.0823529)
  260. Part16.Size = Vector3.new(2, 1, 1)
  261. Part16.BottomSurface = Enum.SurfaceType.Smooth
  262. Part16.BrickColor = BrickColor.new("Camo")
  263. Part16.Material = Enum.Material.WoodPlanks
  264. Part16.TopSurface = Enum.SurfaceType.Smooth
  265. Part16.brickColor = BrickColor.new("Camo")
  266. Part16.FormFactor = Enum.FormFactor.Symmetric
  267. Part16.formFactor = Enum.FormFactor.Symmetric
  268. Decal17.Name = "Face"
  269. Decal17.Parent = Part16
  270. Decal17.Texture = "http://www.roblox.com/asset/?id=7074882"
  271. SpecialMesh18.Parent = Part16
  272. SpecialMesh18.Scale = Vector3.new(1.25, 1.25, 1.25)
  273. Humanoid19.Parent = Model2
  274. Humanoid19.LeftLeg = Part12
  275. Humanoid19.RightLeg = Part13
  276. Humanoid19.Torso = Part3
  277. Humanoid19.WalkSpeed = 10
  278. Script20.Name = "Animate"
  279. Script20.Parent = Model2
  280. table.insert(cors,sandbox(Script20,function()
  281. function waitForChild(parent, childName)
  282. local child = parent:findFirstChild(childName)
  283. if child then return child end
  284. while true do
  285. child = parent.ChildAdded:wait()
  286. if child.Name==childName then return child end
  287. end
  288. end
  289.  
  290. local Figure = script.Parent
  291. local Torso = waitForChild(Figure, "Torso")
  292. local RightShoulder = waitForChild(Torso, "Right Shoulder")
  293. local LeftShoulder = waitForChild(Torso, "Left Shoulder")
  294. local RightHip = waitForChild(Torso, "Right Hip")
  295. local LeftHip = waitForChild(Torso, "Left Hip")
  296. local Neck = waitForChild(Torso, "Neck")
  297. local Humanoid = waitForChild(Figure, "Humanoid")
  298. local pose = "Standing"
  299.  
  300. local currentAnim = ""
  301. local currentAnimTrack = nil
  302. local currentAnimKeyframeHandler = nil
  303. local currentAnimSpeed = 1.0
  304. local animTable = {}
  305. local animNames = {
  306. idle = {
  307. { id = "http://www.roblox.com/asset/?id=125750544", weight = 9 },
  308. { id = "http://www.roblox.com/asset/?id=125750618", weight = 1 }
  309. },
  310. walk = {
  311. { id = "http://www.roblox.com/asset/?id=125749145", weight = 10 }
  312. },
  313. run = {
  314. { id = "run.xml", weight = 10 }
  315. },
  316. jump = {
  317. { id = "http://www.roblox.com/asset/?id=125750702", weight = 10 }
  318. },
  319. fall = {
  320. { id = "http://www.roblox.com/asset/?id=125750759", weight = 10 }
  321. },
  322. climb = {
  323. { id = "http://www.roblox.com/asset/?id=125750800", weight = 10 }
  324. },
  325. toolnone = {
  326. { id = "http://www.roblox.com/asset/?id=125750867", weight = 10 }
  327. },
  328. toolslash = {
  329. { id = "http://www.roblox.com/asset/?id=129967390", weight = 10 }
  330. -- { id = "slash.xml", weight = 10 }
  331. },
  332. toollunge = {
  333. { id = "http://www.roblox.com/asset/?id=129967478", weight = 10 }
  334. },
  335. wave = {
  336. { id = "http://www.roblox.com/asset/?id=128777973", weight = 10 }
  337. },
  338. point = {
  339. { id = "http://www.roblox.com/asset/?id=128853357", weight = 10 }
  340. },
  341. dance = {
  342. { id = "http://www.roblox.com/asset/?id=130018893", weight = 10 },
  343. { id = "http://www.roblox.com/asset/?id=132546839", weight = 10 },
  344. { id = "http://www.roblox.com/asset/?id=132546884", weight = 10 }
  345. },
  346. dance2 = {
  347. { id = "http://www.roblox.com/asset/?id=160934142", weight = 10 },
  348. { id = "http://www.roblox.com/asset/?id=160934298", weight = 10 },
  349. { id = "http://www.roblox.com/asset/?id=160934376", weight = 10 }
  350. },
  351. dance3 = {
  352. { id = "http://www.roblox.com/asset/?id=160934458", weight = 10 },
  353. { id = "http://www.roblox.com/asset/?id=160934530", weight = 10 },
  354. { id = "http://www.roblox.com/asset/?id=160934593", weight = 10 }
  355. },
  356. laugh = {
  357. { id = "http://www.roblox.com/asset/?id=129423131", weight = 10 }
  358. },
  359. cheer = {
  360. { id = "http://www.roblox.com/asset/?id=129423030", weight = 10 }
  361. },
  362. }
  363.  
  364. -- Existance in this list signifies that it is an emote, the value indicates if it is a looping emote
  365. local emoteNames = { wave = false, point = false, dance = true, dance2 = true, dance3 = true, laugh = false, cheer = false}
  366.  
  367. math.randomseed(tick())
  368.  
  369. function configureAnimationSet(name, fileList)
  370. if (animTable[name] ~= nil) then
  371. for _, connection in pairs(animTable[name].connections) do
  372. connection:disconnect()
  373. end
  374. end
  375. animTable[name] = {}
  376. animTable[name].count = 0
  377. animTable[name].totalWeight = 0
  378. animTable[name].connections = {}
  379.  
  380. -- check for config values
  381. local config = script:FindFirstChild(name)
  382. if (config ~= nil) then
  383. -- print("Loading anims " .. name)
  384. table.insert(animTable[name].connections, config.ChildAdded:connect(function(child) configureAnimationSet(name, fileList) end))
  385. table.insert(animTable[name].connections, config.ChildRemoved:connect(function(child) configureAnimationSet(name, fileList) end))
  386. local idx = 1
  387. for _, childPart in pairs(config:GetChildren()) do
  388. if (childPart:IsA("Animation")) then
  389. table.insert(animTable[name].connections, childPart.Changed:connect(function(property) configureAnimationSet(name, fileList) end))
  390. animTable[name][idx] = {}
  391. animTable[name][idx].anim = childPart
  392. local weightObject = childPart:FindFirstChild("Weight")
  393. if (weightObject == nil) then
  394. animTable[name][idx].weight = 1
  395. else
  396. animTable[name][idx].weight = weightObject.Value
  397. end
  398. animTable[name].count = animTable[name].count + 1
  399. animTable[name].totalWeight = animTable[name].totalWeight + animTable[name][idx].weight
  400. -- print(name .. " [" .. idx .. "] " .. animTable[name][idx].anim.AnimationId .. " (" .. animTable[name][idx].weight .. ")")
  401. idx = idx + 1
  402. end
  403. end
  404. end
  405.  
  406. -- fallback to defaults
  407. if (animTable[name].count <= 0) then
  408. for idx, anim in pairs(fileList) do
  409. animTable[name][idx] = {}
  410. animTable[name][idx].anim = Instance.new("Animation")
  411. animTable[name][idx].anim.Name = name
  412. animTable[name][idx].anim.AnimationId = anim.id
  413. animTable[name][idx].weight = anim.weight
  414. animTable[name].count = animTable[name].count + 1
  415. animTable[name].totalWeight = animTable[name].totalWeight + anim.weight
  416. -- print(name .. " [" .. idx .. "] " .. anim.id .. " (" .. anim.weight .. ")")
  417. end
  418. end
  419. end
  420.  
  421. -- Setup animation objects
  422. function scriptChildModified(child)
  423. local fileList = animNames[child.Name]
  424. if (fileList ~= nil) then
  425. configureAnimationSet(child.Name, fileList)
  426. end
  427. end
  428.  
  429. script.ChildAdded:connect(scriptChildModified)
  430. script.ChildRemoved:connect(scriptChildModified)
  431.  
  432.  
  433. for name, fileList in pairs(animNames) do
  434. configureAnimationSet(name, fileList)
  435. end
  436.  
  437. -- ANIMATION
  438.  
  439. -- declarations
  440. local toolAnim = "None"
  441. local toolAnimTime = 0
  442.  
  443. local jumpAnimTime = 0
  444. local jumpAnimDuration = 0.3
  445.  
  446. local toolTransitionTime = 0.1
  447. local fallTransitionTime = 0.3
  448. local jumpMaxLimbVelocity = 0.75
  449.  
  450. -- functions
  451.  
  452. function stopAllAnimations()
  453. local oldAnim = currentAnim
  454.  
  455. -- return to idle if finishing an emote
  456. if (emoteNames[oldAnim] ~= nil and emoteNames[oldAnim] == false) then
  457. oldAnim = "idle"
  458. end
  459.  
  460. currentAnim = ""
  461. if (currentAnimKeyframeHandler ~= nil) then
  462. currentAnimKeyframeHandler:disconnect()
  463. end
  464.  
  465. if (currentAnimTrack ~= nil) then
  466. currentAnimTrack:Stop()
  467. currentAnimTrack:Destroy()
  468. currentAnimTrack = nil
  469. end
  470. return oldAnim
  471. end
  472.  
  473. function setAnimationSpeed(speed)
  474. if speed ~= currentAnimSpeed then
  475. currentAnimSpeed = speed
  476. currentAnimTrack:AdjustSpeed(currentAnimSpeed)
  477. end
  478. end
  479.  
  480. function keyFrameReachedFunc(frameName)
  481. if (frameName == "End") then
  482. -- print("Keyframe : ".. frameName)
  483. local repeatAnim = stopAllAnimations()
  484. local animSpeed = currentAnimSpeed
  485. playAnimation(repeatAnim, 0.0, Humanoid)
  486. setAnimationSpeed(animSpeed)
  487. end
  488. end
  489.  
  490. -- Preload animations
  491. function playAnimation(animName, transitionTime, humanoid)
  492. local idleFromEmote = (animName == "idle" and emoteNames[currentAnim] ~= nil)
  493. if (animName ~= currentAnim and not idleFromEmote) then
  494.  
  495. if (currentAnimTrack ~= nil) then
  496. currentAnimTrack:Stop(transitionTime)
  497. currentAnimTrack:Destroy()
  498. end
  499.  
  500. currentAnimSpeed = 1.0
  501. local roll = math.random(1, animTable[animName].totalWeight)
  502. local origRoll = roll
  503. local idx = 1
  504. while (roll > animTable[animName][idx].weight) do
  505. roll = roll - animTable[animName][idx].weight
  506. idx = idx + 1
  507. end
  508. -- print(animName .. " " .. idx .. " [" .. origRoll .. "]")
  509. local anim = animTable[animName][idx].anim
  510.  
  511. -- load it to the humanoid; get AnimationTrack
  512. currentAnimTrack = humanoid:LoadAnimation(anim)
  513.  
  514. -- play the animation
  515. currentAnimTrack:Play(transitionTime)
  516. currentAnim = animName
  517.  
  518. -- set up keyframe name triggers
  519. if (currentAnimKeyframeHandler ~= nil) then
  520. currentAnimKeyframeHandler:disconnect()
  521. end
  522. currentAnimKeyframeHandler = currentAnimTrack.KeyframeReached:connect(keyFrameReachedFunc)
  523. end
  524. end
  525.  
  526. -------------------------------------------------------------------------------------------
  527. -------------------------------------------------------------------------------------------
  528.  
  529. local toolAnimName = ""
  530. local toolAnimTrack = nil
  531. local currentToolAnimKeyframeHandler = nil
  532.  
  533. function toolKeyFrameReachedFunc(frameName)
  534. if (frameName == "End") then
  535. -- print("Keyframe : ".. frameName)
  536. local repeatAnim = stopToolAnimations()
  537. playToolAnimation(repeatAnim, 0.0, Humanoid)
  538. end
  539. end
  540.  
  541.  
  542. function playToolAnimation(animName, transitionTime, humanoid)
  543. if (animName ~= toolAnimName) then
  544.  
  545. if (toolAnimTrack ~= nil) then
  546. toolAnimTrack:Stop()
  547. toolAnimTrack:Destroy()
  548. transitionTime = 0
  549. end
  550.  
  551. local roll = math.random(1, animTable[animName].totalWeight)
  552. local origRoll = roll
  553. local idx = 1
  554. while (roll > animTable[animName][idx].weight) do
  555. roll = roll - animTable[animName][idx].weight
  556. idx = idx + 1
  557. end
  558. -- print(animName .. " * " .. idx .. " [" .. origRoll .. "]")
  559. local anim = animTable[animName][idx].anim
  560.  
  561. -- load it to the humanoid; get AnimationTrack
  562. toolAnimTrack = humanoid:LoadAnimation(anim)
  563.  
  564. -- play the animation
  565. toolAnimTrack:Play(transitionTime)
  566. toolAnimName = animName
  567.  
  568. currentToolAnimKeyframeHandler = toolAnimTrack.KeyframeReached:connect(toolKeyFrameReachedFunc)
  569. end
  570. end
  571.  
  572. function stopToolAnimations()
  573. local oldAnim = toolAnimName
  574.  
  575. if (currentToolAnimKeyframeHandler ~= nil) then
  576. currentToolAnimKeyframeHandler:disconnect()
  577. end
  578.  
  579. toolAnimName = ""
  580. if (toolAnimTrack ~= nil) then
  581. toolAnimTrack:Stop()
  582. toolAnimTrack:Destroy()
  583. toolAnimTrack = nil
  584. end
  585.  
  586.  
  587. return oldAnim
  588. end
  589.  
  590. -------------------------------------------------------------------------------------------
  591. -------------------------------------------------------------------------------------------
  592.  
  593.  
  594. function onRunning(speed)
  595. if speed>0.01 then
  596. playAnimation("walk", 0.1, Humanoid)
  597. pose = "Running"
  598. else
  599. playAnimation("idle", 0.1, Humanoid)
  600. pose = "Standing"
  601. end
  602. end
  603.  
  604. function onDied()
  605. pose = "Dead"
  606. end
  607.  
  608. function onJumping()
  609. playAnimation("jump", 0.1, Humanoid)
  610. jumpAnimTime = jumpAnimDuration
  611. pose = "Jumping"
  612. end
  613.  
  614. function onClimbing(speed)
  615. playAnimation("climb", 0.1, Humanoid)
  616. setAnimationSpeed(speed / 12.0)
  617. pose = "Climbing"
  618. end
  619.  
  620. function onGettingUp()
  621. pose = "GettingUp"
  622. end
  623.  
  624. function onFreeFall()
  625. if (jumpAnimTime <= 0) then
  626. playAnimation("fall", fallTransitionTime, Humanoid)
  627. end
  628. pose = "FreeFall"
  629. end
  630.  
  631. function onFallingDown()
  632. pose = "FallingDown"
  633. end
  634.  
  635. function onSeated()
  636. pose = "Seated"
  637. end
  638.  
  639. function onPlatformStanding()
  640. pose = "PlatformStanding"
  641. end
  642.  
  643. function onSwimming(speed)
  644. if speed>0 then
  645. pose = "Running"
  646. else
  647. pose = "Standing"
  648. end
  649. end
  650.  
  651. function getTool()
  652. for _, kid in ipairs(Figure:GetChildren()) do
  653. if kid.className == "Tool" then return kid end
  654. end
  655. return nil
  656. end
  657.  
  658. function getToolAnim(tool)
  659. for _, c in ipairs(tool:GetChildren()) do
  660. if c.Name == "toolanim" and c.className == "StringValue" then
  661. return c
  662. end
  663. end
  664. return nil
  665. end
  666.  
  667. function animateTool()
  668.  
  669. if (toolAnim == "None") then
  670. playToolAnimation("toolnone", toolTransitionTime, Humanoid)
  671. return
  672. end
  673.  
  674. if (toolAnim == "Slash") then
  675. playToolAnimation("toolslash", 0, Humanoid)
  676. return
  677. end
  678.  
  679. if (toolAnim == "Lunge") then
  680. playToolAnimation("toollunge", 0, Humanoid)
  681. return
  682. end
  683. end
  684.  
  685. function moveSit()
  686. RightShoulder.MaxVelocity = 0.15
  687. LeftShoulder.MaxVelocity = 0.15
  688. RightShoulder:SetDesiredAngle(3.14 /2)
  689. LeftShoulder:SetDesiredAngle(-3.14 /2)
  690. RightHip:SetDesiredAngle(3.14 /2)
  691. LeftHip:SetDesiredAngle(-3.14 /2)
  692. end
  693.  
  694. local lastTick = 0
  695.  
  696. function move(time)
  697. local amplitude = 1
  698. local frequency = 1
  699. local deltaTime = time - lastTick
  700. lastTick = time
  701.  
  702. local climbFudge = 0
  703. local setAngles = false
  704.  
  705. if (jumpAnimTime > 0) then
  706. jumpAnimTime = jumpAnimTime - deltaTime
  707. end
  708.  
  709. if (pose == "FreeFall" and jumpAnimTime <= 0) then
  710. playAnimation("fall", fallTransitionTime, Humanoid)
  711. elseif (pose == "Seated") then
  712. stopAllAnimations()
  713. moveSit()
  714. return
  715. elseif (pose == "Running") then
  716. playAnimation("walk", 0.1, Humanoid)
  717. elseif (pose == "Dead" or pose == "GettingUp" or pose == "FallingDown" or pose == "Seated" or pose == "PlatformStanding") then
  718. -- print("Wha " .. pose)
  719. amplitude = 0.1
  720. frequency = 1
  721. setAngles = true
  722. end
  723.  
  724. if (setAngles) then
  725. desiredAngle = amplitude * math.sin(time * frequency)
  726.  
  727. RightShoulder:SetDesiredAngle(desiredAngle + climbFudge)
  728. LeftShoulder:SetDesiredAngle(desiredAngle - climbFudge)
  729. RightHip:SetDesiredAngle(-desiredAngle)
  730. LeftHip:SetDesiredAngle(-desiredAngle)
  731. end
  732.  
  733. -- Tool Animation handling
  734. local tool = getTool()
  735. if tool then
  736.  
  737. animStringValueObject = getToolAnim(tool)
  738.  
  739. if animStringValueObject then
  740. toolAnim = animStringValueObject.Value
  741. -- message recieved, delete StringValue
  742. animStringValueObject.Parent = nil
  743. toolAnimTime = time + .3
  744. end
  745.  
  746. if time > toolAnimTime then
  747. toolAnimTime = 0
  748. toolAnim = "None"
  749. end
  750.  
  751. animateTool()
  752. else
  753. stopToolAnimations()
  754. toolAnim = "None"
  755. toolAnimTime = 0
  756. end
  757. end
  758.  
  759. -- connect events
  760. Humanoid.Died:connect(onDied)
  761. Humanoid.Running:connect(onRunning)
  762. Humanoid.Jumping:connect(onJumping)
  763. Humanoid.Climbing:connect(onClimbing)
  764. Humanoid.GettingUp:connect(onGettingUp)
  765. Humanoid.FreeFalling:connect(onFreeFall)
  766. Humanoid.FallingDown:connect(onFallingDown)
  767. Humanoid.Seated:connect(onSeated)
  768. Humanoid.PlatformStanding:connect(onPlatformStanding)
  769. Humanoid.Swimming:connect(onSwimming)
  770.  
  771. -- main program
  772.  
  773. local runService = game:service("RunService");
  774.  
  775. -- initialize to idle
  776. playAnimation("idle", 0.1, Humanoid)
  777. pose = "Standing"
  778.  
  779. while Figure.Parent~=nil do
  780. local _, time = wait(0.1)
  781. move(time)
  782. end
  783.  
  784.  
  785.  
  786. end))
  787. StringValue21.Name = "climb"
  788. StringValue21.Parent = Script20
  789. Animation22.Name = "ClimbAnim"
  790. Animation22.Parent = StringValue21
  791. Animation22.AnimationId = "http://www.roblox.com/asset/?id=125750800"
  792. StringValue23.Name = "fall"
  793. StringValue23.Parent = Script20
  794. Animation24.Name = "FallAnim"
  795. Animation24.Parent = StringValue23
  796. Animation24.AnimationId = "http://www.roblox.com/asset/?id=125750759"
  797. StringValue25.Name = "idle"
  798. StringValue25.Parent = Script20
  799. Animation26.Name = "Animation1"
  800. Animation26.Parent = StringValue25
  801. Animation26.AnimationId = "http://www.roblox.com/asset/?id=125750544"
  802. NumberValue27.Name = "Weight"
  803. NumberValue27.Parent = Animation26
  804. NumberValue27.Value = 9
  805. Animation28.Name = "Animation2"
  806. Animation28.Parent = StringValue25
  807. Animation28.AnimationId = "http://www.roblox.com/asset/?id=125750618"
  808. NumberValue29.Name = "Weight"
  809. NumberValue29.Parent = Animation28
  810. NumberValue29.Value = 1
  811. StringValue30.Name = "jump"
  812. StringValue30.Parent = Script20
  813. Animation31.Name = "JumpAnim"
  814. Animation31.Parent = StringValue30
  815. Animation31.AnimationId = "http://www.roblox.com/asset/?id=125750702"
  816. StringValue32.Name = "run"
  817. StringValue32.Parent = Script20
  818. Animation33.Name = "RunAnim"
  819. Animation33.Parent = StringValue32
  820. Animation33.AnimationId = "http://www.roblox.com/asset/?id=125749145"
  821. StringValue34.Name = "toolnone"
  822. StringValue34.Parent = Script20
  823. Animation35.Name = "ToolNoneAnim"
  824. Animation35.Parent = StringValue34
  825. Animation35.AnimationId = "http://www.roblox.com/asset/?id=125750867"
  826. StringValue36.Name = "walk"
  827. StringValue36.Parent = Script20
  828. Animation37.Name = "WalkAnim"
  829. Animation37.Parent = StringValue36
  830. Animation37.AnimationId = "http://www.roblox.com/asset/?id=125749145"
  831. Script38.Parent = Model2
  832. table.insert(cors,sandbox(Script38,function()
  833. local zombie = script.Parent
  834.  
  835. for _, script in pairs(zombie.ModuleScripts:GetChildren()) do
  836. if not game.ServerStorage:FindFirstChild(script.Name) then
  837. script:Clone().Parent = game.ServerStorage
  838. end
  839. end
  840.  
  841. local AI = require(game.ServerStorage.ROBLOX_ZombieAI).new(zombie)
  842. local DestroyService = require(game.ServerStorage.ROBLOX_DestroyService)
  843.  
  844.  
  845. local function clearParts(parent)
  846. for _, part in pairs(parent:GetChildren()) do
  847. clearParts(part)
  848. end
  849. local delay
  850. if parent:IsA("Part") then
  851. delay = math.random(5,10)
  852. else
  853. delay = 11
  854. end
  855. DestroyService:AddItem(parent, delay)
  856. end
  857.  
  858. zombie.Humanoid.Died:connect(function()
  859. AI.Stop()
  860. math.randomseed(tick())
  861. clearParts(zombie)
  862. script.Disabled = true
  863. end)
  864.  
  865. local lastMoan = os.time()
  866. math.randomseed(os.time())
  867. while true do
  868. local animationTrack = zombie.Humanoid:LoadAnimation(zombie.Animations.Arms)
  869. animationTrack:Play()
  870. -- local now = os.time()
  871. -- if now - lastMoan > 5 then
  872. -- if math.random() > .3 then
  873. -- zombie.Moan:Play()
  874. ---- print("playing moan")
  875. -- lastMoan = now
  876. -- end
  877. -- end
  878. wait(2)
  879. end
  880.  
  881.  
  882. end))
  883. BillboardGui39.Parent = Model2
  884. BillboardGui39.Size = UDim2.new(0, 100, 0, 30)
  885. BillboardGui39.StudsOffset = Vector3.new(0, 5, 0)
  886. TextLabel40.Parent = BillboardGui39
  887. TextLabel40.Visible = false
  888. TextLabel40.Size = UDim2.new(1, 0, 1, 0)
  889. TextLabel40.BackgroundColor = BrickColor.new("Institutional white")
  890. TextLabel40.BackgroundColor3 = Color3.new(1, 1, 1)
  891. TextLabel40.Font = Enum.Font.SourceSansBold
  892. TextLabel40.FontSize = Enum.FontSize.Size24
  893. TextLabel40.Text = "Idle"
  894. TextLabel40.TextSize = 24
  895. Configuration41.Name = "ModuleScripts"
  896. Configuration41.Parent = Model2
  897. ModuleScript42.Name = "ROBLOX_AIUtilities"
  898. ModuleScript42.Parent = Configuration41
  899. table.insert(cors,sandbox(ModuleScript42,function()
  900. local utility = {}
  901.  
  902. function utility:WideRayCast(start, target, offset, ignoreList)
  903. local parts = {}
  904.  
  905. local ray = Ray.new(start, target - start)
  906. local part, point = game.Workspace:FindPartOnRayWithIgnoreList(ray, ignoreList)
  907. if part then table.insert(parts, part) end
  908.  
  909. local offsetVector = offset * (target - start):Cross(Vector3.FromNormalId(Enum.NormalId.Top)).unit
  910. local ray = Ray.new(start + offsetVector, target - start + offsetVector)
  911. local part, point = game.Workspace:FindPartOnRayWithIgnoreList(ray, ignoreList)
  912. if part then table.insert(parts, part) end
  913.  
  914. local ray = Ray.new(start - offsetVector, target - start - offsetVector)
  915. local part, point = game.Workspace:FindPartOnRayWithIgnoreList(ray, ignoreList)
  916. if part then table.insert(parts, part) end
  917.  
  918. return parts
  919. end
  920.  
  921. function utility:FindNearestPathPoint(path, point, start, target, ignoreList)
  922. local occludePoint = path:CheckOcclusionAsync(point)
  923. if occludePoint > 0 then
  924. utility:WideRayCast(start)
  925. end
  926. end
  927.  
  928. local maxForce = 15
  929.  
  930. function utility:GetRepulsionVector(unitPosition, otherUnitsPositions)
  931. local repulsionVector = Vector3.new(0,0,0)
  932. local count = 0
  933. for _, other in pairs(otherUnitsPositions) do
  934. local fromOther = unitPosition - other
  935. --fromOther = fromOther.unit * ((-maxForce / 5) * math.pow(fromOther.magnitude,2) + maxForce)
  936. fromOther = fromOther.unit * 1000 / math.pow((fromOther.magnitude + 1), 2)
  937. repulsionVector = repulsionVector + fromOther
  938. end
  939. return repulsionVector * maxForce
  940. end
  941.  
  942. function utility:GetIdleState(StateMachine)
  943. local IdleState = StateMachine.NewState()
  944. IdleState.Name = "Idle"
  945. IdleState.Action = function() end
  946. IdleState.Init = function() end
  947. return IdleState
  948. end
  949.  
  950. function utility:GetClosestVisibleTarget(npcModel, characters, ignoreList, fieldOfView)
  951. local closestTarget = nil
  952. local closestDistance = math.huge
  953. for _, character in pairs(characters) do
  954. local toTarget = character.HumanoidRootPart.Position - npcModel.HumanoidRootPart.Position
  955. local toTargetWedge = toTarget * Vector3.new(1,0,1)
  956. local angle = math.acos(toTargetWedge:Dot(npcModel.HumanoidRootPart.CFrame.lookVector)/toTargetWedge.magnitude)
  957. if math.deg(angle) < fieldOfView then
  958. local targetRay = Ray.new(npcModel.HumanoidRootPart.Position, toTarget)
  959. local part, position = game.Workspace:FindPartOnRayWithIgnoreList(targetRay, ignoreList)
  960. if part and part.Parent == character then
  961. if toTarget.magnitude < closestDistance then
  962. closestTarget = character
  963. closestDistance = toTarget.magnitude
  964. end
  965. end
  966. end
  967. end
  968. return closestTarget
  969. end
  970.  
  971. local function isSpaceEmpty(position)
  972. local region = Region3.new(position - Vector3.new(2,2,2), position + Vector3.new(2,2,2))
  973. return game.Workspace:IsRegion3Empty(region)
  974. end
  975.  
  976. function utility:FindCloseEmptySpace(model)
  977. local targetPos = Vector3.new(0,0,0)
  978. local count = 0
  979. math.randomseed(os.time())
  980. repeat
  981. local xoff = math.random(5,10)
  982. if math.random() > .5 then
  983. xoff = xoff * -1
  984. end
  985. local zoff = math.random(5, 10)
  986. if math.random() > .5 then
  987. zoff = zoff * -1
  988. end
  989.  
  990. targetPos = Vector3.new(model.HumanoidRootPart.Position.X + xoff,model.HumanoidRootPart.Position.Y,model.HumanoidRootPart.Position.Z + zoff)
  991. if isSpaceEmpty(targetPos) then
  992. return targetPos
  993. else
  994. targetPos = targetPos + Vector3.new(0,4,0)
  995. end
  996.  
  997. if isSpaceEmpty(targetPos) then
  998. return targetPos
  999. end
  1000. count = count + 1
  1001. until count > 10
  1002. return nil
  1003. end
  1004.  
  1005. return utility
  1006. end))
  1007. ModuleScript43.Name = "ROBLOX_DestroyService"
  1008. ModuleScript43.Parent = Configuration41
  1009. table.insert(cors,sandbox(ModuleScript43,function()
  1010. local destroyService = {}
  1011.  
  1012. local destroyQueue = {}
  1013.  
  1014. function destroyService:AddItem(theobject, delay)
  1015. local now = os.time()
  1016. local destroyObject = {object = theobject, destroyTime = delay + now}
  1017. for i, storedObject in pairs(destroyQueue) do
  1018. if destroyQueue[i].destroyTime > destroyObject.destroyTime then
  1019. table.insert(destroyQueue, i, destroyObject)
  1020. return true
  1021. end
  1022. end
  1023. table.insert(destroyQueue, destroyObject)
  1024. return true
  1025. end
  1026.  
  1027. local updateThread = coroutine.create(function()
  1028. while true do
  1029. local now = os.time()
  1030. for _, storedObject in pairs(destroyQueue) do
  1031. if now >= storedObject.destroyTime then
  1032. table.remove(destroyQueue, 1)
  1033. if storedObject.object then
  1034. storedObject.object:Destroy()
  1035. end
  1036. elseif now >= storedObject.destroyTime - 1 then
  1037.  
  1038. if storedObject.object and storedObject.object:IsA("Part") then
  1039. local trans = storedObject.object.Transparency + 1/30
  1040. storedObject.object.Transparency = trans
  1041. end
  1042. else
  1043. break
  1044. end
  1045. end
  1046. wait()
  1047. end
  1048. end)
  1049.  
  1050. coroutine.resume(updateThread)
  1051.  
  1052. return destroyService
  1053. end))
  1054. ModuleScript44.Name = "ROBLOX_HumanoidList"
  1055. ModuleScript44.Parent = Configuration41
  1056. table.insert(cors,sandbox(ModuleScript44,function()
  1057. local humanoidList = {}
  1058. local storage = {}
  1059.  
  1060. function humanoidList:GetCurrent()
  1061. return storage
  1062. end
  1063.  
  1064. local function findHumanoids(object, list)
  1065. if object then
  1066. if object:IsA("Humanoid") then
  1067. table.insert(list, object)
  1068. end
  1069.  
  1070. for _, child in pairs(object:GetChildren()) do
  1071. local childList = findHumanoids(child, list)
  1072. end
  1073. end
  1074. end
  1075.  
  1076. local updateThread = coroutine.create(function()
  1077. while true do
  1078. storage = {}
  1079. findHumanoids(game.Workspace, storage)
  1080. wait(3)
  1081. end
  1082. end)
  1083.  
  1084. coroutine.resume(updateThread)
  1085.  
  1086. return humanoidList
  1087. end))
  1088. ModuleScript45.Name = "ROBLOX_StateMachine"
  1089. ModuleScript45.Parent = Configuration41
  1090. table.insert(cors,sandbox(ModuleScript45,function()
  1091. local machine = {}
  1092.  
  1093. machine.new = function()
  1094. local StateMachine = {}
  1095.  
  1096. StateMachine.WaitTime = .2
  1097. StateMachine.CurrentState = nil
  1098. StateMachine.SwitchState = function(newState)
  1099. if StateMachine.CurrentState then
  1100. StateMachine.CurrentState.Stop()
  1101. end
  1102. StateMachine.CurrentState = newState
  1103. if newState then
  1104. newState.Start()
  1105. end
  1106. end
  1107.  
  1108. StateMachine.NewState = function()
  1109. local state = {}
  1110. state.Name = ""
  1111. state.Conditions = {}
  1112. state.isRunning = false
  1113. state.Action = function() end
  1114. state.Run = function()
  1115. state.isRunning = true
  1116. while state.isRunning do
  1117. --check conditions
  1118. --print("checking conditions")
  1119. for _, condition in pairs(state.Conditions) do
  1120. --print("Checking " .. condition.Name)
  1121. if condition.Evaluate() then
  1122. --print(condition.Name .. " is true. Switching states")
  1123. StateMachine.SwitchState(condition.TransitionState)
  1124. return
  1125. end
  1126. end
  1127.  
  1128. --if no conditions satisfied, perform action
  1129. state.Action()
  1130. wait(StateMachine.WaitTime)
  1131. end
  1132. end
  1133. state.Init = function()
  1134.  
  1135. end
  1136. state.Start = function()
  1137. --print("Starting " .. state.Name)
  1138. state.Init()
  1139. local thread = coroutine.create(state.Run)
  1140. coroutine.resume(thread)
  1141. end
  1142. state.Stop = function()
  1143. --print("Stopping " .. state.Name)
  1144. state.isRunning = false
  1145. end
  1146. return state
  1147. end
  1148.  
  1149. StateMachine.NewCondition = function()
  1150. local condition = {}
  1151. condition.Name = ""
  1152. condition.Evaluate = function() print("replace me") return false end
  1153. condition.TransitionState = {}
  1154. return condition
  1155. end
  1156.  
  1157. return StateMachine
  1158. end
  1159.  
  1160. return machine
  1161. end))
  1162. ModuleScript46.Name = "ROBLOX_ZombieAI"
  1163. ModuleScript46.Parent = Configuration41
  1164. table.insert(cors,sandbox(ModuleScript46,function()
  1165. --local PathLib = require(game.ServerStorage.PathfindingLibrary).new()
  1166. local HumanoidList = require(game.ServerStorage.ROBLOX_HumanoidList)
  1167. local AIUtilities = require(game.ServerStorage.ROBLOX_AIUtilities)
  1168.  
  1169. local ZombieAI = {}
  1170.  
  1171. function updateDisplay(display, state)
  1172. local thread = coroutine.create(function()
  1173. while true do
  1174. wait()
  1175. if state then
  1176. display.Text = state.Name
  1177. end
  1178. end
  1179. end)
  1180. coroutine.resume(thread)
  1181. end
  1182.  
  1183. ZombieAI.new = function(model)
  1184. local zombie = {}
  1185.  
  1186. -- CONFIGURATION VARIABLES
  1187. -- local AttackRange, FieldOfView, AggroRange, ChanceOfBoredom, BoredomDuration,
  1188. -- Damage, DamageCooldown
  1189.  
  1190. local configTable = model.Configurations
  1191. local configs = {}
  1192. local function loadConfig(configName, defaultValue)
  1193. if configTable:FindFirstChild(configName) then
  1194. configs[configName] = configTable:FindFirstChild(configName).Value
  1195. else
  1196. configs[configName] = defaultValue
  1197. end
  1198. end
  1199.  
  1200. loadConfig("AttackRange", 3)
  1201. loadConfig("FieldOfView", 180)
  1202. loadConfig("AggroRange", 200)
  1203. loadConfig("ChanceOfBoredom", .5)
  1204. loadConfig("BoredomDuration", 10)
  1205. loadConfig("Damage", 10)
  1206. loadConfig("DamageCooldown", 1)
  1207.  
  1208. local StateMachine = require(game.ServerStorage.ROBLOX_StateMachine).new()
  1209. local PathLib = require(game.ServerStorage.ROBLOX_PathfindingLibrary).new()
  1210. local ZombieTarget = nil
  1211. local ZombieTargetLastLocation = nil
  1212.  
  1213. local lastBored = os.time()
  1214.  
  1215. -- STATE DEFINITIONS
  1216.  
  1217. -- IdleState: NPC stays still. Refreshes bored timer when started to
  1218. -- allow for random state change
  1219. local IdleState = StateMachine.NewState()
  1220. IdleState.Name = "Idle"
  1221. IdleState.Action = function()
  1222. end
  1223. IdleState.Init = function()
  1224. lastBored = os.time()
  1225. end
  1226.  
  1227. -- SearchState: NPC wanders randomly increasing chance of spotting
  1228. -- enemy. Refreshed bored timer when started to allow for random state
  1229. -- change
  1230. local SearchState = StateMachine.NewState()
  1231. SearchState.Name = "Search"
  1232. local lastmoved = os.time()
  1233. local searchTarget = nil
  1234. SearchState.Action = function()
  1235. -- move to random spot nearby
  1236. if model then
  1237. local now = os.time()
  1238. if now - lastmoved > 2 then
  1239. lastmoved = now
  1240. local xoff = math.random(5, 10)
  1241. if math.random() > .5 then
  1242. xoff = xoff * -1
  1243. end
  1244. local zoff = math.random(5, 10)
  1245. if math.random() > .5 then
  1246. zoff = zoff * -1
  1247. end
  1248.  
  1249. local testtarg = AIUtilities:FindCloseEmptySpace(model)
  1250. --if testtarg then print(testtarg) else print("could not find") end
  1251. searchTarget = Vector3.new(model.HumanoidRootPart.Position.X + xoff,model.HumanoidRootPart.Position.Y,model.HumanoidRootPart.Position.Z + zoff)
  1252. --local target = Vector3.new(model.HumanoidRootPart.Position.X + xoff,model.HumanoidRootPart.Position.Y,model.HumanoidRootPart.Position.Z + zoff)
  1253. --model.Humanoid:MoveTo(target)
  1254. searchTarget = testtarg
  1255. end
  1256. if searchTarget then
  1257. PathLib:MoveToTarget(model, searchTarget)
  1258. end
  1259. end
  1260. end
  1261. SearchState.Init = function()
  1262. lastBored = os.time()
  1263. end
  1264.  
  1265. -- PursueState: Enemy has been spotted, need to give chase.
  1266. local PursueState = StateMachine.NewState()
  1267. PursueState.Name = "Pursue"
  1268. PursueState.Action = function()
  1269. -- Double check we still have target
  1270. if ZombieTarget then
  1271. -- Get distance to target
  1272. local distance = (model.HumanoidRootPart.Position - ZombieTarget.HumanoidRootPart.Position).magnitude
  1273. -- If we're far from target use pathfinding to move. Otherwise just MoveTo
  1274. if distance > configs["AttackRange"] + 5 then
  1275. PathLib:MoveToTarget(model, ZombieTarget.HumanoidRootPart.Position)
  1276. else
  1277. model.Humanoid:MoveTo(ZombieTarget.HumanoidRootPart.Position)
  1278. -- if ZombieTarget.HumanoidRootPart.Position.Y > model.HumanoidRootPart.Position.Y + 2 then
  1279. -- model.Humanoid.Jump = true
  1280. -- end
  1281. end
  1282.  
  1283. end
  1284. end
  1285. PursueState.Init = function()
  1286. end
  1287.  
  1288. -- AttackState: Keep moving towards target and play attack animation.
  1289. local AttackState = StateMachine.NewState()
  1290. AttackState.Name = "Attack"
  1291. local lastAttack = os.time()
  1292. local attackTrack = model.Humanoid:LoadAnimation(model.Animations.Attack)
  1293. AttackState.Action = function()
  1294. model.Humanoid:MoveTo(ZombieTarget.HumanoidRootPart.Position)
  1295. local now = os.time()
  1296. if now - lastAttack > 3 then
  1297. lastAttack = now
  1298. attackTrack:Play()
  1299. end
  1300. end
  1301.  
  1302. -- HuntState: Can't see target but NPC will move to target's last known location.
  1303. -- Will eventually get bored and switch state.
  1304. local HuntState = StateMachine.NewState()
  1305. HuntState.Name = "Hunt"
  1306. HuntState.Action = function()
  1307. if ZombieTargetLastLocation then
  1308. PathLib:MoveToTarget(model, ZombieTargetLastLocation)
  1309. end
  1310. end
  1311. HuntState.Init = function()
  1312. lastBored = os.time() + configs["BoredomDuration"] / 2
  1313. end
  1314.  
  1315. -- CONDITION DEFINITIONS
  1316.  
  1317. -- CanSeeTarget: Determines if a target is visible. Returns true if target is visible and
  1318. -- sets current target. A target is valid if it is nearby, visible, has a Torso and WalkSpeed
  1319. -- greater than 0 (this is to ignore inanimate objects that happen to use humanoids)
  1320. local CanSeeTarget = StateMachine.NewCondition()
  1321. CanSeeTarget.Name = "CanSeeTarget"
  1322. CanSeeTarget.Evaluate = function()
  1323. if model then
  1324. -- Get list of all nearby Zombies and non-Zombie humanoids
  1325. -- Zombie list is used to ignore zombies during later raycast
  1326. local humanoids = HumanoidList:GetCurrent()
  1327. local zombies = {}
  1328. local characters = {}
  1329. for _, object in pairs(humanoids) do
  1330. if object and object.Parent and object.Parent:FindFirstChild("HumanoidRootPart") and object.Health > 0 and object.WalkSpeed > 0 then
  1331. local torso = object.Parent:FindFirstChild("HumanoidRootPart")
  1332. if torso then
  1333. local distance = (model.HumanoidRootPart.Position - torso.Position).magnitude
  1334. if distance <= configs["AggroRange"] then
  1335. if object.Parent.Name == "Drooling Zombie" then
  1336. table.insert(zombies, object.Parent)
  1337. else
  1338. table.insert(characters, object.Parent)
  1339. end
  1340. end
  1341. end
  1342. end
  1343. end
  1344.  
  1345. local target = AIUtilities:GetClosestVisibleTarget(model, characters, zombies, configs["FieldOfView"])
  1346. if target then
  1347. ZombieTarget = target
  1348. return true
  1349. end
  1350.  
  1351. -- -- Go through each valid target to see if within field of view and if there is
  1352. -- -- clear line of sight. Field of view treated as wedge in front of character.
  1353. -- for _, character in pairs(characters) do
  1354. -- local toTarget = (character.HumanoidRootPart.Position - model.HumanoidRootPart.Position)
  1355. -- toTarget = Vector3.new(toTarget.X, 0, toTarget.Z)
  1356. -- local angle = math.acos(toTarget:Dot(model.HumanoidRootPart.CFrame.lookVector)/toTarget.magnitude)
  1357. -- if math.deg(angle) < configs["FieldOfView"]/2 then
  1358. -- ZombieTarget = character
  1359. -- -- raycast to see if target is actually visible
  1360. -- local toTarget = Ray.new(model.HumanoidRootPart.Position, (ZombieTarget.HumanoidRootPart.Position - model.HumanoidRootPart.Position))
  1361. -- local part, position = game.Workspace:FindPartOnRayWithIgnoreList(toTarget, zombies)
  1362. -- if part and part.Parent == ZombieTarget then
  1363. -- return true
  1364. -- end
  1365. -- ZombieTarget = nil
  1366. -- end
  1367. -- end
  1368. end
  1369. return false
  1370. end
  1371. CanSeeTarget.TransitionState = PursueState
  1372.  
  1373. -- TargetDead: Check if target is dead.
  1374. local TargetDead = StateMachine.NewCondition()
  1375. TargetDead.Name = "TargetDead"
  1376. TargetDead.Evaluate = function()
  1377. if ZombieTarget and ZombieTarget.Humanoid then
  1378. return ZombieTarget.Humanoid.Health <= 0
  1379. end
  1380. return true
  1381. end
  1382. TargetDead.TransitionState = IdleState
  1383.  
  1384. -- GotDamaged: Check if NPC has taken damage
  1385. local lastHealth = model.Humanoid.Health
  1386. local GotDamaged = StateMachine.NewCondition()
  1387. GotDamaged.Name = "GotDamaged"
  1388. GotDamaged.Evaluate = function()
  1389. if model then
  1390. if lastHealth > model.Humanoid.Health then
  1391. return true
  1392. end
  1393. end
  1394. return false
  1395. end
  1396. GotDamaged.TransitionState = SearchState
  1397.  
  1398. -- GotBored: Used to provide random state change.
  1399. local GotBored = StateMachine.NewCondition()
  1400. GotBored.Name = "GotBored"
  1401. GotBored.Evaluate = function()
  1402. local now = os.time()
  1403. if now - lastBored > configs["BoredomDuration"] then
  1404. local roll = math.random()
  1405. if roll < configs["ChanceOfBoredom"] then
  1406. lastBored = now
  1407. if GotBored.TransitionState == SearchState then
  1408. GotBored.TransitionState = IdleState
  1409. else
  1410. GotBored.TransitionState = SearchState
  1411. end
  1412. return true
  1413. end
  1414. end
  1415. return false
  1416. end
  1417. GotBored.TransitionState = IdleState
  1418.  
  1419. -- LostTarget: Checks clear line of sight
  1420. local LostTarget = StateMachine.NewCondition()
  1421. LostTarget.Name = "LostTarget"
  1422. LostTarget.Evaluate = function()
  1423. if true then return false end
  1424. if ZombieTarget then
  1425. if (ZombieTarget.HumanoidRootPart.Position - model.HumanoidRootPart.Position).magnitude > 10 then
  1426. local toTarget = Ray.new(model.HumanoidRootPart.Position, (ZombieTarget.HumanoidRootPart.Position - model.HumanoidRootPart.Position))
  1427. local part, position = game.Workspace:FindPartOnRay(toTarget, model)
  1428. if not part or part.Parent ~= ZombieTarget then
  1429. --print("Lost target!")
  1430. ZombieTargetLastLocation = ZombieTarget.HumanoidRootPart.Position
  1431. ZombieTarget = nil
  1432. return true
  1433. end
  1434. end
  1435. end
  1436. return false
  1437. end
  1438. LostTarget.TransitionState = HuntState
  1439.  
  1440. local WithinRange = StateMachine.NewCondition()
  1441. WithinRange.Name = "WithinRange"
  1442. WithinRange.Evaluate = function()
  1443. if ZombieTarget then
  1444. local distance = (model.HumanoidRootPart.Position - ZombieTarget.HumanoidRootPart.Position).magnitude
  1445. if distance < configs["AttackRange"] then
  1446. --print("Within attack range!")
  1447. return true
  1448. end
  1449. end
  1450. return false
  1451. end
  1452. WithinRange.TransitionState = AttackState
  1453.  
  1454. local OutsideRange = StateMachine.NewCondition()
  1455. OutsideRange.Name = "OutsideRange"
  1456. OutsideRange.Evaluate = function()
  1457. if ZombieTarget then
  1458. local distance = (model.HumanoidRootPart.Position - ZombieTarget.HumanoidRootPart.Position).magnitude
  1459. if distance > configs["AttackRange"] then
  1460. --print("Outside attack range!")
  1461. return true
  1462. end
  1463. end
  1464. return false
  1465. end
  1466. OutsideRange.TransitionState = PursueState
  1467.  
  1468. table.insert(IdleState.Conditions, CanSeeTarget)
  1469. table.insert(IdleState.Conditions, GotDamaged)
  1470. table.insert(IdleState.Conditions, GotBored)
  1471.  
  1472. table.insert(SearchState.Conditions, GotBored)
  1473. table.insert(SearchState.Conditions, CanSeeTarget)
  1474.  
  1475. table.insert(PursueState.Conditions, LostTarget)
  1476. table.insert(PursueState.Conditions, WithinRange)
  1477. table.insert(PursueState.Conditions, TargetDead)
  1478.  
  1479. table.insert(AttackState.Conditions, OutsideRange)
  1480. table.insert(AttackState.Conditions, TargetDead)
  1481.  
  1482. table.insert(HuntState.Conditions, GotBored)
  1483. table.insert(HuntState.Conditions, CanSeeTarget)
  1484.  
  1485. -- Setup arms damage
  1486. local canHit = true
  1487. local lastHit = os.time()
  1488. local function handleHit(other)
  1489. if canHit then
  1490. if other and other.Parent and other.Parent.Name ~= "Drooling Zombie" and other.Parent:FindFirstChild("Humanoid") then
  1491. local enemy = other.Parent
  1492. if enemy.Humanoid.WalkSpeed > 0 then
  1493. enemy.Humanoid.Health = enemy.Humanoid.Health - configs["Damage"]
  1494. canHit = false
  1495. end
  1496. end
  1497. else
  1498. local now = os.time()
  1499. if now - lastHit > configs["DamageCooldown"] then
  1500. lastHit = now
  1501. canHit = true
  1502. end
  1503. end
  1504. end
  1505. local leftHitConnect, rightHitConnect
  1506. leftHitConnect = model:FindFirstChild("Left Arm").Touched:connect(handleHit)
  1507. rightHitConnect = model:FindFirstChild("Right Arm").Touched:connect(handleHit)
  1508.  
  1509. --ZombieAI.Animate(model)
  1510. --updateDisplay()
  1511. --updateDisplay(model.BillboardGui.TextLabel, StateMachine.CurrentState)
  1512. local thread = coroutine.create(function()
  1513. while true do
  1514. wait()
  1515. -- calculate repulsion force
  1516.  
  1517. local humanoids = HumanoidList:GetCurrent()
  1518. local localZombies = {}
  1519. for _, humanoid in pairs(humanoids) do
  1520. if humanoid and humanoid ~= model.Humanoid and humanoid.Parent and humanoid.Parent:FindFirstChild("HumanoidRootPart") then
  1521. local torso = humanoid.Parent:FindFirstChild("HumanoidRootPart")
  1522. local distance = (model.HumanoidRootPart.Position - torso.Position).magnitude
  1523. if distance <= 2.5 then
  1524. table.insert(localZombies, torso.Position)
  1525. end
  1526. end
  1527. end
  1528. local repulsionDirection = AIUtilities:GetRepulsionVector(model.HumanoidRootPart.Position, localZombies)
  1529. if repulsionDirection.magnitude > 0 then
  1530. --print("replusion direction: " .. tostring(repulsionDirection))
  1531. end
  1532. model.HumanoidRootPart.RepulsionForce.force = repulsionDirection
  1533.  
  1534. if StateMachine.CurrentState and model.Configurations.Debug.Value then
  1535. model.BillboardGui.TextLabel.Visible = true
  1536. model.BillboardGui.TextLabel.Text = StateMachine.CurrentState.Name
  1537. end
  1538. if not model.Configurations.Debug.Value then
  1539. model.BillboardGui.TextLabel.Visible = false
  1540. end
  1541. end
  1542. end)
  1543. coroutine.resume(thread)
  1544.  
  1545. StateMachine.SwitchState(IdleState)
  1546.  
  1547. zombie.Stop = function()
  1548. StateMachine.SwitchState(nil)
  1549. end
  1550.  
  1551. return zombie
  1552. end
  1553.  
  1554. return ZombieAI
  1555. end))
  1556. ModuleScript47.Name = "ROBLOX_PathfindingLibrary"
  1557. ModuleScript47.Parent = Configuration41
  1558. table.insert(cors,sandbox(ModuleScript47,function()
  1559. local PathfindingUtility = {}
  1560. local TargetOffsetMax = 10--5
  1561. local JumpThreshold = 1.5 --2.5
  1562. local NextPointThreshold = 4
  1563. local PathfindingService = game:GetService("PathfindingService")
  1564. PathfindingService.EmptyCutoff = .3
  1565.  
  1566. function PathfindingUtility.new()
  1567. local this = {}
  1568.  
  1569. local currentTargetPos = nil
  1570. local lastTargetPos = Vector3.new(math.huge, math.huge, math.huge)
  1571. local path = nil
  1572. local currentPointIndex = 1
  1573.  
  1574. function this:MoveToTarget(character, target)
  1575. local targetOffset = (lastTargetPos - target).magnitude
  1576. --
  1577. -- local targetOffsetVector = (lastTargetPos - target)
  1578. -- if targetOffsetVector.magnitude < math.huge then
  1579. -- targetOffsetVector = (lastTargetPos - target) * Vector3.new(1,0,1)
  1580. -- end
  1581. if targetOffset > TargetOffsetMax then
  1582. --if targetOffsetVector.magnitude > TargetOffsetMax then
  1583. --print("moveto")
  1584. local startPoint = character.HumanoidRootPart.Position
  1585. local humanoidState = character.Humanoid:GetState()
  1586. if humanoidState == Enum.HumanoidStateType.Jumping or humanoidState == Enum.HumanoidStateType.Freefall then
  1587. --print("this")
  1588. local ray = Ray.new(character.HumanoidRootPart.Position, Vector3.new(0, -100, 0))
  1589. local hitPart, hitPoint = game.Workspace:FindPartOnRay(ray, character)
  1590. if hitPart then
  1591. startPoint = hitPoint
  1592. end
  1593. end
  1594. --print("making new path")
  1595. local newTarget = target
  1596. local ray = Ray.new(target + Vector3.new(0,-3,0), Vector3.new(0, -100, 0))
  1597. local hitPart, hitPoint = game.Workspace:FindPartOnRay(ray, character)
  1598. if hitPoint then
  1599. if (hitPoint - target).magnitude > 4 then
  1600. newTarget = newTarget * Vector3.new(1,0,1) + Vector3.new(0,3,0)
  1601. end
  1602. end
  1603.  
  1604. --local newTarget = Vector3.new(1,0,1) * target + Vector3.new(0, 2, 0)
  1605. path = PathfindingService:ComputeSmoothPathAsync(startPoint, newTarget, 500)
  1606. if path.Status ~= Enum.PathStatus.Success then
  1607. --print(tostring(path.Status))
  1608. end
  1609. --path = PathfindingService:ComputeRawPathAsync(startPoint, target, 500)
  1610.  
  1611. -- game.Workspace.Points:ClearAllChildren()
  1612. -- local ps = path:GetPointCoordinates()
  1613. -- for _, point in pairs(ps) do
  1614. -- local part = Instance.new("Part", game.Workspace.Points)
  1615. -- part.CanCollide = false
  1616. -- part.Anchored = true
  1617. -- part.FormFactor = Enum.FormFactor.Custom
  1618. -- part.Size = Vector3.new(1,1,1)
  1619. -- part.Position = point
  1620. -- end
  1621.  
  1622. currentPointIndex = 1
  1623. lastTargetPos = target
  1624. end
  1625.  
  1626. if path then
  1627. local points = path:GetPointCoordinates()
  1628. if currentPointIndex < #points then
  1629. local currentPoint = points[currentPointIndex]
  1630. local distance = (character.HumanoidRootPart.Position - currentPoint).magnitude
  1631. if distance < NextPointThreshold then
  1632. currentPointIndex = currentPointIndex + 1
  1633. end
  1634.  
  1635. character.Humanoid:MoveTo(points[currentPointIndex])
  1636. if points[currentPointIndex].Y - character.HumanoidRootPart.Position.Y > JumpThreshold then
  1637. character.Humanoid.Jump = true
  1638. end
  1639. else
  1640. character.Humanoid:MoveTo(target)
  1641. end
  1642. end
  1643. end
  1644.  
  1645. return this
  1646. end
  1647. return PathfindingUtility
  1648. end))
  1649. Configuration48.Name = "Configurations"
  1650. Configuration48.Parent = Model2
  1651. IntValue49.Name = "Damage"
  1652. IntValue49.Parent = Configuration48
  1653. IntValue49.Value = 30
  1654. BoolValue50.Name = "Debug"
  1655. BoolValue50.Parent = Configuration48
  1656. IntValue51.Name = "FieldOfView"
  1657. IntValue51.Parent = Configuration48
  1658. IntValue51.Value = 180
  1659. IntValue52.Name = "AggroRange"
  1660. IntValue52.Parent = Configuration48
  1661. IntValue52.Value = 200
  1662. Configuration53.Name = "Animations"
  1663. Configuration53.Parent = Model2
  1664. Animation54.Name = "Attack"
  1665. Animation54.Parent = Configuration53
  1666. Animation54.AnimationId = "http://www.roblox.com/asset/?id=180416148"
  1667. Animation55.Name = "Arms"
  1668. Animation55.Parent = Configuration53
  1669. Animation55.AnimationId = "http://www.roblox.com/asset/?id=183294396"
  1670. CharacterMesh56.Name = "Zombie Left Arm"
  1671. CharacterMesh56.Parent = Model2
  1672. CharacterMesh56.BodyPart = Enum.BodyPart.LeftArm
  1673. CharacterMesh56.MeshId = 37683097
  1674. CharacterMesh56.OverlayTextureId = 37686282
  1675. CharacterMesh57.Name = "Zombie Left Leg"
  1676. CharacterMesh57.Parent = Model2
  1677. CharacterMesh57.BodyPart = Enum.BodyPart.LeftLeg
  1678. CharacterMesh57.MeshId = 37683150
  1679. CharacterMesh57.OverlayTextureId = 37687646
  1680. CharacterMesh58.Name = "Zombie Right Arm"
  1681. CharacterMesh58.Parent = Model2
  1682. CharacterMesh58.BodyPart = Enum.BodyPart.RightArm
  1683. CharacterMesh58.MeshId = 37683174
  1684. CharacterMesh58.OverlayTextureId = 37686282
  1685. CharacterMesh59.Name = "Zombie Right Leg"
  1686. CharacterMesh59.Parent = Model2
  1687. CharacterMesh59.BodyPart = Enum.BodyPart.RightLeg
  1688. CharacterMesh59.MeshId = 37683227
  1689. CharacterMesh59.OverlayTextureId = 37687646
  1690. CharacterMesh60.Name = "Zombie torso"
  1691. CharacterMesh60.Parent = Model2
  1692. CharacterMesh60.BodyPart = Enum.BodyPart.Torso
  1693. CharacterMesh60.MeshId = 37683263
  1694. CharacterMesh60.OverlayTextureId = 37686282
  1695. Sound61.Name = "Moan"
  1696. Sound61.Parent = Model2
  1697. Sound61.Pitch = 0.15000000596046
  1698. Sound61.PlaybackSpeed = 0.15000000596046
  1699. Sound61.Volume = 0.050000000745058
  1700. BodyColors62.Parent = Model2
  1701. BodyColors62.HeadColor = BrickColor.new("Camo")
  1702. BodyColors62.HeadColor3 = Color3.new(0.227451, 0.490196, 0.0823529)
  1703. BodyColors62.LeftArmColor = BrickColor.new("Earth green")
  1704. BodyColors62.LeftArmColor3 = Color3.new(0.152941, 0.27451, 0.176471)
  1705. BodyColors62.LeftLegColor = BrickColor.new("Earth green")
  1706. BodyColors62.LeftLegColor3 = Color3.new(0.152941, 0.27451, 0.176471)
  1707. BodyColors62.RightArmColor = BrickColor.new("Earth green")
  1708. BodyColors62.RightArmColor3 = Color3.new(0.152941, 0.27451, 0.176471)
  1709. BodyColors62.RightLegColor = BrickColor.new("Earth green")
  1710. BodyColors62.RightLegColor3 = Color3.new(0.152941, 0.27451, 0.176471)
  1711. BodyColors62.TorsoColor = BrickColor.new("Earth green")
  1712. BodyColors62.TorsoColor3 = Color3.new(0.152941, 0.27451, 0.176471)
  1713. for i,v in pairs(mas:GetChildren()) do
  1714. v.Parent = script
  1715. pcall(function() v:MakeJoints() end)
  1716. end
  1717. mas:Destroy()
  1718. for i,v in pairs(cors) do
  1719. spawn(function()
  1720. pcall(v)
  1721. end)
  1722. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement