Advertisement
BNutty07

Zombie Script

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