LelXD

Zombie spawn mic

Feb 11th, 2016
784
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 26.47 KB | None | 0 0
  1. --Created with ttyyuu12345's compiler
  2. --Errors: ModuleScript
  3. Create = function(itemClass,tabl)
  4. local item = Instance.new(itemClass)
  5. for i,v in pairs(tabl) do
  6. local a,b = ypcall(function() return item[i] end)
  7. if a then
  8. item[i] = tabl[i]
  9. end
  10. end
  11. return item
  12. end
  13. function runDummyScript(f,scri)
  14. local oldenv = getfenv(f)
  15. local newenv = setmetatable({}, {
  16. __index = function(_, k)
  17. if k:lower() == 'script' then
  18. return scri
  19. else
  20. return oldenv[k]
  21. end
  22. end
  23. })
  24. setfenv(f, newenv)
  25. ypcall(function() f() end)
  26. end
  27. cors = {}
  28. mas = Instance.new("Model",game:GetService("Lighting"))
  29. mas.Name = "CompiledModel"
  30. o1 = Create("Model",{
  31. ["Name"] = "Drooling Zombie",
  32. ["Parent"] = mas,
  33. })
  34. o2 = Create("Part",{
  35. ["Name"] = "HumanoidRootPart",
  36. ["Parent"] = o1,
  37. ["Material"] = Enum.Material.WoodPlanks,
  38. ["BrickColor"] = BrickColor.new("Earth green"),
  39. ["Transparency"] = 1,
  40. ["Position"] = Vector3.new(-28.1000671, 3.00001097, -29.1999817),
  41. ["Rotation"] = Vector3.new(-2.70580359e-020, -90, 0),
  42. ["CFrame"] = CFrame.new(-28.1000671, 3.00001097, -29.1999817, 4.49431016e-021, -6.79974523e-022, -1, 4.72251821e-022, 1, -6.79974523e-022, 1, -4.72251821e-022, 4.49431016e-021),
  43. ["FormFactor"] = Enum.FormFactor.Symmetric,
  44. ["Size"] = Vector3.new(2, 2, 1),
  45. ["BottomSurface"] = Enum.SurfaceType.Smooth,
  46. ["TopSurface"] = Enum.SurfaceType.Smooth,
  47. ["Color"] = Color3.new(0.152941, 0.27451, 0.176471),
  48. })
  49. o3 = Create("Motor6D",{
  50. ["Name"] = "Root Hip",
  51. ["Parent"] = o2,
  52. ["Part0"] = o2,
  53. ["Part1"] = o4,
  54. ["MaxVelocity"] = 0.10000000149012,
  55. })
  56. o4 = Create("Part",{
  57. ["Name"] = "Torso",
  58. ["Parent"] = o1,
  59. ["Material"] = Enum.Material.WoodPlanks,
  60. ["BrickColor"] = BrickColor.new("Earth green"),
  61. ["Position"] = Vector3.new(-28.1000671, 3.00001097, -29.1999817),
  62. ["Rotation"] = Vector3.new(-2.70580359e-020, -90, 0),
  63. ["CFrame"] = CFrame.new(-28.1000671, 3.00001097, -29.1999817, 4.49431016e-021, -6.79974523e-022, -1, 4.72251821e-022, 1, -6.79974523e-022, 1, -4.72251821e-022, 4.49431016e-021),
  64. ["FormFactor"] = Enum.FormFactor.Symmetric,
  65. ["Size"] = Vector3.new(2, 2, 1),
  66. ["BottomSurface"] = Enum.SurfaceType.Smooth,
  67. ["TopSurface"] = Enum.SurfaceType.Smooth,
  68. ["Color"] = Color3.new(0.152941, 0.27451, 0.176471),
  69. })
  70. o5 = Create("Motor6D",{
  71. ["Name"] = "Left Hip",
  72. ["Parent"] = o4,
  73. ["Part0"] = o4,
  74. ["Part1"] = o11,
  75. ["MaxVelocity"] = 0.10000000149012,
  76. })
  77. o6 = Create("Motor6D",{
  78. ["Name"] = "Right Hip",
  79. ["Parent"] = o4,
  80. ["Part0"] = o4,
  81. ["Part1"] = o12,
  82. ["MaxVelocity"] = 0.10000000149012,
  83. })
  84. o7 = Create("Motor6D",{
  85. ["Name"] = "Left Shoulder",
  86. ["Parent"] = o4,
  87. ["Part0"] = o4,
  88. ["Part1"] = o13,
  89. ["MaxVelocity"] = 0.10000000149012,
  90. })
  91. o8 = Create("Motor6D",{
  92. ["Name"] = "Right Shoulder",
  93. ["Parent"] = o4,
  94. ["Part0"] = o4,
  95. ["Part1"] = o14,
  96. ["MaxVelocity"] = 0.10000000149012,
  97. })
  98. o9 = Create("Motor6D",{
  99. ["Name"] = "Neck",
  100. ["Parent"] = o4,
  101. ["Part0"] = o4,
  102. ["Part1"] = o15,
  103. ["MaxVelocity"] = 0.10000000149012,
  104. })
  105. o10 = Create("BodyForce",{
  106. ["Name"] = "RepulsionForce",
  107. ["Parent"] = o4,
  108. ["force"] = Vector3.new(0, 0, 0),
  109. })
  110. o11 = Create("Part",{
  111. ["Name"] = "Left Leg",
  112. ["Parent"] = o1,
  113. ["Material"] = Enum.Material.WoodPlanks,
  114. ["BrickColor"] = BrickColor.new("Earth green"),
  115. ["Position"] = Vector3.new(-28.1000671, 1.00001109, -29.6999817),
  116. ["Rotation"] = Vector3.new(-2.70580391e-020, -90, 0),
  117. ["CFrame"] = CFrame.new(-28.1000671, 1.00001109, -29.6999817, 4.49431016e-021, -6.79974422e-022, -1, 4.72251821e-022, 0.999999881, -6.79974523e-022, 1, -4.7225177e-022, 4.49431016e-021),
  118. ["CanCollide"] = false,
  119. ["FormFactor"] = Enum.FormFactor.Symmetric,
  120. ["Size"] = Vector3.new(1, 2, 1),
  121. ["BottomSurface"] = Enum.SurfaceType.Smooth,
  122. ["TopSurface"] = Enum.SurfaceType.Smooth,
  123. ["Color"] = Color3.new(0.152941, 0.27451, 0.176471),
  124. })
  125. o12 = Create("Part",{
  126. ["Name"] = "Right Leg",
  127. ["Parent"] = o1,
  128. ["Material"] = Enum.Material.WoodPlanks,
  129. ["BrickColor"] = BrickColor.new("Earth green"),
  130. ["Position"] = Vector3.new(-28.1000671, 1.00001109, -28.6999817),
  131. ["Rotation"] = Vector3.new(-2.70580391e-020, -90, 0),
  132. ["CFrame"] = CFrame.new(-28.1000671, 1.00001109, -28.6999817, 4.49431016e-021, -6.79974422e-022, -1, 4.72251821e-022, 0.999999881, -6.79974523e-022, 1, -4.7225177e-022, 4.49431016e-021),
  133. ["CanCollide"] = false,
  134. ["FormFactor"] = Enum.FormFactor.Symmetric,
  135. ["Size"] = Vector3.new(1, 2, 1),
  136. ["BottomSurface"] = Enum.SurfaceType.Smooth,
  137. ["TopSurface"] = Enum.SurfaceType.Smooth,
  138. ["Color"] = Color3.new(0.152941, 0.27451, 0.176471),
  139. })
  140. o13 = Create("Part",{
  141. ["Name"] = "Left Arm",
  142. ["Parent"] = o1,
  143. ["Material"] = Enum.Material.WoodPlanks,
  144. ["BrickColor"] = BrickColor.new("Earth green"),
  145. ["Position"] = Vector3.new(-28.1000671, 3.00001097, -30.6999817),
  146. ["Rotation"] = Vector3.new(-2.70580391e-020, -90, 0),
  147. ["CFrame"] = CFrame.new(-28.1000671, 3.00001097, -30.6999817, 4.49431016e-021, -6.79974422e-022, -1, 4.72251821e-022, 0.999999881, -6.79974523e-022, 1, -4.7225177e-022, 4.49431016e-021),
  148. ["CanCollide"] = false,
  149. ["FormFactor"] = Enum.FormFactor.Symmetric,
  150. ["Size"] = Vector3.new(1, 2, 1),
  151. ["BottomSurface"] = Enum.SurfaceType.Smooth,
  152. ["TopSurface"] = Enum.SurfaceType.Smooth,
  153. ["Color"] = Color3.new(0.152941, 0.27451, 0.176471),
  154. })
  155. o14 = Create("Part",{
  156. ["Name"] = "Right Arm",
  157. ["Parent"] = o1,
  158. ["Material"] = Enum.Material.WoodPlanks,
  159. ["BrickColor"] = BrickColor.new("Earth green"),
  160. ["Position"] = Vector3.new(-28.1000671, 3.00001097, -27.6999817),
  161. ["Rotation"] = Vector3.new(-2.70580391e-020, -90, 0),
  162. ["CFrame"] = CFrame.new(-28.1000671, 3.00001097, -27.6999817, 4.49431016e-021, -6.79974422e-022, -1, 4.72251821e-022, 0.999999881, -6.79974523e-022, 1, -4.7225177e-022, 4.49431016e-021),
  163. ["CanCollide"] = false,
  164. ["FormFactor"] = Enum.FormFactor.Symmetric,
  165. ["Size"] = Vector3.new(1, 2, 1),
  166. ["BottomSurface"] = Enum.SurfaceType.Smooth,
  167. ["TopSurface"] = Enum.SurfaceType.Smooth,
  168. ["Color"] = Color3.new(0.152941, 0.27451, 0.176471),
  169. })
  170. o15 = Create("Part",{
  171. ["Name"] = "Head",
  172. ["Parent"] = o1,
  173. ["Material"] = Enum.Material.WoodPlanks,
  174. ["BrickColor"] = BrickColor.new("Camo"),
  175. ["Position"] = Vector3.new(-28.1000671, 4.50001097, -29.1999817),
  176. ["Rotation"] = Vector3.new(-2.70580359e-020, -90, 0),
  177. ["CFrame"] = CFrame.new(-28.1000671, 4.50001097, -29.1999817, 4.49431016e-021, -6.79974523e-022, -1, 4.72251821e-022, 1, -6.79974523e-022, 1, -4.72251821e-022, 4.49431016e-021),
  178. ["FormFactor"] = Enum.FormFactor.Symmetric,
  179. ["Size"] = Vector3.new(2, 1, 1),
  180. ["BottomSurface"] = Enum.SurfaceType.Smooth,
  181. ["TopSurface"] = Enum.SurfaceType.Smooth,
  182. ["Color"] = Color3.new(0.227451, 0.490196, 0.0823529),
  183. })
  184. o16 = Create("Decal",{
  185. ["Name"] = "Face",
  186. ["Parent"] = o15,
  187. ["Texture"] = "http://www.roblox.com/asset/?id=7074882",
  188. })
  189. o17 = Create("SpecialMesh",{
  190. ["Parent"] = o15,
  191. ["Scale"] = Vector3.new(1.25, 1.25, 1.25),
  192. })
  193. o18 = Create("Humanoid",{
  194. ["Parent"] = o1,
  195. ["NameOcclusion"] = Enum.NameOcclusion.OccludeAll,
  196. ["RightLeg"] = o12,
  197. ["LeftLeg"] = o11,
  198. ["Torso"] = o2,
  199. ["WalkSpeed"] = 10,
  200. })
  201. o19 = Create("Script",{
  202. ["Name"] = "Animate",
  203. ["Parent"] = o1,
  204. })
  205. table.insert(cors,coroutine.create(function()
  206. wait()
  207. runDummyScript(function()
  208. function waitForChild(parent, childName)
  209. local child = parent:findFirstChild(childName)
  210. if child then return child end
  211. while true do
  212. child = parent.ChildAdded:wait()
  213. if child.Name==childName then return child end
  214. end
  215. end
  216.  
  217. local Figure = script.Parent
  218. local Torso = waitForChild(Figure, "Torso")
  219. local RightShoulder = waitForChild(Torso, "Right Shoulder")
  220. local LeftShoulder = waitForChild(Torso, "Left Shoulder")
  221. local RightHip = waitForChild(Torso, "Right Hip")
  222. local LeftHip = waitForChild(Torso, "Left Hip")
  223. local Neck = waitForChild(Torso, "Neck")
  224. local Humanoid = waitForChild(Figure, "Humanoid")
  225. local pose = "Standing"
  226.  
  227. local currentAnim = ""
  228. local currentAnimTrack = nil
  229. local currentAnimKeyframeHandler = nil
  230. local currentAnimSpeed = 1.0
  231. local animTable = {}
  232. local animNames = {
  233. idle = {
  234. { id = "http://www.roblox.com/asset/?id=125750544", weight = 9 },
  235. { id = "http://www.roblox.com/asset/?id=125750618", weight = 1 }
  236. },
  237. walk = {
  238. { id = "http://www.roblox.com/asset/?id=125749145", weight = 10 }
  239. },
  240. run = {
  241. { id = "run.xml", weight = 10 }
  242. },
  243. jump = {
  244. { id = "http://www.roblox.com/asset/?id=125750702", weight = 10 }
  245. },
  246. fall = {
  247. { id = "http://www.roblox.com/asset/?id=125750759", weight = 10 }
  248. },
  249. climb = {
  250. { id = "http://www.roblox.com/asset/?id=125750800", weight = 10 }
  251. },
  252. toolnone = {
  253. { id = "http://www.roblox.com/asset/?id=125750867", weight = 10 }
  254. },
  255. toolslash = {
  256. { id = "http://www.roblox.com/asset/?id=129967390", weight = 10 }
  257. -- { id = "slash.xml", weight = 10 }
  258. },
  259. toollunge = {
  260. { id = "http://www.roblox.com/asset/?id=129967478", weight = 10 }
  261. },
  262. wave = {
  263. { id = "http://www.roblox.com/asset/?id=128777973", weight = 10 }
  264. },
  265. point = {
  266. { id = "http://www.roblox.com/asset/?id=128853357", weight = 10 }
  267. },
  268. dance = {
  269. { id = "http://www.roblox.com/asset/?id=130018893", weight = 10 },
  270. { id = "http://www.roblox.com/asset/?id=132546839", weight = 10 },
  271. { id = "http://www.roblox.com/asset/?id=132546884", weight = 10 }
  272. },
  273. dance2 = {
  274. { id = "http://www.roblox.com/asset/?id=160934142", weight = 10 },
  275. { id = "http://www.roblox.com/asset/?id=160934298", weight = 10 },
  276. { id = "http://www.roblox.com/asset/?id=160934376", weight = 10 }
  277. },
  278. dance3 = {
  279. { id = "http://www.roblox.com/asset/?id=160934458", weight = 10 },
  280. { id = "http://www.roblox.com/asset/?id=160934530", weight = 10 },
  281. { id = "http://www.roblox.com/asset/?id=160934593", weight = 10 }
  282. },
  283. laugh = {
  284. { id = "http://www.roblox.com/asset/?id=129423131", weight = 10 }
  285. },
  286. cheer = {
  287. { id = "http://www.roblox.com/asset/?id=129423030", weight = 10 }
  288. },
  289. }
  290.  
  291. -- Existance in this list signifies that it is an emote, the value indicates if it is a looping emote
  292. local emoteNames = { wave = false, point = false, dance = true, dance2 = true, dance3 = true, laugh = false, cheer = false}
  293.  
  294. math.randomseed(tick())
  295.  
  296. function configureAnimationSet(name, fileList)
  297. if (animTable[name] ~= nil) then
  298. for _, connection in pairs(animTable[name].connections) do
  299. connection:disconnect()
  300. end
  301. end
  302. animTable[name] = {}
  303. animTable[name].count = 0
  304. animTable[name].totalWeight = 0
  305. animTable[name].connections = {}
  306.  
  307. -- check for config values
  308. local config = script:FindFirstChild(name)
  309. if (config ~= nil) then
  310. -- print("Loading anims " .. name)
  311. table.insert(animTable[name].connections, config.ChildAdded:connect(function(child) configureAnimationSet(name, fileList) end))
  312. table.insert(animTable[name].connections, config.ChildRemoved:connect(function(child) configureAnimationSet(name, fileList) end))
  313. local idx = 1
  314. for _, childPart in pairs(config:GetChildren()) do
  315. if (childPart:IsA("Animation")) then
  316. table.insert(animTable[name].connections, childPart.Changed:connect(function(property) configureAnimationSet(name, fileList) end))
  317. animTable[name][idx] = {}
  318. animTable[name][idx].anim = childPart
  319. local weightObject = childPart:FindFirstChild("Weight")
  320. if (weightObject == nil) then
  321. animTable[name][idx].weight = 1
  322. else
  323. animTable[name][idx].weight = weightObject.Value
  324. end
  325. animTable[name].count = animTable[name].count + 1
  326. animTable[name].totalWeight = animTable[name].totalWeight + animTable[name][idx].weight
  327. -- print(name .. " [" .. idx .. "] " .. animTable[name][idx].anim.AnimationId .. " (" .. animTable[name][idx].weight .. ")")
  328. idx = idx + 1
  329. end
  330. end
  331. end
  332.  
  333. -- fallback to defaults
  334. if (animTable[name].count <= 0) then
  335. for idx, anim in pairs(fileList) do
  336. animTable[name][idx] = {}
  337. animTable[name][idx].anim = Instance.new("Animation")
  338. animTable[name][idx].anim.Name = name
  339. animTable[name][idx].anim.AnimationId = anim.id
  340. animTable[name][idx].weight = anim.weight
  341. animTable[name].count = animTable[name].count + 1
  342. animTable[name].totalWeight = animTable[name].totalWeight + anim.weight
  343. -- print(name .. " [" .. idx .. "] " .. anim.id .. " (" .. anim.weight .. ")")
  344. end
  345. end
  346. end
  347.  
  348. -- Setup animation objects
  349. function scriptChildModified(child)
  350. local fileList = animNames[child.Name]
  351. if (fileList ~= nil) then
  352. configureAnimationSet(child.Name, fileList)
  353. end
  354. end
  355.  
  356. script.ChildAdded:connect(scriptChildModified)
  357. script.ChildRemoved:connect(scriptChildModified)
  358.  
  359.  
  360. for name, fileList in pairs(animNames) do
  361. configureAnimationSet(name, fileList)
  362. end
  363.  
  364. -- ANIMATION
  365.  
  366. -- declarations
  367. local toolAnim = "None"
  368. local toolAnimTime = 0
  369.  
  370. local jumpAnimTime = 0
  371. local jumpAnimDuration = 0.3
  372.  
  373. local toolTransitionTime = 0.1
  374. local fallTransitionTime = 0.3
  375. local jumpMaxLimbVelocity = 0.75
  376.  
  377. -- functions
  378.  
  379. function stopAllAnimations()
  380. local oldAnim = currentAnim
  381.  
  382. -- return to idle if finishing an emote
  383. if (emoteNames[oldAnim] ~= nil and emoteNames[oldAnim] == false) then
  384. oldAnim = "idle"
  385. end
  386.  
  387. currentAnim = ""
  388. if (currentAnimKeyframeHandler ~= nil) then
  389. currentAnimKeyframeHandler:disconnect()
  390. end
  391.  
  392. if (currentAnimTrack ~= nil) then
  393. currentAnimTrack:Stop()
  394. currentAnimTrack:Destroy()
  395. currentAnimTrack = nil
  396. end
  397. return oldAnim
  398. end
  399.  
  400. function setAnimationSpeed(speed)
  401. if speed ~= currentAnimSpeed then
  402. currentAnimSpeed = speed
  403. currentAnimTrack:AdjustSpeed(currentAnimSpeed)
  404. end
  405. end
  406.  
  407. function keyFrameReachedFunc(frameName)
  408. if (frameName == "End") then
  409. -- print("Keyframe : ".. frameName)
  410. local repeatAnim = stopAllAnimations()
  411. local animSpeed = currentAnimSpeed
  412. playAnimation(repeatAnim, 0.0, Humanoid)
  413. setAnimationSpeed(animSpeed)
  414. end
  415. end
  416.  
  417. -- Preload animations
  418. function playAnimation(animName, transitionTime, humanoid)
  419. local idleFromEmote = (animName == "idle" and emoteNames[currentAnim] ~= nil)
  420. if (animName ~= currentAnim and not idleFromEmote) then
  421.  
  422. if (currentAnimTrack ~= nil) then
  423. currentAnimTrack:Stop(transitionTime)
  424. currentAnimTrack:Destroy()
  425. end
  426.  
  427. currentAnimSpeed = 1.0
  428. local roll = math.random(1, animTable[animName].totalWeight)
  429. local origRoll = roll
  430. local idx = 1
  431. while (roll > animTable[animName][idx].weight) do
  432. roll = roll - animTable[animName][idx].weight
  433. idx = idx + 1
  434. end
  435. -- print(animName .. " " .. idx .. " [" .. origRoll .. "]")
  436. local anim = animTable[animName][idx].anim
  437.  
  438. -- load it to the humanoid; get AnimationTrack
  439. currentAnimTrack = humanoid:LoadAnimation(anim)
  440.  
  441. -- play the animation
  442. currentAnimTrack:Play(transitionTime)
  443. currentAnim = animName
  444.  
  445. -- set up keyframe name triggers
  446. if (currentAnimKeyframeHandler ~= nil) then
  447. currentAnimKeyframeHandler:disconnect()
  448. end
  449. currentAnimKeyframeHandler = currentAnimTrack.KeyframeReached:connect(keyFrameReachedFunc)
  450. end
  451. end
  452.  
  453. -------------------------------------------------------------------------------------------
  454. -------------------------------------------------------------------------------------------
  455.  
  456. local toolAnimName = ""
  457. local toolAnimTrack = nil
  458. local currentToolAnimKeyframeHandler = nil
  459.  
  460. function toolKeyFrameReachedFunc(frameName)
  461. if (frameName == "End") then
  462. -- print("Keyframe : ".. frameName)
  463. local repeatAnim = stopToolAnimations()
  464. playToolAnimation(repeatAnim, 0.0, Humanoid)
  465. end
  466. end
  467.  
  468.  
  469. function playToolAnimation(animName, transitionTime, humanoid)
  470. if (animName ~= toolAnimName) then
  471.  
  472. if (toolAnimTrack ~= nil) then
  473. toolAnimTrack:Stop()
  474. toolAnimTrack:Destroy()
  475. transitionTime = 0
  476. end
  477.  
  478. local roll = math.random(1, animTable[animName].totalWeight)
  479. local origRoll = roll
  480. local idx = 1
  481. while (roll > animTable[animName][idx].weight) do
  482. roll = roll - animTable[animName][idx].weight
  483. idx = idx + 1
  484. end
  485. -- print(animName .. " * " .. idx .. " [" .. origRoll .. "]")
  486. local anim = animTable[animName][idx].anim
  487.  
  488. -- load it to the humanoid; get AnimationTrack
  489. toolAnimTrack = humanoid:LoadAnimation(anim)
  490.  
  491. -- play the animation
  492. toolAnimTrack:Play(transitionTime)
  493. toolAnimName = animName
  494.  
  495. currentToolAnimKeyframeHandler = toolAnimTrack.KeyframeReached:connect(toolKeyFrameReachedFunc)
  496. end
  497. end
  498.  
  499. function stopToolAnimations()
  500. local oldAnim = toolAnimName
  501.  
  502. if (currentToolAnimKeyframeHandler ~= nil) then
  503. currentToolAnimKeyframeHandler:disconnect()
  504. end
  505.  
  506. toolAnimName = ""
  507. if (toolAnimTrack ~= nil) then
  508. toolAnimTrack:Stop()
  509. toolAnimTrack:Destroy()
  510. toolAnimTrack = nil
  511. end
  512.  
  513.  
  514. return oldAnim
  515. end
  516.  
  517. -------------------------------------------------------------------------------------------
  518. -------------------------------------------------------------------------------------------
  519.  
  520.  
  521. function onRunning(speed)
  522. if speed>0.01 then
  523. playAnimation("walk", 0.1, Humanoid)
  524. pose = "Running"
  525. else
  526. playAnimation("idle", 0.1, Humanoid)
  527. pose = "Standing"
  528. end
  529. end
  530.  
  531. function onDied()
  532. pose = "Dead"
  533. end
  534.  
  535. function onJumping()
  536. playAnimation("jump", 0.1, Humanoid)
  537. jumpAnimTime = jumpAnimDuration
  538. pose = "Jumping"
  539. end
  540.  
  541. function onClimbing(speed)
  542. playAnimation("climb", 0.1, Humanoid)
  543. setAnimationSpeed(speed / 12.0)
  544. pose = "Climbing"
  545. end
  546.  
  547. function onGettingUp()
  548. pose = "GettingUp"
  549. end
  550.  
  551. function onFreeFall()
  552. if (jumpAnimTime <= 0) then
  553. playAnimation("fall", fallTransitionTime, Humanoid)
  554. end
  555. pose = "FreeFall"
  556. end
  557.  
  558. function onFallingDown()
  559. pose = "FallingDown"
  560. end
  561.  
  562. function onSeated()
  563. pose = "Seated"
  564. end
  565.  
  566. function onPlatformStanding()
  567. pose = "PlatformStanding"
  568. end
  569.  
  570. function onSwimming(speed)
  571. if speed>0 then
  572. pose = "Running"
  573. else
  574. pose = "Standing"
  575. end
  576. end
  577.  
  578. function getTool()
  579. for _, kid in ipairs(Figure:GetChildren()) do
  580. if kid.className == "Tool" then return kid end
  581. end
  582. return nil
  583. end
  584.  
  585. function getToolAnim(tool)
  586. for _, c in ipairs(tool:GetChildren()) do
  587. if c.Name == "toolanim" and c.className == "StringValue" then
  588. return c
  589. end
  590. end
  591. return nil
  592. end
  593.  
  594. function animateTool()
  595.  
  596. if (toolAnim == "None") then
  597. playToolAnimation("toolnone", toolTransitionTime, Humanoid)
  598. return
  599. end
  600.  
  601. if (toolAnim == "Slash") then
  602. playToolAnimation("toolslash", 0, Humanoid)
  603. return
  604. end
  605.  
  606. if (toolAnim == "Lunge") then
  607. playToolAnimation("toollunge", 0, Humanoid)
  608. return
  609. end
  610. end
  611.  
  612. function moveSit()
  613. RightShoulder.MaxVelocity = 0.15
  614. LeftShoulder.MaxVelocity = 0.15
  615. RightShoulder:SetDesiredAngle(3.14 /2)
  616. LeftShoulder:SetDesiredAngle(-3.14 /2)
  617. RightHip:SetDesiredAngle(3.14 /2)
  618. LeftHip:SetDesiredAngle(-3.14 /2)
  619. end
  620.  
  621. local lastTick = 0
  622.  
  623. function move(time)
  624. local amplitude = 1
  625. local frequency = 1
  626. local deltaTime = time - lastTick
  627. lastTick = time
  628.  
  629. local climbFudge = 0
  630. local setAngles = false
  631.  
  632. if (jumpAnimTime > 0) then
  633. jumpAnimTime = jumpAnimTime - deltaTime
  634. end
  635.  
  636. if (pose == "FreeFall" and jumpAnimTime <= 0) then
  637. playAnimation("fall", fallTransitionTime, Humanoid)
  638. elseif (pose == "Seated") then
  639. stopAllAnimations()
  640. moveSit()
  641. return
  642. elseif (pose == "Running") then
  643. playAnimation("walk", 0.1, Humanoid)
  644. elseif (pose == "Dead" or pose == "GettingUp" or pose == "FallingDown" or pose == "Seated" or pose == "PlatformStanding") then
  645. -- print("Wha " .. pose)
  646. amplitude = 0.1
  647. frequency = 1
  648. setAngles = true
  649. end
  650.  
  651. if (setAngles) then
  652. desiredAngle = amplitude * math.sin(time * frequency)
  653.  
  654. RightShoulder:SetDesiredAngle(desiredAngle + climbFudge)
  655. LeftShoulder:SetDesiredAngle(desiredAngle - climbFudge)
  656. RightHip:SetDesiredAngle(-desiredAngle)
  657. LeftHip:SetDesiredAngle(-desiredAngle)
  658. end
  659.  
  660. -- Tool Animation handling
  661. local tool = getTool()
  662. if tool then
  663.  
  664. animStringValueObject = getToolAnim(tool)
  665.  
  666. if animStringValueObject then
  667. toolAnim = animStringValueObject.Value
  668. -- message recieved, delete StringValue
  669. animStringValueObject.Parent = nil
  670. toolAnimTime = time + .3
  671. end
  672.  
  673. if time > toolAnimTime then
  674. toolAnimTime = 0
  675. toolAnim = "None"
  676. end
  677.  
  678. animateTool()
  679. else
  680. stopToolAnimations()
  681. toolAnim = "None"
  682. toolAnimTime = 0
  683. end
  684. end
  685.  
  686. -- connect events
  687. Humanoid.Died:connect(onDied)
  688. Humanoid.Running:connect(onRunning)
  689. Humanoid.Jumping:connect(onJumping)
  690. Humanoid.Climbing:connect(onClimbing)
  691. Humanoid.GettingUp:connect(onGettingUp)
  692. Humanoid.FreeFalling:connect(onFreeFall)
  693. Humanoid.FallingDown:connect(onFallingDown)
  694. Humanoid.Seated:connect(onSeated)
  695. Humanoid.PlatformStanding:connect(onPlatformStanding)
  696. Humanoid.Swimming:connect(onSwimming)
  697.  
  698. -- main program
  699.  
  700. local runService = game:service("RunService");
  701.  
  702. -- initialize to idle
  703. playAnimation("idle", 0.1, Humanoid)
  704. pose = "Standing"
  705.  
  706. while Figure.Parent~=nil do
  707. local _, time = wait(0.1)
  708. move(time)
  709. end
  710.  
  711.  
  712.  
  713. end,o19)
  714. end))
  715. o20 = Create("StringValue",{
  716. ["Name"] = "climb",
  717. ["Parent"] = o19,
  718. })
  719. o21 = Create("Animation",{
  720. ["Name"] = "ClimbAnim",
  721. ["Parent"] = o20,
  722. ["AnimationId"] = "http://www.roblox.com/asset/?id=125750800",
  723. })
  724. o22 = Create("StringValue",{
  725. ["Name"] = "fall",
  726. ["Parent"] = o19,
  727. })
  728. o23 = Create("Animation",{
  729. ["Name"] = "FallAnim",
  730. ["Parent"] = o22,
  731. ["AnimationId"] = "http://www.roblox.com/asset/?id=125750759",
  732. })
  733. o24 = Create("StringValue",{
  734. ["Name"] = "idle",
  735. ["Parent"] = o19,
  736. })
  737. o25 = Create("Animation",{
  738. ["Name"] = "Animation1",
  739. ["Parent"] = o24,
  740. ["AnimationId"] = "http://www.roblox.com/asset/?id=125750544",
  741. })
  742. o26 = Create("NumberValue",{
  743. ["Name"] = "Weight",
  744. ["Parent"] = o25,
  745. ["Value"] = 9,
  746. })
  747. o27 = Create("Animation",{
  748. ["Name"] = "Animation2",
  749. ["Parent"] = o24,
  750. ["AnimationId"] = "http://www.roblox.com/asset/?id=125750618",
  751. })
  752. o28 = Create("NumberValue",{
  753. ["Name"] = "Weight",
  754. ["Parent"] = o27,
  755. ["Value"] = 1,
  756. })
  757. o29 = Create("StringValue",{
  758. ["Name"] = "jump",
  759. ["Parent"] = o19,
  760. })
  761. o30 = Create("Animation",{
  762. ["Name"] = "JumpAnim",
  763. ["Parent"] = o29,
  764. ["AnimationId"] = "http://www.roblox.com/asset/?id=125750702",
  765. })
  766. o31 = Create("StringValue",{
  767. ["Name"] = "run",
  768. ["Parent"] = o19,
  769. })
  770. o32 = Create("Animation",{
  771. ["Name"] = "RunAnim",
  772. ["Parent"] = o31,
  773. ["AnimationId"] = "http://www.roblox.com/asset/?id=125749145",
  774. })
  775. o33 = Create("StringValue",{
  776. ["Name"] = "toolnone",
  777. ["Parent"] = o19,
  778. })
  779. o34 = Create("Animation",{
  780. ["Name"] = "ToolNoneAnim",
  781. ["Parent"] = o33,
  782. ["AnimationId"] = "http://www.roblox.com/asset/?id=125750867",
  783. })
  784. o35 = Create("StringValue",{
  785. ["Name"] = "walk",
  786. ["Parent"] = o19,
  787. })
  788. o36 = Create("Animation",{
  789. ["Name"] = "WalkAnim",
  790. ["Parent"] = o35,
  791. ["AnimationId"] = "http://www.roblox.com/asset/?id=125749145",
  792. })
  793. o37 = Create("Script",{
  794. ["Parent"] = o1,
  795. })
  796. table.insert(cors,coroutine.create(function()
  797. wait()
  798. runDummyScript(function()
  799. local zombie = script.Parent
  800.  
  801. for _, script in pairs(zombie.ModuleScripts:GetChildren()) do
  802. if not game.ServerStorage:FindFirstChild(script.Name) then
  803. script:Clone().Parent = game.ServerStorage
  804. end
  805. end
  806.  
  807. local AI = require(game.ServerStorage.ROBLOX_ZombieAI).new(zombie)
  808. local DestroyService = require(game.ServerStorage.ROBLOX_DestroyService)
  809.  
  810.  
  811. local function clearParts(parent)
  812. for _, part in pairs(parent:GetChildren()) do
  813. clearParts(part)
  814. end
  815. local delay
  816. if parent:IsA("Part") then
  817. delay = math.random(5,10)
  818. else
  819. delay = 11
  820. end
  821. DestroyService:AddItem(parent, delay)
  822. end
  823.  
  824. zombie.Humanoid.Died:connect(function()
  825. AI.Stop()
  826. math.randomseed(tick())
  827. clearParts(zombie)
  828. script.Disabled = true
  829. end)
  830.  
  831. local lastMoan = os.time()
  832. math.randomseed(os.time())
  833. while true do
  834. local animationTrack = zombie.Humanoid:LoadAnimation(zombie.Animations.Arms)
  835. animationTrack:Play()
  836. -- local now = os.time()
  837. -- if now - lastMoan > 5 then
  838. -- if math.random() > .3 then
  839. -- zombie.Moan:Play()
  840. ---- print("playing moan")
  841. -- lastMoan = now
  842. -- end
  843. -- end
  844. wait(2)
  845. end
  846.  
  847.  
  848. end,o37)
  849. end))
  850. o38 = Create("BillboardGui",{
  851. ["Parent"] = o1,
  852. ["Size"] = UDim2.new(0,100,0,30),
  853. ["StudsOffset"] = Vector3.new(0, 5, 0),
  854. })
  855. o39 = Create("TextLabel",{
  856. ["Parent"] = o38,
  857. ["Size"] = UDim2.new(1,0,1,0),
  858. ["Text"] = "Idle",
  859. ["Visible"] = false,
  860. ["BackgroundColor3"] = Color3.new(1, 1, 1),
  861. ["Font"] = Enum.Font.SourceSansBold,
  862. ["FontSize"] = Enum.FontSize.Size24,
  863. })
  864. o40 = Create("Configuration",{
  865. ["Name"] = "ModuleScripts",
  866. ["Parent"] = o1,
  867. })
  868. o47 = Create("Configuration",{
  869. ["Name"] = "Configurations",
  870. ["Parent"] = o1,
  871. })
  872. o48 = Create("IntValue",{
  873. ["Name"] = "Damage",
  874. ["Parent"] = o47,
  875. ["Value"] = 30,
  876. })
  877. o49 = Create("BoolValue",{
  878. ["Name"] = "Debug",
  879. ["Parent"] = o47,
  880. })
  881. o50 = Create("IntValue",{
  882. ["Name"] = "FieldOfView",
  883. ["Parent"] = o47,
  884. ["Value"] = 180,
  885. })
  886. o51 = Create("IntValue",{
  887. ["Name"] = "AggroRange",
  888. ["Parent"] = o47,
  889. ["Value"] = 200,
  890. })
  891. o52 = Create("Configuration",{
  892. ["Name"] = "Animations",
  893. ["Parent"] = o1,
  894. })
  895. o53 = Create("Animation",{
  896. ["Name"] = "Attack",
  897. ["Parent"] = o52,
  898. ["AnimationId"] = "http://www.roblox.com/asset/?id=180416148",
  899. })
  900. o54 = Create("Animation",{
  901. ["Name"] = "Arms",
  902. ["Parent"] = o52,
  903. ["AnimationId"] = "http://www.roblox.com/asset/?id=183294396",
  904. })
  905. o55 = Create("CharacterMesh",{
  906. ["Name"] = "Zombie Left Arm",
  907. ["Parent"] = o1,
  908. ["MeshId"] = 37683097,
  909. ["BodyPart"] = Enum.BodyPart.LeftArm,
  910. ["OverlayTextureId"] = 37686282,
  911. })
  912. o56 = Create("CharacterMesh",{
  913. ["Name"] = "Zombie Left Leg",
  914. ["Parent"] = o1,
  915. ["MeshId"] = 37683150,
  916. ["BodyPart"] = Enum.BodyPart.LeftLeg,
  917. ["OverlayTextureId"] = 37687646,
  918. })
  919. o57 = Create("CharacterMesh",{
  920. ["Name"] = "Zombie Right Arm",
  921. ["Parent"] = o1,
  922. ["MeshId"] = 37683174,
  923. ["BodyPart"] = Enum.BodyPart.RightArm,
  924. ["OverlayTextureId"] = 37686282,
  925. })
  926. o58 = Create("CharacterMesh",{
  927. ["Name"] = "Zombie Right Leg",
  928. ["Parent"] = o1,
  929. ["MeshId"] = 37683227,
  930. ["BodyPart"] = Enum.BodyPart.RightLeg,
  931. ["OverlayTextureId"] = 37687646,
  932. })
  933. o59 = Create("CharacterMesh",{
  934. ["Name"] = "Zombie torso",
  935. ["Parent"] = o1,
  936. ["MeshId"] = 37683263,
  937. ["BodyPart"] = Enum.BodyPart.Torso,
  938. ["OverlayTextureId"] = 37686282,
  939. })
  940. o60 = Create("Sound",{
  941. ["Name"] = "Moan",
  942. ["Parent"] = o1,
  943. ["Pitch"] = 0.15000000596046,
  944. ["SoundId"] = "http://www.roblox.com/asset/?id=12222242",
  945. ["Volume"] = 0.050000000745058,
  946. })
  947. o61 = Create("BodyColors",{
  948. ["Parent"] = o1,
  949. ["HeadColor"] = BrickColor.new("Camo"),
  950. ["LeftArmColor"] = BrickColor.new("Earth green"),
  951. ["LeftLegColor"] = BrickColor.new("Earth green"),
  952. ["RightArmColor"] = BrickColor.new("Earth green"),
  953. ["RightLegColor"] = BrickColor.new("Earth green"),
  954. ["TorsoColor"] = BrickColor.new("Earth green"),
  955. })
  956. mas.Parent = workspace
  957. mas:MakeJoints()
  958. local mas1 = mas:GetChildren()
  959. for i=1,#mas1 do
  960. mas1[i].Parent = workspace
  961. ypcall(function() mas1[i]:MakeJoints() end)
  962. end
  963. mas:Destroy()
  964. for i=1,#cors do
  965. coroutine.resume(cors[i])
  966. end
Advertisement
Add Comment
Please, Sign In to add comment