Advertisement
soubrhomi

motorcicle

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