sawgamer1

Untitled

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