Advertisement
sawgamer1

Untitled

Dec 20th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 32.95 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. Weld2 = Instance.new("Weld")
  22. SpecialMesh3 = Instance.new("SpecialMesh")
  23. Decal4 = Instance.new("Decal")
  24. Part5 = Instance.new("Part")
  25. Decal6 = Instance.new("Decal")
  26. Motor6D7 = Instance.new("Motor6D")
  27. Motor6D8 = Instance.new("Motor6D")
  28. Motor6D9 = Instance.new("Motor6D")
  29. Motor6D10 = Instance.new("Motor6D")
  30. Motor6D11 = Instance.new("Motor6D")
  31. Sound12 = Instance.new("Sound")
  32. Sound13 = Instance.new("Sound")
  33. Sound14 = Instance.new("Sound")
  34. Part15 = Instance.new("Part")
  35. Part16 = Instance.new("Part")
  36. Part17 = Instance.new("Part")
  37. Script18 = Instance.new("Script")
  38. Part19 = Instance.new("Part")
  39. Script20 = Instance.new("Script")
  40. BoolValue21 = Instance.new("BoolValue")
  41. Script22 = Instance.new("Script")
  42. BoolValue23 = Instance.new("BoolValue")
  43. Humanoid24 = Instance.new("Humanoid")
  44. ObjectValue25 = Instance.new("ObjectValue")
  45. Script26 = Instance.new("Script")
  46. Script27 = Instance.new("Script")
  47. Script28 = Instance.new("Script")
  48. NumberValue29 = Instance.new("NumberValue")
  49. ObjectValue30 = Instance.new("ObjectValue")
  50. Animation31 = Instance.new("Animation")
  51. Script32 = Instance.new("Script")
  52. StringValue33 = Instance.new("StringValue")
  53. Animation34 = Instance.new("Animation")
  54. StringValue35 = Instance.new("StringValue")
  55. Animation36 = Instance.new("Animation")
  56. StringValue37 = Instance.new("StringValue")
  57. Animation38 = Instance.new("Animation")
  58. NumberValue39 = Instance.new("NumberValue")
  59. Animation40 = Instance.new("Animation")
  60. NumberValue41 = Instance.new("NumberValue")
  61. StringValue42 = Instance.new("StringValue")
  62. Animation43 = Instance.new("Animation")
  63. StringValue44 = Instance.new("StringValue")
  64. Animation45 = Instance.new("Animation")
  65. StringValue46 = Instance.new("StringValue")
  66. Animation47 = Instance.new("Animation")
  67. StringValue48 = Instance.new("StringValue")
  68. Animation49 = Instance.new("Animation")
  69. StringValue50 = Instance.new("StringValue")
  70. Animation51 = Instance.new("Animation")
  71. Pants52 = Instance.new("Pants")
  72. Shirt53 = Instance.new("Shirt")
  73. Model0.Name = "Zombie Yeti"
  74. Model0.Parent = mas
  75. Part1.Name = "Head"
  76. Part1.Parent = Model0
  77. Part1.CFrame = CFrame.new(1.82991195, 9.15586472, -9.18083954, 0.996355772, 0, 0.0852946565, 0, 1, 0, -0.0852946565, 0, 0.996355772)
  78. Part1.Orientation = Vector3.new(0, 4.88999987, 0)
  79. Part1.Position = Vector3.new(1.82991195, 9.15586472, -9.18083954)
  80. Part1.Rotation = Vector3.new(0, 4.88999987, 0)
  81. Part1.Color = Color3.new(0.94902, 0.952941, 0.952941)
  82. Part1.Size = Vector3.new(4, 2, 2)
  83. Part1.BrickColor = BrickColor.new("White")
  84. Part1.TopSurface = Enum.SurfaceType.Smooth
  85. Part1.brickColor = BrickColor.new("White")
  86. Part1.FormFactor = Enum.FormFactor.Symmetric
  87. Part1.formFactor = Enum.FormFactor.Symmetric
  88. Weld2.Name = "HeadWeld"
  89. Weld2.Parent = Part1
  90. Weld2.C0 = CFrame.new(0, 0.5, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  91. Weld2.C1 = CFrame.new(0, 0.25, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  92. SpecialMesh3.Parent = Part1
  93. SpecialMesh3.Scale = Vector3.new(1.25, 1.25, 1.25)
  94. Decal4.Name = "Papyrus Face"
  95. Decal4.Parent = Part1
  96. Decal4.Texture = "http://www.roblox.com/asset/?id=785118827"
  97. Part5.Name = "Torso"
  98. Part5.Parent = Model0
  99. Part5.CFrame = CFrame.new(1.82991195, 6.00586462, -9.18083954, 0.996355772, 0, 0.0852946565, 0, 1, 0, -0.0852946565, 0, 0.996355772)
  100. Part5.Orientation = Vector3.new(0, 4.88999987, 0)
  101. Part5.Position = Vector3.new(1.82991195, 6.00586462, -9.18083954)
  102. Part5.Rotation = Vector3.new(0, 4.88999987, 0)
  103. Part5.Color = Color3.new(0.94902, 0.952941, 0.952941)
  104. Part5.Size = Vector3.new(4, 4, 2)
  105. Part5.BrickColor = BrickColor.new("White")
  106. Part5.LeftParamA = 0
  107. Part5.LeftParamB = 0
  108. Part5.LeftSurface = Enum.SurfaceType.Weld
  109. Part5.Material = Enum.Material.Ice
  110. Part5.RightParamA = 0
  111. Part5.RightParamB = 0
  112. Part5.RightSurface = Enum.SurfaceType.Weld
  113. Part5.brickColor = BrickColor.new("White")
  114. Part5.FormFactor = Enum.FormFactor.Symmetric
  115. Part5.formFactor = Enum.FormFactor.Symmetric
  116. Decal6.Name = "roblox"
  117. Decal6.Parent = Part5
  118. Motor6D7.Name = "Right Shoulder"
  119. Motor6D7.Parent = Part5
  120. Motor6D7.MaxVelocity = 0.15000000596046
  121. Motor6D7.CurrentAngle = 0.0076203746721148
  122. Motor6D7.C0 = CFrame.new(1, 0.5, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
  123. Motor6D7.C1 = CFrame.new(-2, 0.5, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
  124. Motor6D7.Part0 = Part5
  125. Motor6D7.Part1 = Part16
  126. Motor6D7.part1 = Part16
  127. Motor6D7.Transform = CFrame.new(1.22001254e-07, -0.00761091383, 4.07298216e-07, 0.999920011, -0.00761925755, 0.0100933062, 0.00762108574, 0.999970973, -0.000142632198, -0.010091926, 0.000219548383, 0.999949038)
  128. Motor6D8.Name = "Left Shoulder"
  129. Motor6D8.Parent = Part5
  130. Motor6D8.MaxVelocity = 0.15000000596046
  131. Motor6D8.CurrentAngle = -0.0062007796950638
  132. Motor6D8.C0 = CFrame.new(-1, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  133. Motor6D8.C1 = CFrame.new(1.99999976, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  134. Motor6D8.Part0 = Part5
  135. Motor6D8.Part1 = Part15
  136. Motor6D8.part1 = Part15
  137. Motor6D8.Transform = CFrame.new(2.48542165e-09, -0.0303637199, -1.39071901e-07, 0.999669731, 0.00622552261, -0.0249343365, -0.00617466308, 0.999978721, 0.0021163167, 0.0249469802, -0.00196166453, 0.999686897)
  138. Motor6D9.Name = "Right Hip"
  139. Motor6D9.Parent = Part5
  140. Motor6D9.MaxVelocity = 0.10000000149012
  141. Motor6D9.C0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
  142. Motor6D9.C1 = CFrame.new(0, 3, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
  143. Motor6D9.Part0 = Part5
  144. Motor6D9.Part1 = Part19
  145. Motor6D9.part1 = Part19
  146. Motor6D9.Transform = CFrame.new(0, 0.01449179, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  147. Motor6D10.Name = "Left Hip"
  148. Motor6D10.Parent = Part5
  149. Motor6D10.MaxVelocity = 0.10000000149012
  150. Motor6D10.C0 = CFrame.new(-1, -1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  151. Motor6D10.C1 = CFrame.new(0, 3, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  152. Motor6D10.Part0 = Part5
  153. Motor6D10.Part1 = Part17
  154. Motor6D10.part1 = Part17
  155. Motor6D10.Transform = CFrame.new(0, 0.0179747958, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  156. Motor6D11.Name = "Neck"
  157. Motor6D11.Parent = Part5
  158. Motor6D11.C1 = CFrame.new(0, 3.1500001, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  159. Motor6D11.Part0 = Part1
  160. Motor6D11.Part1 = Part5
  161. Motor6D11.part1 = Part5
  162. Sound12.Parent = Part5
  163. Sound12.SoundId = "http://www.roblox.com/asset/?id=38212101"
  164. Sound12.Volume = 1
  165. Sound13.Parent = Part5
  166. Sound13.SoundId = "http://www.roblox.com/asset/?id=2801263"
  167. Sound13.Volume = 1
  168. Sound14.Parent = Part5
  169. Sound14.TimePosition = 7.7317870435846
  170. Sound14.Playing = true
  171. Sound14.SoundId = "rbxassetid://321451733"
  172. Sound14.Volume = 1
  173. Part15.Name = "Left Arm"
  174. Part15.Parent = Model0
  175. Part15.CFrame = CFrame.new(-1.16402745, 5.97974396, -8.97771358, 0.998170555, 0.00248551951, 0.0604104176, -0.0021163167, 0.999978721, -0.00617466308, -0.0604244843, 0.00603551604, 0.998154521)
  176. Part15.Orientation = Vector3.new(0.349999994, 3.46000004, -0.119999997)
  177. Part15.Position = Vector3.new(-1.16402745, 5.97974396, -8.97771358)
  178. Part15.Rotation = Vector3.new(0.349999994, 3.46000004, -0.140000001)
  179. Part15.Color = Color3.new(0.94902, 0.952941, 0.952941)
  180. Part15.Size = Vector3.new(2, 4, 2)
  181. Part15.BottomSurface = Enum.SurfaceType.Smooth
  182. Part15.BrickColor = BrickColor.new("White")
  183. Part15.CanCollide = false
  184. Part15.Material = Enum.Material.Ice
  185. Part15.brickColor = BrickColor.new("White")
  186. Part15.FormFactor = Enum.FormFactor.Symmetric
  187. Part15.formFactor = Enum.FormFactor.Symmetric
  188. Part16.Name = "Right Arm"
  189. Part16.Parent = Model0
  190. Part16.CFrame = CFrame.new(4.81672192, 5.99798298, -9.4606142, 0.995444059, 0.000868630246, 0.0953429788, -0.000142632198, 0.999970973, -0.00762108574, -0.0953468382, 0.007572765, 0.99541527)
  191. Part16.Orientation = Vector3.new(0.439999998, 5.46999979, -0.00999999978)
  192. Part16.Position = Vector3.new(4.81672192, 5.99798298, -9.4606142)
  193. Part16.Rotation = Vector3.new(0.439999998, 5.46999979, -0.049999997)
  194. Part16.Color = Color3.new(0.94902, 0.952941, 0.952941)
  195. Part16.Size = Vector3.new(2, 4, 2)
  196. Part16.BottomSurface = Enum.SurfaceType.Smooth
  197. Part16.BrickColor = BrickColor.new("White")
  198. Part16.CanCollide = false
  199. Part16.Material = Enum.Material.Ice
  200. Part16.brickColor = BrickColor.new("White")
  201. Part16.FormFactor = Enum.FormFactor.Symmetric
  202. Part16.formFactor = Enum.FormFactor.Symmetric
  203. Part17.Name = "Left Leg"
  204. Part17.Parent = Model0
  205. Part17.CFrame = CFrame.new(0.833556175, 2.02383947, -9.09554482, 0.996355772, 0, 0.0852946565, 0, 1, 0, -0.0852946565, 0, 0.996355772)
  206. Part17.Orientation = Vector3.new(0, 4.88999987, 0)
  207. Part17.Position = Vector3.new(0.833556175, 2.02383947, -9.09554482)
  208. Part17.Rotation = Vector3.new(0, 4.88999987, 0)
  209. Part17.Color = Color3.new(0.94902, 0.952941, 0.952941)
  210. Part17.Size = Vector3.new(2, 4, 2)
  211. Part17.BottomSurface = Enum.SurfaceType.Smooth
  212. Part17.BrickColor = BrickColor.new("White")
  213. Part17.CanCollide = false
  214. Part17.Material = Enum.Material.Ice
  215. Part17.brickColor = BrickColor.new("White")
  216. Part17.FormFactor = Enum.FormFactor.Symmetric
  217. Part17.formFactor = Enum.FormFactor.Symmetric
  218. Script18.Parent = Part17
  219. table.insert(cors,sandbox(Script18,function()
  220. function touch(hit)
  221. if hit.Parent.Name == "Tank" or hit.Parent.Name == "Brotherhood Of Scythe" then
  222. script.Parent.Parent.Humanoid.Jump = true
  223. end
  224. end
  225.  
  226. script.Parent.Touched:connect(touch)
  227.  
  228. while true do
  229. touch = script.Parent:findFirstChild("TouchInterest")
  230. if touch == nil then
  231. script.Parent.Touched:connect(touch)
  232. end
  233. wait()
  234. end
  235.  
  236. end))
  237. Part19.Name = "Right Leg"
  238. Part19.Parent = Model0
  239. Part19.CFrame = CFrame.new(2.82626772, 2.02035642, -9.26613426, 0.996355772, 0, 0.0852946565, 0, 1, 0, -0.0852946565, 0, 0.996355772)
  240. Part19.Orientation = Vector3.new(0, 4.88999987, 0)
  241. Part19.Position = Vector3.new(2.82626772, 2.02035642, -9.26613426)
  242. Part19.Rotation = Vector3.new(0, 4.88999987, 0)
  243. Part19.Color = Color3.new(0.94902, 0.952941, 0.952941)
  244. Part19.Size = Vector3.new(2, 4, 2)
  245. Part19.BottomSurface = Enum.SurfaceType.Smooth
  246. Part19.BrickColor = BrickColor.new("White")
  247. Part19.CanCollide = false
  248. Part19.Material = Enum.Material.Ice
  249. Part19.brickColor = BrickColor.new("White")
  250. Part19.FormFactor = Enum.FormFactor.Symmetric
  251. Part19.formFactor = Enum.FormFactor.Symmetric
  252. Script20.Parent = Part19
  253. table.insert(cors,sandbox(Script20,function()
  254. function touch(hit)
  255. if hit.Parent.Name == "Tank" or hit.Parent.Name == "Brotherhood Of Scythe" then
  256. script.Parent.Parent.Humanoid.Jump = true
  257. end
  258. end
  259.  
  260. script.Parent.Touched:connect(touch)
  261.  
  262. while true do
  263. touch = script.Parent:findFirstChild("TouchInterest")
  264. if touch == nil then
  265. script.Parent.Touched:connect(touch)
  266. end
  267. wait()
  268. end
  269.  
  270. end))
  271. BoolValue21.Name = "Attack"
  272. BoolValue21.Parent = Model0
  273. Script22.Name = "ChaseScript"
  274. Script22.Parent = Model0
  275. table.insert(cors,sandbox(Script22,function()
  276. wait()
  277. zombieParent = false
  278.  
  279. while zombieParent == false do
  280.  
  281. wait()
  282. if script.Parent.Name == "Zombie Yeti" then
  283. zombieParent = true
  284. end
  285.  
  286. end
  287.  
  288. local larm = script.Parent:FindFirstChild("Left Arm")
  289. local rarm = script.Parent:FindFirstChild("Right Arm")
  290. local waitTimer = 0
  291.  
  292. function findNearestTorso(pos)
  293. local list = game.Workspace:children()
  294. local torso = nil
  295. local dist = 10000
  296. local temp = nil
  297. local human = nil
  298. local temp2 = nil
  299. for x = 1, #list do
  300. temp2 = list[x]
  301. if (temp2.className == "Model") and (temp2 ~= script.Parent) then
  302. temp = temp2:findFirstChild("Torso")
  303. human = temp2:findFirstChild("Humanoid")
  304. if (temp ~= nil) and (human ~= nil) and (human.Health > 0) then
  305. if (temp.Position - pos).magnitude < dist then
  306. torso = temp
  307. script.Parent.Target.Value = temp
  308. dist = (temp.Position - pos).magnitude
  309.  
  310. if human.Health >= 1 then
  311. script.Parent.Range.Value = true
  312. else
  313. script.Parent.Range.Value = false
  314. end
  315. end
  316. end
  317. if dist < 10 then
  318. script.Parent.Attack.Value = true
  319. else
  320. script.Parent.Attack.Value = false
  321. end
  322. end
  323. end
  324. return torso
  325. end
  326.  
  327. function Sit()
  328. if script.Parent.Zombie.Sit == true then
  329. script.Parent.Zombie.Jump = true
  330. print("Anti Seat Putter!!!")
  331. end
  332. end
  333.  
  334. script.Parent.Zombie.Changed:connect(Sit)
  335.  
  336. function touch(hit)
  337. if hit and hit.Parent then
  338. if hit.Parent.Name == "Ballista" or hit.Parent.Name == "Brotherhood Of Scythe" or hit.Parent.Name == "Jump" then
  339. script.Parent.Zombie.Jump = true
  340. end
  341. end
  342. end
  343.  
  344. script.Parent["Right Leg"].Touched:connect(touch)
  345.  
  346. script.Parent["Left Leg"].Touched:connect(touch)
  347.  
  348. while true do
  349. wait(1)
  350. local target = findNearestTorso(script.Parent.Torso.Position)
  351. if target ~= nil then
  352. rx = math.random(-3,3)
  353. ry = math.random(0,0)
  354. rz = math.random(-3,3)
  355. script.Parent.Zombie:MoveTo(target.Position+Vector3.new(rx,ry,rz), target)
  356. else
  357. script.Parent.Range.Value = false
  358. script.Parent.Attack.Value = false
  359. end
  360. end
  361.  
  362. end))
  363. BoolValue23.Name = "Range"
  364. BoolValue23.Parent = Model0
  365. Humanoid24.Name = "Zombie"
  366. Humanoid24.Parent = Model0
  367. Humanoid24.Health = 4752
  368. Humanoid24.LeftLeg = Part17
  369. Humanoid24.MaxHealth = 4752
  370. Humanoid24.NameOcclusion = Enum.NameOcclusion.NoOcclusion
  371. Humanoid24.RightLeg = Part19
  372. Humanoid24.Torso = Part5
  373. Humanoid24.WalkSpeed = 75
  374. Humanoid24.WalkToPart = nil
  375. Humanoid24.WalkToPoint = Vector3.new(0.999999106, -0.00134215667, -2)
  376. Humanoid24.maxHealth = 4752
  377. ObjectValue25.Name = "Target"
  378. ObjectValue25.Parent = Model0
  379. ObjectValue25.Value = nil
  380. Script26.Name = "Die"
  381. Script26.Parent = Model0
  382. table.insert(cors,sandbox(Script26,function()
  383. human = script.Parent.Zombie
  384. --tool = script.Parent.Pistol
  385.  
  386. function Die()
  387. --if tool ~= nil then tool:remove() end
  388. wait(2.5)
  389. script.Parent:remove()
  390. end
  391.  
  392. human.Died:connect(Die)
  393. end))
  394. Script27.Name = "ZombieScript"
  395. Script27.Parent = Model0
  396. table.insert(cors,sandbox(Script27,function()
  397. wait(1.5)
  398. local sp = script.Parent
  399. local Humanoid = sp:WaitForChild("Zombie")
  400. local Head = sp:WaitForChild("Head")
  401. local Torso = sp:WaitForChild("Torso")
  402. local Animation = script:WaitForChild("AttackAnim")
  403. local Yeti = Instance.new("Sound",Torso)
  404. Yeti.Volume = 1
  405. Yeti.SoundId = "http://www.roblox.com/asset/?id=38212101"
  406. Spawn(function() Yeti:Play() end)
  407. local Hit1 = Instance.new("Sound",Torso)
  408. Hit1.Volume = 1
  409. Hit1.SoundId = "http://www.roblox.com/asset/?id=2801263"
  410. local Hit2 = Instance.new("Sound",Torso)
  411. Hit2.Volume = 1
  412. Hit2.SoundId = "http://www.roblox.com/asset/?id=38212101"
  413.  
  414. local AttackEnabled = true
  415.  
  416. function wait(TimeToWait)
  417. if TimeToWait ~= nil then
  418. local TotalTime = 0
  419. TotalTime = TotalTime + game:GetService("RunService").Heartbeat:wait()
  420. while TotalTime < TimeToWait do
  421. TotalTime = TotalTime + game:GetService("RunService").Heartbeat:wait()
  422. end
  423. else
  424. game:GetService("RunService").Heartbeat:wait()
  425. end
  426. end
  427.  
  428. function DamageTag(parent,damage)
  429. local DmgTag = script.DamageTag:clone()
  430. DmgTag.Damage.Value = damage
  431. DmgTag.creator.Value = game.Players.LocalPlayer
  432. DmgTag.Disabled = false
  433. DmgTag.Parent = parent
  434. end
  435.  
  436. local Anim = Humanoid:LoadAnimation(Animation)
  437. function Hit(hit)
  438. local TargetHum = hit.Parent:FindFirstChild("Humanoid")
  439. if TargetHum ~= nil and TargetHum:IsA("Humanoid") and AttackEnabled == true and TargetHum ~= Humanoid then
  440. AttackEnabled = false
  441. Delay(0.5,function() AttackEnabled = true end)
  442. if Anim then Anim:Play(nil,nil,1.5) end
  443. DamageTag(TargetHum.Parent,125)
  444. Hit1:Play()
  445. Hit2:Play()
  446. end
  447. end
  448.  
  449. for _, Child in pairs(script.Parent:GetChildren()) do
  450. if Child:IsA("Part") or Child:IsA("WedgePart") or Child:IsA("CornerWedgePart") then
  451. Child.Touched:connect(Hit)
  452. end
  453. end
  454.  
  455. end))
  456. Script28.Name = "DamageTag"
  457. Script28.Parent = Script27
  458. table.insert(cors,sandbox(Script28,function()
  459. wait()
  460. h = script.Parent:findFirstChild("Humanoid")
  461. if h ~= nil then
  462. while h:findFirstChild("creator") do
  463. h.creator:Destroy()
  464. end
  465. tag = script.creator:clone()
  466. tag.Parent = h
  467. game.Debris:AddItem(tag,5)
  468. h:TakeDamage(script.Damage.Value)
  469. end
  470. script:remove()
  471. end))
  472. Script28.Disabled = true
  473. NumberValue29.Name = "Damage"
  474. NumberValue29.Parent = Script28
  475. ObjectValue30.Name = "creator"
  476. ObjectValue30.Parent = Script28
  477. Animation31.Name = "AttackAnim"
  478. Animation31.Parent = Script27
  479. Animation31.AnimationId = "http://www.roblox.com/Asset?ID=105211514"
  480. Script32.Name = "Animate"
  481. Script32.Parent = Model0
  482. table.insert(cors,sandbox(Script32,function()
  483. function waitForChild(parent, childName)
  484. local child = parent:findFirstChild(childName)
  485. if child then return child end
  486. while true do
  487. child = parent.ChildAdded:wait()
  488. if child.Name==childName then return child end
  489. end
  490. end
  491.  
  492. local Figure = script.Parent
  493. local Torso = waitForChild(Figure, "Torso")
  494. local RightShoulder = waitForChild(Torso, "Right Shoulder")
  495. local LeftShoulder = waitForChild(Torso, "Left Shoulder")
  496. local RightHip = waitForChild(Torso, "Right Hip")
  497. local LeftHip = waitForChild(Torso, "Left Hip")
  498. local Neck = waitForChild(Torso, "Neck")
  499. local Zombie = waitForChild(Figure, "Zombie")
  500. local pose = "Standing"
  501.  
  502. local currentAnim = ""
  503. local currentAnimInstance = nil
  504. local currentAnimTrack = nil
  505. local currentAnimKeyframeHandler = nil
  506. local currentAnimSpeed = 1.0
  507. local animTable = {}
  508. local animNames = {
  509. idle = {
  510. { id = "http://www.roblox.com/asset/?id=180435571", weight = 9 },
  511. { id = "http://www.roblox.com/asset/?id=180435792", weight = 1 }
  512. },
  513. walk = {
  514. { id = "http://www.roblox.com/asset/?id=180426354", weight = 10 }
  515. },
  516. run = {
  517. { id = "run.xml", weight = 10 }
  518. },
  519. jump = {
  520. { id = "http://www.roblox.com/asset/?id=125750702", weight = 10 }
  521. },
  522. fall = {
  523. { id = "http://www.roblox.com/asset/?id=305752857", weight = 10 }
  524. },
  525. climb = {
  526. { id = "http://www.roblox.com/asset/?id=180436334", weight = 10 }
  527. },
  528. sit = {
  529. { id = "http://www.roblox.com/asset/?id=178130996", weight = 10 }
  530. },
  531. toolnone = {
  532. { id = "http://www.roblox.com/asset/?id=182393478", weight = 10 }
  533. },
  534. toolslash = {
  535. { id = "http://www.roblox.com/asset/?id=129967390", weight = 10 }
  536. -- { id = "slash.xml", weight = 10 }
  537. },
  538. toollunge = {
  539. { id = "http://www.roblox.com/asset/?id=129967478", weight = 10 }
  540. },
  541. wave = {
  542. { id = "http://www.roblox.com/asset/?id=128777973", weight = 10 }
  543. },
  544. point = {
  545. { id = "http://www.roblox.com/asset/?id=128853357", weight = 10 }
  546. },
  547. dance = {
  548. { id = "http://www.roblox.com/asset/?id=182435998", weight = 10 },
  549. { id = "http://www.roblox.com/asset/?id=182491037", weight = 10 },
  550. { id = "http://www.roblox.com/asset/?id=182491065", weight = 10 }
  551. },
  552. dance2 = {
  553. { id = "http://www.roblox.com/asset/?id=182436842", weight = 10 },
  554. { id = "http://www.roblox.com/asset/?id=182491248", weight = 10 },
  555. { id = "http://www.roblox.com/asset/?id=182491277", weight = 10 }
  556. },
  557. dance3 = {
  558. { id = "http://www.roblox.com/asset/?id=182436935", weight = 10 },
  559. { id = "http://www.roblox.com/asset/?id=182491368", weight = 10 },
  560. { id = "http://www.roblox.com/asset/?id=182491423", weight = 10 }
  561. },
  562. laugh = {
  563. { id = "http://www.roblox.com/asset/?id=129423131", weight = 10 }
  564. },
  565. cheer = {
  566. { id = "http://www.roblox.com/asset/?id=129423030", weight = 10 }
  567. },
  568. }
  569.  
  570. -- Existance in this list signifies that it is an emote, the value indicates if it is a looping emote
  571. local emoteNames = { wave = false, point = false, dance = true, dance2 = true, dance3 = true, laugh = false, cheer = false}
  572.  
  573. math.randomseed(tick())
  574.  
  575. function configureAnimationSet(name, fileList)
  576. if (animTable[name] ~= nil) then
  577. for _, connection in pairs(animTable[name].connections) do
  578. connection:disconnect()
  579. end
  580. end
  581. animTable[name] = {}
  582. animTable[name].count = 0
  583. animTable[name].totalWeight = 0
  584. animTable[name].connections = {}
  585.  
  586. -- check for config values
  587. local config = script:FindFirstChild(name)
  588. if (config ~= nil) then
  589. -- print("Loading anims " .. name)
  590. table.insert(animTable[name].connections, config.ChildAdded:connect(function(child) configureAnimationSet(name, fileList) end))
  591. table.insert(animTable[name].connections, config.ChildRemoved:connect(function(child) configureAnimationSet(name, fileList) end))
  592. local idx = 1
  593. for _, childPart in pairs(config:GetChildren()) do
  594. if (childPart:IsA("Animation")) then
  595. table.insert(animTable[name].connections, childPart.Changed:connect(function(property) configureAnimationSet(name, fileList) end))
  596. animTable[name][idx] = {}
  597. animTable[name][idx].anim = childPart
  598. local weightObject = childPart:FindFirstChild("Weight")
  599. if (weightObject == nil) then
  600. animTable[name][idx].weight = 1
  601. else
  602. animTable[name][idx].weight = weightObject.Value
  603. end
  604. animTable[name].count = animTable[name].count + 1
  605. animTable[name].totalWeight = animTable[name].totalWeight + animTable[name][idx].weight
  606. -- print(name .. " [" .. idx .. "] " .. animTable[name][idx].anim.AnimationId .. " (" .. animTable[name][idx].weight .. ")")
  607. idx = idx + 1
  608. end
  609. end
  610. end
  611.  
  612. -- fallback to defaults
  613. if (animTable[name].count <= 0) then
  614. for idx, anim in pairs(fileList) do
  615. animTable[name][idx] = {}
  616. animTable[name][idx].anim = Instance.new("Animation")
  617. animTable[name][idx].anim.Name = name
  618. animTable[name][idx].anim.AnimationId = anim.id
  619. animTable[name][idx].weight = anim.weight
  620. animTable[name].count = animTable[name].count + 1
  621. animTable[name].totalWeight = animTable[name].totalWeight + anim.weight
  622. -- print(name .. " [" .. idx .. "] " .. anim.id .. " (" .. anim.weight .. ")")
  623. end
  624. end
  625. end
  626.  
  627. -- Setup animation objects
  628. function scriptChildModified(child)
  629. local fileList = animNames[child.Name]
  630. if (fileList ~= nil) then
  631. configureAnimationSet(child.Name, fileList)
  632. end
  633. end
  634.  
  635. script.ChildAdded:connect(scriptChildModified)
  636. script.ChildRemoved:connect(scriptChildModified)
  637.  
  638.  
  639. for name, fileList in pairs(animNames) do
  640. configureAnimationSet(name, fileList)
  641. end
  642.  
  643. -- ANIMATION
  644.  
  645. -- declarations
  646. local toolAnim = "None"
  647. local toolAnimTime = 0
  648.  
  649. local jumpAnimTime = 0
  650. local jumpAnimDuration = 0.3
  651.  
  652. local toolTransitionTime = 0.1
  653. local fallTransitionTime = 0.3
  654. local jumpMaxLimbVelocity = 0.75
  655.  
  656. -- functions
  657.  
  658. function stopAllAnimations()
  659. local oldAnim = currentAnim
  660.  
  661. -- return to idle if finishing an emote
  662. if (emoteNames[oldAnim] ~= nil and emoteNames[oldAnim] == false) then
  663. oldAnim = "idle"
  664. end
  665.  
  666. currentAnim = ""
  667. currentAnimInstance = nil
  668. if (currentAnimKeyframeHandler ~= nil) then
  669. currentAnimKeyframeHandler:disconnect()
  670. end
  671.  
  672. if (currentAnimTrack ~= nil) then
  673. currentAnimTrack:Stop()
  674. currentAnimTrack:Destroy()
  675. currentAnimTrack = nil
  676. end
  677. return oldAnim
  678. end
  679.  
  680. function setAnimationSpeed(speed)
  681. if speed ~= currentAnimSpeed then
  682. currentAnimSpeed = speed
  683. currentAnimTrack:AdjustSpeed(currentAnimSpeed)
  684. end
  685. end
  686.  
  687. function keyFrameReachedFunc(frameName)
  688. if (frameName == "End") then
  689.  
  690. local repeatAnim = currentAnim
  691. -- return to idle if finishing an emote
  692. if (emoteNames[repeatAnim] ~= nil and emoteNames[repeatAnim] == false) then
  693. repeatAnim = "idle"
  694. end
  695.  
  696. local animSpeed = currentAnimSpeed
  697. playAnimation(repeatAnim, 0.0, Zombie)
  698. setAnimationSpeed(animSpeed)
  699. end
  700. end
  701.  
  702. -- Preload animations
  703. function playAnimation(animName, transitionTime, Zombie)
  704.  
  705. local roll = math.random(1, animTable[animName].totalWeight)
  706. local origRoll = roll
  707. local idx = 1
  708. while (roll > animTable[animName][idx].weight) do
  709. roll = roll - animTable[animName][idx].weight
  710. idx = idx + 1
  711. end
  712. -- print(animName .. " " .. idx .. " [" .. origRoll .. "]")
  713. local anim = animTable[animName][idx].anim
  714.  
  715. -- switch animation
  716. if (anim ~= currentAnimInstance) then
  717.  
  718. if (currentAnimTrack ~= nil) then
  719. currentAnimTrack:Stop(transitionTime)
  720. currentAnimTrack:Destroy()
  721. end
  722.  
  723. currentAnimSpeed = 1.0
  724.  
  725. -- load it to the Zombie; get AnimationTrack
  726. currentAnimTrack = Zombie:LoadAnimation(anim)
  727.  
  728. -- play the animation
  729. currentAnimTrack:Play(transitionTime)
  730. currentAnim = animName
  731. currentAnimInstance = anim
  732.  
  733. -- set up keyframe name triggers
  734. if (currentAnimKeyframeHandler ~= nil) then
  735. currentAnimKeyframeHandler:disconnect()
  736. end
  737. currentAnimKeyframeHandler = currentAnimTrack.KeyframeReached:connect(keyFrameReachedFunc)
  738.  
  739. end
  740.  
  741. end
  742.  
  743. -------------------------------------------------------------------------------------------
  744. -------------------------------------------------------------------------------------------
  745.  
  746. local toolAnimName = ""
  747. local toolAnimTrack = nil
  748. local toolAnimInstance = nil
  749. local currentToolAnimKeyframeHandler = nil
  750.  
  751. function toolKeyFrameReachedFunc(frameName)
  752. if (frameName == "End") then
  753. -- print("Keyframe : ".. frameName)
  754. playToolAnimation(toolAnimName, 0.0, Zombie)
  755. end
  756. end
  757.  
  758.  
  759. function playToolAnimation(animName, transitionTime, Zombie)
  760.  
  761. local roll = math.random(1, animTable[animName].totalWeight)
  762. local origRoll = roll
  763. local idx = 1
  764. while (roll > animTable[animName][idx].weight) do
  765. roll = roll - animTable[animName][idx].weight
  766. idx = idx + 1
  767. end
  768. -- print(animName .. " * " .. idx .. " [" .. origRoll .. "]")
  769. local anim = animTable[animName][idx].anim
  770.  
  771. if (toolAnimInstance ~= anim) then
  772.  
  773. if (toolAnimTrack ~= nil) then
  774. toolAnimTrack:Stop()
  775. toolAnimTrack:Destroy()
  776. transitionTime = 0
  777. end
  778.  
  779. -- load it to the Zombie; get AnimationTrack
  780. toolAnimTrack = Zombie:LoadAnimation(anim)
  781.  
  782. -- play the animation
  783. toolAnimTrack:Play(transitionTime)
  784. toolAnimName = animName
  785. toolAnimInstance = anim
  786.  
  787. currentToolAnimKeyframeHandler = toolAnimTrack.KeyframeReached:connect(toolKeyFrameReachedFunc)
  788. end
  789. end
  790.  
  791. function stopToolAnimations()
  792. local oldAnim = toolAnimName
  793.  
  794. if (currentToolAnimKeyframeHandler ~= nil) then
  795. currentToolAnimKeyframeHandler:disconnect()
  796. end
  797.  
  798. toolAnimName = ""
  799. toolAnimInstance = nil
  800. if (toolAnimTrack ~= nil) then
  801. toolAnimTrack:Stop()
  802. toolAnimTrack:Destroy()
  803. toolAnimTrack = nil
  804. end
  805.  
  806.  
  807. return oldAnim
  808. end
  809.  
  810. -------------------------------------------------------------------------------------------
  811. -------------------------------------------------------------------------------------------
  812.  
  813.  
  814. function onRunning(speed)
  815. if speed>0.01 then
  816. playAnimation("walk", 0.1, Zombie)
  817. if currentAnimInstance and currentAnimInstance.AnimationId == "http://www.roblox.com/asset/?id=180426354" then
  818. setAnimationSpeed(speed / 14.5)
  819. end
  820. pose = "Running"
  821. else
  822. playAnimation("idle", 0.1, Zombie)
  823. pose = "Standing"
  824. end
  825. end
  826.  
  827. function onDied()
  828. pose = "Dead"
  829. end
  830.  
  831. function onJumping()
  832. playAnimation("jump", 0.1, Zombie)
  833. jumpAnimTime = jumpAnimDuration
  834. pose = "Jumping"
  835. end
  836.  
  837. function onClimbing(speed)
  838. playAnimation("climb", 0.1, Zombie)
  839. setAnimationSpeed(speed / 12.0)
  840. pose = "Climbing"
  841. end
  842.  
  843. function onGettingUp()
  844. pose = "GettingUp"
  845. end
  846.  
  847. function onFreeFall()
  848. if (jumpAnimTime <= 0) then
  849. playAnimation("fall", fallTransitionTime, Zombie)
  850. end
  851. pose = "FreeFall"
  852. end
  853.  
  854. function onFallingDown()
  855. pose = "FallingDown"
  856. end
  857.  
  858. function onSeated()
  859. pose = "Seated"
  860. end
  861.  
  862. function onPlatformStanding()
  863. pose = "PlatformStanding"
  864. end
  865.  
  866. function onSwimming(speed)
  867. if speed>0 then
  868. pose = "Running"
  869. else
  870. pose = "Standing"
  871. end
  872. end
  873.  
  874. function getTool()
  875. for _, kid in ipairs(Figure:GetChildren()) do
  876. if kid.className == "Tool" then return kid end
  877. end
  878. return nil
  879. end
  880.  
  881. function getToolAnim(tool)
  882. for _, c in ipairs(tool:GetChildren()) do
  883. if c.Name == "toolanim" and c.className == "StringValue" then
  884. return c
  885. end
  886. end
  887. return nil
  888. end
  889.  
  890. function animateTool()
  891.  
  892. if (toolAnim == "None") then
  893. playToolAnimation("toolnone", toolTransitionTime, Zombie)
  894. return
  895. end
  896.  
  897. if (toolAnim == "Slash") then
  898. playToolAnimation("toolslash", 0, Zombie)
  899. return
  900. end
  901.  
  902. if (toolAnim == "Lunge") then
  903. playToolAnimation("toollunge", 0, Zombie)
  904. return
  905. end
  906. end
  907.  
  908. function moveSit()
  909. RightShoulder.MaxVelocity = 0.15
  910. LeftShoulder.MaxVelocity = 0.15
  911. RightShoulder:SetDesiredAngle(3.14 /2)
  912. LeftShoulder:SetDesiredAngle(-3.14 /2)
  913. RightHip:SetDesiredAngle(3.14 /2)
  914. LeftHip:SetDesiredAngle(-3.14 /2)
  915. end
  916.  
  917. local lastTick = 0
  918.  
  919. function move(time)
  920. local amplitude = 1
  921. local frequency = 1
  922. local deltaTime = time - lastTick
  923. lastTick = time
  924.  
  925. local climbFudge = 0
  926. local setAngles = false
  927.  
  928. if (jumpAnimTime > 0) then
  929. jumpAnimTime = jumpAnimTime - deltaTime
  930. end
  931.  
  932. if (pose == "FreeFall" and jumpAnimTime <= 0) then
  933. playAnimation("fall", fallTransitionTime, Zombie)
  934. elseif (pose == "Seated") then
  935. playAnimation("sit", 0.5, Zombie)
  936. return
  937. elseif (pose == "Running") then
  938. playAnimation("walk", 0.1, Zombie)
  939. elseif (pose == "Dead" or pose == "GettingUp" or pose == "FallingDown" or pose == "Seated" or pose == "PlatformStanding") then
  940. -- print("Wha " .. pose)
  941. stopAllAnimations()
  942. amplitude = 0.1
  943. frequency = 1
  944. setAngles = true
  945. end
  946.  
  947. if (setAngles) then
  948. desiredAngle = amplitude * math.sin(time * frequency)
  949.  
  950. RightShoulder:SetDesiredAngle(desiredAngle + climbFudge)
  951. LeftShoulder:SetDesiredAngle(desiredAngle - climbFudge)
  952. RightHip:SetDesiredAngle(-desiredAngle)
  953. LeftHip:SetDesiredAngle(-desiredAngle)
  954. end
  955.  
  956. -- Tool Animation handling
  957. local tool = getTool()
  958. if tool and tool:FindFirstChild("Handle") then
  959.  
  960. animStringValueObject = getToolAnim(tool)
  961.  
  962. if animStringValueObject then
  963. toolAnim = animStringValueObject.Value
  964. -- message recieved, delete StringValue
  965. animStringValueObject.Parent = nil
  966. toolAnimTime = time + .3
  967. end
  968.  
  969. if time > toolAnimTime then
  970. toolAnimTime = 0
  971. toolAnim = "None"
  972. end
  973.  
  974. animateTool()
  975. else
  976. stopToolAnimations()
  977. toolAnim = "None"
  978. toolAnimInstance = nil
  979. toolAnimTime = 0
  980. end
  981. end
  982.  
  983. -- connect events
  984. Zombie.Died:connect(onDied)
  985. Zombie.Running:connect(onRunning)
  986. Zombie.Jumping:connect(onJumping)
  987. Zombie.Climbing:connect(onClimbing)
  988. Zombie.GettingUp:connect(onGettingUp)
  989. Zombie.FreeFalling:connect(onFreeFall)
  990. Zombie.FallingDown:connect(onFallingDown)
  991. Zombie.Seated:connect(onSeated)
  992. Zombie.PlatformStanding:connect(onPlatformStanding)
  993. Zombie.Swimming:connect(onSwimming)
  994.  
  995. -- setup emote chat hook
  996. Game.Players.LocalPlayer.Chatted:connect(function(msg)
  997. local emote = ""
  998. if (string.sub(msg, 1, 3) == "/e ") then
  999. emote = string.sub(msg, 4)
  1000. elseif (string.sub(msg, 1, 7) == "/emote ") then
  1001. emote = string.sub(msg, 8)
  1002. end
  1003.  
  1004. if (pose == "Standing" and emoteNames[emote] ~= nil) then
  1005. playAnimation(emote, 0.1, Zombie)
  1006. end
  1007.  
  1008. end)
  1009.  
  1010.  
  1011. -- main program
  1012.  
  1013. local runService = game:service("RunService");
  1014.  
  1015. -- initialize to idle
  1016. playAnimation("idle", 0.1, Zombie)
  1017. pose = "Standing"
  1018.  
  1019. while Figure.Parent~=nil do
  1020. local _, time = wait(0.1)
  1021. move(time)
  1022. end
  1023.  
  1024.  
  1025.  
  1026.  
  1027. end))
  1028. StringValue33.Name = "climb"
  1029. StringValue33.Parent = Script32
  1030. Animation34.Name = "ClimbAnim"
  1031. Animation34.Parent = StringValue33
  1032. Animation34.AnimationId = "http://www.roblox.com/asset/?id=180436334"
  1033. StringValue35.Name = "fall"
  1034. StringValue35.Parent = Script32
  1035. Animation36.Name = "FallAnim"
  1036. Animation36.Parent = StringValue35
  1037. Animation36.AnimationId = "http://www.roblox.com/asset/?id=180436148"
  1038. StringValue37.Name = "idle"
  1039. StringValue37.Parent = Script32
  1040. Animation38.Name = "Animation1"
  1041. Animation38.Parent = StringValue37
  1042. Animation38.AnimationId = "http://www.roblox.com/asset/?id=180435571"
  1043. NumberValue39.Name = "Weight"
  1044. NumberValue39.Parent = Animation38
  1045. NumberValue39.Value = 9
  1046. Animation40.Name = "Animation2"
  1047. Animation40.Parent = StringValue37
  1048. Animation40.AnimationId = "http://www.roblox.com/asset/?id=180435792"
  1049. NumberValue41.Name = "Weight"
  1050. NumberValue41.Parent = Animation40
  1051. NumberValue41.Value = 1
  1052. StringValue42.Name = "jump"
  1053. StringValue42.Parent = Script32
  1054. Animation43.Name = "JumpAnim"
  1055. Animation43.Parent = StringValue42
  1056. Animation43.AnimationId = "http://www.roblox.com/asset/?id=125750702"
  1057. StringValue44.Name = "run"
  1058. StringValue44.Parent = Script32
  1059. Animation45.Name = "RunAnim"
  1060. Animation45.Parent = StringValue44
  1061. Animation45.AnimationId = "http://www.roblox.com/asset/?id=180426354"
  1062. StringValue46.Name = "sit"
  1063. StringValue46.Parent = Script32
  1064. Animation47.Name = "SitAnim"
  1065. Animation47.Parent = StringValue46
  1066. Animation47.AnimationId = "http://www.roblox.com/asset/?id=178130996"
  1067. StringValue48.Name = "toolnone"
  1068. StringValue48.Parent = Script32
  1069. Animation49.Name = "ToolNoneAnim"
  1070. Animation49.Parent = StringValue48
  1071. Animation49.AnimationId = "http://www.roblox.com/asset/?id=182393478"
  1072. StringValue50.Name = "walk"
  1073. StringValue50.Parent = Script32
  1074. Animation51.Name = "WalkAnim"
  1075. Animation51.Parent = StringValue50
  1076. Animation51.AnimationId = "http://www.roblox.com/asset/?id=180426354"
  1077. Pants52.Name = "Pants"
  1078. Pants52.Parent = Model0
  1079. Pants52.PantsTemplate = "rbxassetid://949284975"
  1080. Shirt53.Name = "Shirt"
  1081. Shirt53.Parent = Model0
  1082. Shirt53.ShirtTemplate = "rbxassetid://573188703"
  1083. for i,v in pairs(mas:GetChildren()) do
  1084. v.Parent = script
  1085. pcall(function() v:MakeJoints() end)
  1086. end
  1087. mas:Destroy()
  1088. for i,v in pairs(cors) do
  1089. spawn(function()
  1090. pcall(v)
  1091. end)
  1092. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement