Advertisement
Gametoy

zame

Apr 20th, 2018
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 146.52 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. Model1 = Instance.new("Model")
  21. Script2 = Instance.new("Script")
  22. LocalScript3 = Instance.new("LocalScript")
  23. ObjectValue4 = Instance.new("ObjectValue")
  24. Script5 = Instance.new("Script")
  25. Script6 = Instance.new("Script")
  26. Script7 = Instance.new("Script")
  27. Script8 = Instance.new("Script")
  28. Animation9 = Instance.new("Animation")
  29. BodyColors10 = Instance.new("BodyColors")
  30. BrickColorValue11 = Instance.new("BrickColorValue")
  31. Script12 = Instance.new("Script")
  32. Humanoid13 = Instance.new("Humanoid")
  33. Script14 = Instance.new("Script")
  34. Script15 = Instance.new("Script")
  35. StringValue16 = Instance.new("StringValue")
  36. Animation17 = Instance.new("Animation")
  37. StringValue18 = Instance.new("StringValue")
  38. Animation19 = Instance.new("Animation")
  39. StringValue20 = Instance.new("StringValue")
  40. Animation21 = Instance.new("Animation")
  41. NumberValue22 = Instance.new("NumberValue")
  42. Animation23 = Instance.new("Animation")
  43. NumberValue24 = Instance.new("NumberValue")
  44. StringValue25 = Instance.new("StringValue")
  45. Animation26 = Instance.new("Animation")
  46. StringValue27 = Instance.new("StringValue")
  47. Animation28 = Instance.new("Animation")
  48. StringValue29 = Instance.new("StringValue")
  49. Animation30 = Instance.new("Animation")
  50. StringValue31 = Instance.new("StringValue")
  51. Animation32 = Instance.new("Animation")
  52. Part33 = Instance.new("Part")
  53. SpecialMesh34 = Instance.new("SpecialMesh")
  54. Decal35 = Instance.new("Decal")
  55. Part36 = Instance.new("Part")
  56. Part37 = Instance.new("Part")
  57. Part38 = Instance.new("Part")
  58. Part39 = Instance.new("Part")
  59. Part40 = Instance.new("Part")
  60. Sound41 = Instance.new("Sound")
  61. Motor6D42 = Instance.new("Motor6D")
  62. Motor6D43 = Instance.new("Motor6D")
  63. Motor6D44 = Instance.new("Motor6D")
  64. Motor6D45 = Instance.new("Motor6D")
  65. Motor6D46 = Instance.new("Motor6D")
  66. Part47 = Instance.new("Part")
  67. Motor6D48 = Instance.new("Motor6D")
  68. Script49 = Instance.new("Script")
  69. Part50 = Instance.new("Part")
  70. Decal51 = Instance.new("Decal")
  71. Script52 = Instance.new("Script")
  72. ManualWeld53 = Instance.new("ManualWeld")
  73. Model54 = Instance.new("Model")
  74. Model55 = Instance.new("Model")
  75. Script56 = Instance.new("Script")
  76. LocalScript57 = Instance.new("LocalScript")
  77. ObjectValue58 = Instance.new("ObjectValue")
  78. Script59 = Instance.new("Script")
  79. Script60 = Instance.new("Script")
  80. Script61 = Instance.new("Script")
  81. Script62 = Instance.new("Script")
  82. Animation63 = Instance.new("Animation")
  83. BodyColors64 = Instance.new("BodyColors")
  84. BrickColorValue65 = Instance.new("BrickColorValue")
  85. Script66 = Instance.new("Script")
  86. Humanoid67 = Instance.new("Humanoid")
  87. Script68 = Instance.new("Script")
  88. Script69 = Instance.new("Script")
  89. StringValue70 = Instance.new("StringValue")
  90. Animation71 = Instance.new("Animation")
  91. StringValue72 = Instance.new("StringValue")
  92. Animation73 = Instance.new("Animation")
  93. StringValue74 = Instance.new("StringValue")
  94. Animation75 = Instance.new("Animation")
  95. NumberValue76 = Instance.new("NumberValue")
  96. Animation77 = Instance.new("Animation")
  97. NumberValue78 = Instance.new("NumberValue")
  98. StringValue79 = Instance.new("StringValue")
  99. Animation80 = Instance.new("Animation")
  100. StringValue81 = Instance.new("StringValue")
  101. Animation82 = Instance.new("Animation")
  102. StringValue83 = Instance.new("StringValue")
  103. Animation84 = Instance.new("Animation")
  104. StringValue85 = Instance.new("StringValue")
  105. Animation86 = Instance.new("Animation")
  106. Part87 = Instance.new("Part")
  107. SpecialMesh88 = Instance.new("SpecialMesh")
  108. Decal89 = Instance.new("Decal")
  109. Part90 = Instance.new("Part")
  110. Part91 = Instance.new("Part")
  111. Part92 = Instance.new("Part")
  112. Part93 = Instance.new("Part")
  113. Part94 = Instance.new("Part")
  114. Sound95 = Instance.new("Sound")
  115. Motor6D96 = Instance.new("Motor6D")
  116. Motor6D97 = Instance.new("Motor6D")
  117. Motor6D98 = Instance.new("Motor6D")
  118. Motor6D99 = Instance.new("Motor6D")
  119. Motor6D100 = Instance.new("Motor6D")
  120. Part101 = Instance.new("Part")
  121. Motor6D102 = Instance.new("Motor6D")
  122. Script103 = Instance.new("Script")
  123. Part104 = Instance.new("Part")
  124. Decal105 = Instance.new("Decal")
  125. Script106 = Instance.new("Script")
  126. ManualWeld107 = Instance.new("ManualWeld")
  127. Model108 = Instance.new("Model")
  128. Model109 = Instance.new("Model")
  129. Script110 = Instance.new("Script")
  130. LocalScript111 = Instance.new("LocalScript")
  131. ObjectValue112 = Instance.new("ObjectValue")
  132. Script113 = Instance.new("Script")
  133. Script114 = Instance.new("Script")
  134. Script115 = Instance.new("Script")
  135. Script116 = Instance.new("Script")
  136. Animation117 = Instance.new("Animation")
  137. BodyColors118 = Instance.new("BodyColors")
  138. BrickColorValue119 = Instance.new("BrickColorValue")
  139. Script120 = Instance.new("Script")
  140. Humanoid121 = Instance.new("Humanoid")
  141. Script122 = Instance.new("Script")
  142. Script123 = Instance.new("Script")
  143. StringValue124 = Instance.new("StringValue")
  144. Animation125 = Instance.new("Animation")
  145. StringValue126 = Instance.new("StringValue")
  146. Animation127 = Instance.new("Animation")
  147. StringValue128 = Instance.new("StringValue")
  148. Animation129 = Instance.new("Animation")
  149. NumberValue130 = Instance.new("NumberValue")
  150. Animation131 = Instance.new("Animation")
  151. NumberValue132 = Instance.new("NumberValue")
  152. StringValue133 = Instance.new("StringValue")
  153. Animation134 = Instance.new("Animation")
  154. StringValue135 = Instance.new("StringValue")
  155. Animation136 = Instance.new("Animation")
  156. StringValue137 = Instance.new("StringValue")
  157. Animation138 = Instance.new("Animation")
  158. StringValue139 = Instance.new("StringValue")
  159. Animation140 = Instance.new("Animation")
  160. Part141 = Instance.new("Part")
  161. SpecialMesh142 = Instance.new("SpecialMesh")
  162. Decal143 = Instance.new("Decal")
  163. Part144 = Instance.new("Part")
  164. Part145 = Instance.new("Part")
  165. Part146 = Instance.new("Part")
  166. Part147 = Instance.new("Part")
  167. Part148 = Instance.new("Part")
  168. Sound149 = Instance.new("Sound")
  169. Motor6D150 = Instance.new("Motor6D")
  170. Motor6D151 = Instance.new("Motor6D")
  171. Motor6D152 = Instance.new("Motor6D")
  172. Motor6D153 = Instance.new("Motor6D")
  173. Motor6D154 = Instance.new("Motor6D")
  174. Part155 = Instance.new("Part")
  175. Motor6D156 = Instance.new("Motor6D")
  176. Script157 = Instance.new("Script")
  177. Part158 = Instance.new("Part")
  178. Decal159 = Instance.new("Decal")
  179. Script160 = Instance.new("Script")
  180. ManualWeld161 = Instance.new("ManualWeld")
  181. Model0.Parent = mas
  182. Model1.Name = "Zombie"
  183. Model1.Parent = Model0
  184. Script2.Name = "Ragdoller"
  185. Script2.Parent = Model1
  186. table.insert(cors,sandbox(Script2,function()
  187. print("Ragdoll script activated")
  188. Gibs = game.Workspace
  189.  
  190. function getKillerOfHumanoidIfStillInGame(humanoid)
  191. local tag = humanoid:findFirstChild("creator")
  192. if tag ~= nil then
  193. local killer = tag.Value
  194. if killer.Parent ~= nil then
  195. return killer
  196. end
  197. end
  198. return nil
  199. end
  200.  
  201. function OnDeath(Character)
  202. local svch = Character
  203. local hum = Character:findFirstChild("Humanoid")
  204. local getkiller = getKillerOfHumanoidIfStillInGame(hum)
  205. Character.Archivable = true
  206. local chrclone = Character:clone()
  207. Character.Archivable = false
  208.  
  209. local ch = chrclone:GetChildren()
  210. local i
  211. for i = 1,#ch do
  212. if ch[i].Name == "THandle1" or ch[i].Name == "THandle2" or ch[i].ClassName == "Script" then
  213. ch[i]:remove()
  214. end
  215. end
  216. local function Scan(ch)
  217. local e
  218. for e = 1,#ch do
  219. Scan(ch[e]:GetChildren())
  220. if ch[e].ClassName == "Weld" or ch[e].ClassName == "Motor6D" then
  221. ch[e]:remove()
  222. end
  223. end
  224. end
  225. Scan(chrclone:GetChildren())
  226.  
  227. local hum2 = chrclone:findFirstChild("Humanoid")
  228.  
  229.  
  230. if hum2 ~= nil then
  231. hum2.Name = "Humanoid2"
  232. hum2.PlatformStand = true
  233. hum2.Sit = true
  234. hum2.MaxHealth = 0
  235. hum2.Health = 0
  236. end
  237.  
  238. local ch = Character:GetChildren()
  239. local i
  240. for i = 1,#ch do
  241. if ch[i].Name == "THandle1" or ch[i].Name == "THandle2" then
  242. ch[i]:remove()
  243. end
  244. end
  245.  
  246. wait(0.2)
  247.  
  248. local ch = Character:GetChildren()
  249. local i
  250. for i = 1,#ch do
  251. if ch[i].ClassName == "Part" or ch[i].ClassName == "Hat" or ch[i].Name == "THandle1" or ch[i].Name == "THandle2" then
  252. ch[i]:remove()
  253. end
  254. end
  255. Character = chrclone
  256. local Torso = Character.Torso
  257. local movevector = Vector3.new()
  258.  
  259. if Torso then
  260. if getkiller ~= nil then
  261. if getkiller.Character ~= nil then
  262. local killtors = getkiller.Character:findFirstChild("Torso")
  263. if killtors ~= nil then
  264. movevector = CFrame.new(killtors.Position,Torso.Position).lookVector
  265. end
  266. end
  267. end
  268. local Head = Character:FindFirstChild("Head")
  269. if Head then
  270. local Neck = Instance.new("Weld")
  271. Neck.Name = "Neck"
  272. Neck.Part0 = Torso
  273. Neck.Part1 = Head
  274. Neck.C0 = CFrame.new(0, 1.5, 0)
  275. Neck.C1 = CFrame.new()
  276. Neck.Parent = Torso
  277.  
  278. local nsc = script.CamAttach:clone()
  279. nsc.CamPart.Value = hum2.Parent.Head
  280. nsc.Disabled = false
  281. nsc.Parent = svch
  282. end
  283. local Limb = Character:FindFirstChild("Right Arm")
  284. if Limb then
  285.  
  286. Limb.CFrame = Torso.CFrame * CFrame.new(1.5, 0, 0)
  287. local Joint = Instance.new("Glue")
  288. Joint.Name = "RightShoulder"
  289. Joint.Part0 = Torso
  290. Joint.Part1 = Limb
  291. Joint.C0 = CFrame.new(1.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  292. Joint.C1 = CFrame.new(-0, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  293. Joint.Parent = Torso
  294.  
  295. local B = Instance.new("Part")
  296. B.TopSurface = 0
  297. B.BottomSurface = 0
  298. B.formFactor = "Symmetric"
  299. B.Size = Vector3.new(1, 1, 1)
  300. B.Transparency = 1
  301. B.CFrame = Limb.CFrame * CFrame.new(0, -0.5, 0)
  302. B.Parent = Character
  303. local W = Instance.new("Weld")
  304. W.Part0 = Limb
  305. W.Part1 = B
  306. W.C0 = CFrame.new(0, -0.5, 0)
  307. W.Parent = Limb
  308.  
  309. end
  310. local Limb = Character:FindFirstChild("Left Arm")
  311. if Limb then
  312.  
  313. Limb.CFrame = Torso.CFrame * CFrame.new(-1.5, 0, 0)
  314. local Joint = Instance.new("Glue")
  315. Joint.Name = "LeftShoulder"
  316. Joint.Part0 = Torso
  317. Joint.Part1 = Limb
  318. Joint.C0 = CFrame.new(-1.5, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  319. Joint.C1 = CFrame.new(0, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  320. Joint.Parent = Torso
  321.  
  322. local B = Instance.new("Part")
  323. B.TopSurface = 0
  324. B.BottomSurface = 0
  325. B.formFactor = "Symmetric"
  326. B.Size = Vector3.new(1, 1, 1)
  327. B.Transparency = 1
  328. B.CFrame = Limb.CFrame * CFrame.new(0, -0.5, 0)
  329. B.Parent = Character
  330. local W = Instance.new("Weld")
  331. W.Part0 = Limb
  332. W.Part1 = B
  333. W.C0 = CFrame.new(0, -0.5, 0)
  334. W.Parent = Limb
  335.  
  336. end
  337. local Limb = Character:FindFirstChild("Right Leg")
  338. if Limb then
  339.  
  340. Limb.CFrame = Torso.CFrame * CFrame.new(0.5, -2, 0)
  341. local Joint = Instance.new("Glue")
  342. Joint.Name = "RightHip"
  343. Joint.Part0 = Torso
  344. Joint.Part1 = Limb
  345. Joint.C0 = CFrame.new(0.5, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  346. Joint.C1 = CFrame.new(0, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  347. Joint.Parent = Torso
  348.  
  349. local B = Instance.new("Part")
  350. B.TopSurface = 0
  351. B.BottomSurface = 0
  352. B.formFactor = "Symmetric"
  353. B.Size = Vector3.new(1, 1, 1)
  354. B.Transparency = 1
  355. B.CFrame = Limb.CFrame * CFrame.new(0, -0.5, 0)
  356. B.Parent = Character
  357. local W = Instance.new("Weld")
  358. W.Part0 = Limb
  359. W.Part1 = B
  360. W.C0 = CFrame.new(0, -0.5, 0)
  361. W.Parent = Limb
  362.  
  363. end
  364. local Limb = Character:FindFirstChild("Left Leg")
  365. if Limb then
  366.  
  367. Limb.CFrame = Torso.CFrame * CFrame.new(-0.5, -2, 0)
  368. local Joint = Instance.new("Glue")
  369. Joint.Name = "LeftHip"
  370. Joint.Part0 = Torso
  371. Joint.Part1 = Limb
  372. Joint.C0 = CFrame.new(-0.5, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  373. Joint.C1 = CFrame.new(-0, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  374. Joint.Parent = Torso
  375.  
  376. local B = Instance.new("Part")
  377. B.TopSurface = 0
  378. B.BottomSurface = 0
  379. B.formFactor = "Symmetric"
  380. B.Size = Vector3.new(1, 1, 1)
  381. B.Transparency = 1
  382. B.CFrame = Limb.CFrame * CFrame.new(0, -0.5, 0)
  383. B.Parent = Character
  384. local W = Instance.new("Weld")
  385. W.Part0 = Limb
  386. W.Part1 = B
  387. W.C0 = CFrame.new(0, -0.5, 0)
  388. W.Parent = Limb
  389.  
  390. end
  391. --[
  392. local Bar = Instance.new("Part")
  393. Bar.TopSurface = 0
  394. Bar.BottomSurface = 0
  395. Bar.formFactor = "Symmetric"
  396. Bar.Size = Vector3.new(1, 1, 1)
  397. Bar.Transparency = 1
  398. Bar.CFrame = Torso.CFrame * CFrame.new(0, 0.5, 0)
  399. Bar.Parent = Character
  400. local Weld = Instance.new("Weld")
  401. Weld.Part0 = Torso
  402. Weld.Part1 = Bar
  403. Weld.C0 = CFrame.new(0, 0.5, 0)
  404. Weld.Parent = Torso
  405. --]]
  406. end
  407. Character.Parent = Gibs
  408. game.Debris:AddItem(Character, 12)
  409. if movevector ~= Vector3.new() then
  410. for i = 1,10 do
  411. wait()
  412. Torso.Velocity = movevector * 30
  413. end
  414. end
  415. end
  416.  
  417. script.Parent.Humanoid.Died:connect(function()
  418. OnDeath(script.Parent)
  419. end)
  420.  
  421.  
  422. end))
  423. LocalScript3.Name = "CamAttach"
  424. LocalScript3.Parent = Script2
  425. LocalScript3.Disabled = true
  426. table.insert(cors,sandbox(LocalScript3,function()
  427. wait()
  428. game.Workspace.CurrentCamera.CameraSubject = script.CamPart.Value
  429. end))
  430. ObjectValue4.Name = "CamPart"
  431. ObjectValue4.Parent = LocalScript3
  432. Script5.Name = "ZombieScript"
  433. Script5.Parent = Model1
  434. table.insert(cors,sandbox(Script5,function()
  435. wait()
  436. -- Handles damage, sounds
  437.  
  438. local hum = script.Parent:FindFirstChild("Humanoid")
  439. local torso = script.Parent:FindFirstChild("HumanoidRootPart")
  440. local head = script.Parent:FindFirstChild("Head")
  441.  
  442. DB = false
  443. local function onTouch(hit)
  444. if DB then return end
  445. if hit == nil then return end
  446. if hit.Parent == nil then return end
  447. local vhum = hit.Parent:FindFirstChild("Humanoid")
  448. if vhum ~= nil then
  449. if hum.Health <= 0 then return end
  450. if vhum ~= hum and not hit.Parent:FindFirstChild("ZombieScript") then -- keeps it from hurting itself/ zombies
  451. vhum:TakeDamage(math.random(6, 9))
  452. DB = true
  453. wait(1)
  454. DB = false
  455. end
  456. end
  457. end
  458. torso.Touched:connect(onTouch)
  459.  
  460. local zombienoises = {93591696, 208668860, 179266532, 229895387, 150076506}
  461. local moan = head:FindFirstChild("Moan")
  462.  
  463. while head ~= nil do
  464. wait(math.random(6, 13))
  465. moan.Pitch = math.random(8, 10)/10
  466. moan.SoundId = "rbxassetid://"..tostring(zombienoises[math.random(1, #zombienoises)])
  467. moan:Play()
  468. end
  469.  
  470. end))
  471. Script6.Name = "Follow"
  472. Script6.Parent = Model1
  473. table.insert(cors,sandbox(Script6,function()
  474. wait()
  475. local hum = script.Parent:FindFirstChild("Humanoid")
  476. local torso = script.Parent:FindFirstChild("HumanoidRootPart")
  477.  
  478. local max_dist = 200
  479.  
  480. function findNearestTorso()
  481. for _, player in pairs(game.Players:GetPlayers()) do
  482. if player.Character ~= nil then
  483. local target_torso = player.Character:FindFirstChild("HumanoidRootPart")
  484. if target_torso ~= nil then
  485. if (target_torso.Position - torso.Position).magnitude < max_dist then
  486. return target_torso
  487. end
  488. end
  489. end
  490. end
  491. end
  492.  
  493. local old_pos = torso.Position
  494.  
  495. wait(math.random(0, 90)/100)
  496.  
  497. while hum ~= nil do
  498. local target = findNearestTorso()
  499. if target ~= nil then
  500. while target ~= nil and target.Parent ~= nil and hum ~= nil do
  501. if (target.Position - torso.Position).magnitude < max_dist then
  502. hum:MoveTo(target.Position, target)
  503. if target.Position.Y > torso.Position.Y + 3 then
  504. hum.Jump = true
  505. end
  506. if (old_pos - torso.Position).magnitude < 0.5 then
  507. if math.random(1, 3) == 1 then
  508. torso.Velocity = torso.CFrame.lookVector * -40
  509. hum:MoveTo(torso.Position + Vector3.new(math.random(-1, 1), 0, math.random(-1, 1))*20)
  510. wait(1.2)
  511. else
  512. hum.Jump = true
  513. hum:MoveTo(target.Position, target)
  514. end
  515. end
  516. else break end
  517. old_pos = torso.Position
  518. wait(0.5)
  519. end
  520. end
  521. wait(4)
  522. end
  523. end))
  524. Script7.Name = "Die"
  525. Script7.Parent = Model1
  526. table.insert(cors,sandbox(Script7,function()
  527. human = script.Parent.Humanoid
  528. --tool = script.Parent.Pistol
  529.  
  530. function Die()
  531. --if tool ~= nil then tool:remove() end
  532. game.workspace.Scripts.WaveScript.Dead_Zombies.Value = game.workspace.Scripts.WaveScript.Dead_Zombies.Value + 1
  533. wait(2.5)
  534. script.Parent:remove()
  535. end
  536.  
  537. human.Died:connect(Die)
  538. end))
  539. Script8.Name = "ZombieScript"
  540. Script8.Parent = Model1
  541. table.insert(cors,sandbox(Script8,function()
  542. --Made by Stickmasterluke
  543.  
  544. --Zombie artificial stupidity script
  545.  
  546.  
  547. sp=script.Parent
  548. lastattack=0
  549. nextrandom=0
  550. nextsound=0
  551. nextjump=0
  552. chasing=false
  553.  
  554. variance=4
  555.  
  556. damage=10
  557. attackrange=4.5
  558. sightrange=999--60
  559. runspeed=10
  560. wonderspeed=8
  561. healthregen=false
  562. colors={"Sand red","Dusty Rose","Medium blue","Sand blue","Lavender","Earth green","Brown","Medium stone grey","Brick yellow"}
  563.  
  564. function raycast(spos,vec,currentdist)
  565. local hit2,pos2=game.Workspace:FindPartOnRay(Ray.new(spos+(vec*.01),vec*currentdist),script.Parent)
  566. if hit2~=nil and pos2 then
  567. if hit2.Parent==script.Parent and hit2.Transparency>=.8 or hit2.Name=="Handle" or string.sub(hit2.Name,1,6)=="Effect" or hit2.Parent:IsA("Hat") or hit2.Parent:IsA("Tool") or (hit2.Parent:FindFirstChild("Humanoid") and hit2.Parent:FindFirstChild("TEAM") and hit2.Parent:FindFirstChild("TEAM").Value == script.Parent.TEAM.Value) or (not hit2.Parent:FindFirstChild("Humanoid") and hit2.CanCollide==false) then
  568. local currentdist=currentdist-(pos2-spos).magnitude
  569. return raycast(pos2,vec,currentdist)
  570. end
  571. end
  572. return hit2,pos2
  573. end
  574.  
  575. function waitForChild(parent,childName)
  576. local child=parent:findFirstChild(childName)
  577. if child then return child end
  578. while true do
  579. child=parent.ChildAdded:wait()
  580. if child.Name==childName then return child end
  581. end
  582. end
  583.  
  584. -- ANIMATION
  585.  
  586. -- declarations
  587.  
  588. local Torso=waitForChild(sp,"Torso")
  589. local Head=waitForChild(sp,"Head")
  590. local RightShoulder=waitForChild(Torso,"Right Shoulder")
  591. local LeftShoulder=waitForChild(Torso,"Left Shoulder")
  592. local RightHip=waitForChild(Torso,"Right Hip")
  593. local LeftHip=waitForChild(Torso,"Left Hip")
  594. local Neck=waitForChild(Torso,"Neck")
  595. local Humanoid=waitForChild(sp,"Humanoid")
  596. local BodyColors=waitForChild(sp,"Body Colors")
  597. local pose="Standing"
  598. local hitsound=waitForChild(Torso,"HitSound")
  599. local Anim = Humanoid:LoadAnimation(sp.AttackAnim)
  600.  
  601. --[[local sounds={
  602. waitForChild(Torso,"GroanSound"),
  603. waitForChild(Torso,"RawrSound")
  604. }]]
  605.  
  606. if healthregen then
  607. local regenscript=waitForChild(sp,"HealthRegenerationScript")
  608. regenscript.Disabled=false
  609. end
  610. Humanoid.WalkSpeed=wonderspeed
  611.  
  612. local toolAnim="None"
  613. local toolAnimTime=0
  614.  
  615. --[[BodyColors.HeadColor=BrickColor.new("Grime")
  616. local randomcolor1=colors[math.random(1,#colors)]
  617. BodyColors.TorsoColor=BrickColor.new(randomcolor1)
  618. BodyColors.LeftArmColor=BrickColor.new(randomcolor1)
  619. BodyColors.RightArmColor=BrickColor.new(randomcolor1)
  620. local randomcolor2=colors[math.random(1,#colors)]
  621. BodyColors.LeftLegColor=BrickColor.new(randomcolor2)
  622. BodyColors.RightLegColor=BrickColor.new(randomcolor2)]]
  623.  
  624.  
  625. function onRunning(speed)
  626. if speed>0 then
  627. pose="Running"
  628. else
  629. pose="Standing"
  630. end
  631. end
  632. function onDied()
  633. pose="Dead"
  634. end
  635. function onJumping()
  636. pose="Jumping"
  637. end
  638. function onClimbing()
  639. pose="Climbing"
  640. end
  641. function onGettingUp()
  642. pose = "GettingUp"
  643. end
  644. function onFreeFall()
  645. pose = "FreeFall"
  646. end
  647. function onFallingDown()
  648. pose = "FallingDown"
  649. end
  650. function onSeated()
  651. pose = "Seated"
  652. end
  653. function onPlatformStanding()
  654. pose = "PlatformStanding"
  655. end
  656.  
  657. function moveJump()
  658. RightShoulder.MaxVelocity = 0.5
  659. LeftShoulder.MaxVelocity = 0.5
  660. RightShoulder.DesiredAngle=3.14
  661. LeftShoulder.DesiredAngle=-3.14
  662. RightHip.DesiredAngle=0
  663. LeftHip.DesiredAngle=0
  664. end
  665.  
  666. function moveFreeFall()
  667. RightShoulder.MaxVelocity = 0.5
  668. LeftShoulder.MaxVelocity =0.5
  669. RightShoulder.DesiredAngle=3.14
  670. LeftShoulder.DesiredAngle=-3.14
  671. RightHip.DesiredAngle=0
  672. LeftHip.DesiredAngle=0
  673. end
  674.  
  675. function moveSit()
  676. RightShoulder.MaxVelocity = 0.15
  677. LeftShoulder.MaxVelocity = 0.15
  678. RightShoulder.DesiredAngle=3.14 /2
  679. LeftShoulder.DesiredAngle=-3.14 /2
  680. RightHip.DesiredAngle=3.14 /2
  681. LeftHip.DesiredAngle=-3.14 /2
  682. end
  683.  
  684. function animate(time)
  685. local amplitude
  686. local frequency
  687. if (pose == "Jumping") then
  688. moveJump()
  689. return
  690. end
  691. if (pose == "FreeFall") then
  692. moveFreeFall()
  693. return
  694. end
  695. if (pose == "Seated") then
  696. moveSit()
  697. return
  698. end
  699. local climbFudge = 0
  700. if (pose == "Running") then
  701. RightShoulder.MaxVelocity = 0.15
  702. LeftShoulder.MaxVelocity = 0.15
  703. amplitude = 1
  704. frequency = 9
  705. elseif (pose == "Climbing") then
  706. RightShoulder.MaxVelocity = 0.5
  707. LeftShoulder.MaxVelocity = 0.5
  708. amplitude = 1
  709. frequency = 9
  710. climbFudge = 3.14
  711. else
  712. amplitude = 0.1
  713. frequency = 1
  714. end
  715. desiredAngle = amplitude * math.sin(time*frequency)
  716. if not chasing and frequency==9 then
  717. frequency=4
  718. end
  719. if chasing then
  720. --[[RightShoulder.DesiredAngle=math.pi/2
  721. LeftShoulder.DesiredAngle=-math.pi/2
  722. RightHip.DesiredAngle=-desiredAngle*2
  723. LeftHip.DesiredAngle=-desiredAngle*2]]
  724. else
  725. RightShoulder.DesiredAngle=desiredAngle + climbFudge
  726. LeftShoulder.DesiredAngle=desiredAngle - climbFudge
  727. RightHip.DesiredAngle=-desiredAngle
  728. LeftHip.DesiredAngle=-desiredAngle
  729. end
  730. end
  731.  
  732.  
  733. function attack(time,attackpos)
  734. if time-lastattack>=0.25 then
  735. local hit,pos=raycast(Torso.Position,(attackpos-Torso.Position).unit,attackrange)
  736. if hit and hit.Parent~=nil then
  737. local h=hit.Parent:FindFirstChild("Humanoid")
  738. local TEAM=hit.Parent:FindFirstChild("TEAM")
  739. if h and TEAM and TEAM.Value~=sp.TEAM.Value then
  740. local creator=sp:FindFirstChild("creator")
  741. if creator then
  742. if creator.Value~=nil then
  743. if creator.Value~=game.Players:GetPlayerFromCharacter(h.Parent) then
  744. for i,oldtag in ipairs(h:GetChildren()) do
  745. if oldtag.Name=="creator" then
  746. oldtag:remove()
  747. end
  748. end
  749. creator:clone().Parent=h
  750. else
  751. return
  752. end
  753. end
  754. end
  755. if Anim then Anim:Play(nil,nil,1.5) end
  756. h:TakeDamage(damage)
  757. hitsound.Volume=1
  758. hitsound.Pitch=.75+(math.random()*.5)
  759. hitsound:Play()
  760. --[[if RightShoulder and LeftShoulder then
  761. RightShoulder.CurrentAngle=0
  762. LeftShoulder.CurrentAngle=0
  763. end]]
  764. end
  765. end
  766. lastattack=time
  767. end
  768. end
  769.  
  770.  
  771. Humanoid.Died:connect(onDied)
  772. Humanoid.Running:connect(onRunning)
  773. Humanoid.Jumping:connect(onJumping)
  774. Humanoid.Climbing:connect(onClimbing)
  775. Humanoid.GettingUp:connect(onGettingUp)
  776. Humanoid.FreeFalling:connect(onFreeFall)
  777. Humanoid.FallingDown:connect(onFallingDown)
  778. Humanoid.Seated:connect(onSeated)
  779. Humanoid.PlatformStanding:connect(onPlatformStanding)
  780.  
  781.  
  782. function populatehumanoids(mdl)
  783. if mdl.ClassName=="Humanoid" then
  784. if mdl.Parent:FindFirstChild("TEAM") and mdl.Parent:FindFirstChild("TEAM").Value~=sp.TEAM.Value then
  785. table.insert(humanoids,mdl)
  786. end
  787. end
  788. for i2,mdl2 in ipairs(mdl:GetChildren()) do
  789. populatehumanoids(mdl2)
  790. end
  791. end
  792.  
  793. --[[function playsound(time)
  794. nextsound=time+5+(math.random()*5)
  795. local randomsound=sounds[math.random(1,#sounds)]
  796. randomsound.Volume=.5+(.5*math.random())
  797. randomsound.Pitch=.5+(.5*math.random())
  798. randomsound:Play()
  799. end]]
  800.  
  801. while sp.Parent~=nil and Humanoid and Humanoid.Parent~=nil and Humanoid.Health>0 and Torso and Head and Torso~=nil and Torso.Parent~=nil do
  802. local _,time=wait(0.25)--wait(1/3)
  803. humanoids={}
  804. populatehumanoids(game.Workspace)
  805. closesttarget=nil
  806. closestdist=sightrange
  807. local creator=sp:FindFirstChild("creator")
  808. for i,h in ipairs(humanoids) do
  809. if h and h.Parent~=nil then
  810. if h.Health>0 and h.Parent~=sp then
  811. local plr=game.Players:GetPlayerFromCharacter(h.Parent)
  812. if creator==nil or plr==nil or creator.Value~=plr then
  813. local t=h.Parent:FindFirstChild("Torso")
  814. if t~=nil then
  815. local dist=(t.Position-Torso.Position).magnitude
  816. if dist<closestdist then
  817. closestdist=dist
  818. closesttarget=t
  819. end
  820. end
  821. end
  822. end
  823. end
  824. end
  825. if closesttarget~=nil then
  826. if not chasing then
  827. --playsound(time)
  828. chasing=true
  829. Humanoid.WalkSpeed=runspeed
  830. end
  831. Humanoid:MoveTo(closesttarget.Position+(Vector3.new(1,1,1)*(variance*((math.random()*2)-1))),closesttarget)
  832. if math.random()<.5 then
  833. attack(time,closesttarget.Position)
  834. end
  835. else
  836. if chasing then
  837. chasing=false
  838. Humanoid.WalkSpeed=wonderspeed
  839. end
  840. if time>nextrandom then
  841. nextrandom=time+3+(math.random()*5)
  842. local randompos=Torso.Position+((Vector3.new(1,1,1)*math.random()-Vector3.new(.5,.5,.5))*40)
  843. Humanoid:MoveTo(randompos,game.Workspace.Terrain)
  844. end
  845. end
  846. if time>nextsound then
  847. --playsound(time)
  848. end
  849. if time>nextjump then
  850. nextjump=time+7+(math.random()*5)
  851. Humanoid.Jump=true
  852. end
  853. animate(time)
  854. end
  855.  
  856. wait(4)
  857. sp:remove() --Rest In Pizza
  858.  
  859. end))
  860. Animation9.Name = "AttackAnim"
  861. Animation9.Parent = Model1
  862. Animation9.AnimationId = "http://www.roblox.com/Asset?ID=105211514"
  863. BodyColors10.Parent = Model1
  864. BodyColors10.HeadColor = BrickColor.new("Medium green")
  865. BodyColors10.LeftArmColor = BrickColor.new("Medium green")
  866. BodyColors10.LeftLegColor = BrickColor.new("Reddish brown")
  867. BodyColors10.RightArmColor = BrickColor.new("Medium green")
  868. BodyColors10.RightLegColor = BrickColor.new("Reddish brown")
  869. BodyColors10.TorsoColor = BrickColor.new("Reddish brown")
  870. BrickColorValue11.Name = "TEAM"
  871. BrickColorValue11.Parent = Model1
  872. BrickColorValue11.Value = BrickColor.new("Bright green")
  873. Script12.Name = "Sound"
  874. Script12.Parent = Model1
  875. table.insert(cors,sandbox(Script12,function()
  876. -- util
  877.  
  878. function waitForChild(parent, childName)
  879. local child = parent:findFirstChild(childName)
  880. if child then return child end
  881. while true do
  882. child = parent.ChildAdded:wait()
  883. if child.Name==childName then return child end
  884. end
  885. end
  886.  
  887. function newSound(id)
  888. local sound = Instance.new("Sound")
  889. sound.SoundId = id
  890. sound.archivable = false
  891. sound.Parent = script.Parent.Head
  892. return sound
  893. end
  894.  
  895. -- declarations
  896.  
  897. local sDied = newSound("rbxasset://sounds/uuhhh.wav")
  898. sDied.Pitch = 0.75
  899. local sFallingDown = newSound("rbxasset://sounds/splat.wav")
  900. local sFreeFalling = newSound("rbxasset://sounds/swoosh.wav")
  901. local sGettingUp = newSound("rbxasset://sounds/hit.wav")
  902. local sJumping = newSound("rbxasset://sounds/button.wav")
  903. local sRunning = newSound("rbxasset://sounds/bfsl-minifigfoots1.mp3")
  904. sRunning.Looped = true
  905.  
  906. local Figure = script.Parent
  907. local Head = waitForChild(Figure, "Head")
  908. local Humanoid = waitForChild(Figure, "Humanoid")
  909.  
  910. -- functions
  911.  
  912. function onDied()
  913. sDied:Play()
  914. wait(2.5)
  915. script.Parent:Destroy()
  916. end
  917.  
  918. function onState(state, sound)
  919. if state then
  920. sound:Play()
  921. else
  922. sound:Pause()
  923. end
  924. end
  925.  
  926. function onRunning(speed)
  927. if speed>0 then
  928. sRunning:Play()
  929. else
  930. sRunning:Pause()
  931. end
  932. end
  933.  
  934. -- connect up
  935.  
  936. Humanoid.Died:connect(onDied)
  937. Humanoid.Running:connect(onRunning)
  938. Humanoid.Jumping:connect(function(state) onState(state, sJumping) end)
  939. Humanoid.GettingUp:connect(function(state) onState(state, sGettingUp) end)
  940. Humanoid.FreeFalling:connect(function(state) onState(state, sFreeFalling) end)
  941. Humanoid.FallingDown:connect(function(state) onState(state, sFallingDown) end)
  942.  
  943. end))
  944. Humanoid13.Parent = Model1
  945. Humanoid13.RightLeg = Part38
  946. Humanoid13.LeftLeg = Part39
  947. Humanoid13.Torso = Part47
  948. Script14.Name = "HealthRegenerationScript"
  949. Script14.Parent = Model1
  950. Script14.Disabled = true
  951. table.insert(cors,sandbox(Script14,function()
  952. -- Renegeration Script for the bot
  953. -- Renegerates about 1% of max hp per second until it reaches max health
  954. bot = script.Parent
  955. Humanoid = bot:FindFirstChild("Humanoid")
  956.  
  957. local regen = false
  958.  
  959. function regenerate()
  960. if regen then return end
  961. -- Lock this function until the regeneration to max health is complete by using a boolean toggle
  962. regen = true
  963. while Humanoid.Health < Humanoid.MaxHealth do
  964. local delta = wait(1)
  965. local health = Humanoid.Health
  966. if health > 0 and health < Humanoid.MaxHealth then
  967. -- This delta is for regenerating 1% of max hp per second instead of 1 hp per second
  968. delta = 0.01 * delta * Humanoid.MaxHealth
  969. health = health + delta
  970. Humanoid.Health = math.min(health, Humanoid.MaxHealth)
  971. end
  972. end
  973. -- release the lock, since the health is at max now, and if the character loses health again
  974. -- it needs to start regenerating
  975. regen = false
  976. end
  977.  
  978. if Humanoid then
  979. -- Better than a while true do loop since it only fires when the health actually changes
  980. Humanoid.HealthChanged:connect(regenerate)
  981. end
  982.  
  983. end))
  984. Script15.Name = "Animate"
  985. Script15.Parent = Model1
  986. table.insert(cors,sandbox(Script15,function()
  987. function waitForChild(parent, childName)
  988. local child = parent:findFirstChild(childName)
  989. if child then return child end
  990. while true do
  991. child = parent.ChildAdded:wait()
  992. if child.Name==childName then return child end
  993. end
  994. end
  995.  
  996. local Figure = script.Parent
  997. local Torso = waitForChild(Figure, "Torso")
  998. local RightShoulder = waitForChild(Torso, "Right Shoulder")
  999. local LeftShoulder = waitForChild(Torso, "Left Shoulder")
  1000. local RightHip = waitForChild(Torso, "Right Hip")
  1001. local LeftHip = waitForChild(Torso, "Left Hip")
  1002. local Neck = waitForChild(Torso, "Neck")
  1003. local Humanoid = waitForChild(Figure, "Humanoid")
  1004. local pose = "Standing"
  1005.  
  1006. local currentAnim = ""
  1007. local currentAnimTrack = nil
  1008. local currentAnimKeyframeHandler = nil
  1009. local currentAnimSpeed = 1.0
  1010. local animTable = {}
  1011. local animNames = {
  1012. idle = {
  1013. { id = "http://www.roblox.com/asset/?id=125750544", weight = 9 },
  1014. { id = "http://www.roblox.com/asset/?id=125750618", weight = 1 }
  1015. },
  1016. walk = {
  1017. { id = "http://www.roblox.com/asset/?id=125749145", weight = 10 }
  1018. },
  1019. run = {
  1020. { id = "run.xml", weight = 10 }
  1021. },
  1022. jump = {
  1023. { id = "http://www.roblox.com/asset/?id=125750702", weight = 10 }
  1024. },
  1025. fall = {
  1026. { id = "http://www.roblox.com/asset/?id=125750759", weight = 10 }
  1027. },
  1028. climb = {
  1029. { id = "http://www.roblox.com/asset/?id=125750800", weight = 10 }
  1030. },
  1031. toolnone = {
  1032. { id = "http://www.roblox.com/asset/?id=125750867", weight = 10 }
  1033. },
  1034. toolslash = {
  1035. { id = "http://www.roblox.com/asset/?id=129967390", weight = 10 }
  1036. -- { id = "slash.xml", weight = 10 }
  1037. },
  1038. toollunge = {
  1039. { id = "http://www.roblox.com/asset/?id=129967478", weight = 10 }
  1040. },
  1041. wave = {
  1042. { id = "http://www.roblox.com/asset/?id=128777973", weight = 10 }
  1043. },
  1044. point = {
  1045. { id = "http://www.roblox.com/asset/?id=128853357", weight = 10 }
  1046. },
  1047. dance = {
  1048. { id = "http://www.roblox.com/asset/?id=130018893", weight = 10 },
  1049. { id = "http://www.roblox.com/asset/?id=132546839", weight = 10 },
  1050. { id = "http://www.roblox.com/asset/?id=132546884", weight = 10 }
  1051. },
  1052. dance2 = {
  1053. { id = "http://www.roblox.com/asset/?id=160934142", weight = 10 },
  1054. { id = "http://www.roblox.com/asset/?id=160934298", weight = 10 },
  1055. { id = "http://www.roblox.com/asset/?id=160934376", weight = 10 }
  1056. },
  1057. dance3 = {
  1058. { id = "http://www.roblox.com/asset/?id=160934458", weight = 10 },
  1059. { id = "http://www.roblox.com/asset/?id=160934530", weight = 10 },
  1060. { id = "http://www.roblox.com/asset/?id=160934593", weight = 10 }
  1061. },
  1062. laugh = {
  1063. { id = "http://www.roblox.com/asset/?id=129423131", weight = 10 }
  1064. },
  1065. cheer = {
  1066. { id = "http://www.roblox.com/asset/?id=129423030", weight = 10 }
  1067. },
  1068. }
  1069.  
  1070. -- Existance in this list signifies that it is an emote, the value indicates if it is a looping emote
  1071. local emoteNames = { wave = false, point = false, dance = true, dance2 = true, dance3 = true, laugh = false, cheer = false}
  1072.  
  1073. math.randomseed(tick())
  1074.  
  1075. function configureAnimationSet(name, fileList)
  1076. if (animTable[name] ~= nil) then
  1077. for _, connection in pairs(animTable[name].connections) do
  1078. connection:disconnect()
  1079. end
  1080. end
  1081. animTable[name] = {}
  1082. animTable[name].count = 0
  1083. animTable[name].totalWeight = 0
  1084. animTable[name].connections = {}
  1085.  
  1086. -- check for config values
  1087. local config = script:FindFirstChild(name)
  1088. if (config ~= nil) then
  1089. -- print("Loading anims " .. name)
  1090. table.insert(animTable[name].connections, config.ChildAdded:connect(function(child) configureAnimationSet(name, fileList) end))
  1091. table.insert(animTable[name].connections, config.ChildRemoved:connect(function(child) configureAnimationSet(name, fileList) end))
  1092. local idx = 1
  1093. for _, childPart in pairs(config:GetChildren()) do
  1094. if (childPart:IsA("Animation")) then
  1095. table.insert(animTable[name].connections, childPart.Changed:connect(function(property) configureAnimationSet(name, fileList) end))
  1096. animTable[name][idx] = {}
  1097. animTable[name][idx].anim = childPart
  1098. local weightObject = childPart:FindFirstChild("Weight")
  1099. if (weightObject == nil) then
  1100. animTable[name][idx].weight = 1
  1101. else
  1102. animTable[name][idx].weight = weightObject.Value
  1103. end
  1104. animTable[name].count = animTable[name].count + 1
  1105. animTable[name].totalWeight = animTable[name].totalWeight + animTable[name][idx].weight
  1106. -- print(name .. " [" .. idx .. "] " .. animTable[name][idx].anim.AnimationId .. " (" .. animTable[name][idx].weight .. ")")
  1107. idx = idx + 1
  1108. end
  1109. end
  1110. end
  1111.  
  1112. -- fallback to defaults
  1113. if (animTable[name].count <= 0) then
  1114. for idx, anim in pairs(fileList) do
  1115. animTable[name][idx] = {}
  1116. animTable[name][idx].anim = Instance.new("Animation")
  1117. animTable[name][idx].anim.Name = name
  1118. animTable[name][idx].anim.AnimationId = anim.id
  1119. animTable[name][idx].weight = anim.weight
  1120. animTable[name].count = animTable[name].count + 1
  1121. animTable[name].totalWeight = animTable[name].totalWeight + anim.weight
  1122. -- print(name .. " [" .. idx .. "] " .. anim.id .. " (" .. anim.weight .. ")")
  1123. end
  1124. end
  1125. end
  1126.  
  1127. -- Setup animation objects
  1128. function scriptChildModified(child)
  1129. local fileList = animNames[child.Name]
  1130. if (fileList ~= nil) then
  1131. configureAnimationSet(child.Name, fileList)
  1132. end
  1133. end
  1134.  
  1135. script.ChildAdded:connect(scriptChildModified)
  1136. script.ChildRemoved:connect(scriptChildModified)
  1137.  
  1138.  
  1139. for name, fileList in pairs(animNames) do
  1140. configureAnimationSet(name, fileList)
  1141. end
  1142.  
  1143. -- ANIMATION
  1144.  
  1145. -- declarations
  1146. local toolAnim = "None"
  1147. local toolAnimTime = 0
  1148.  
  1149. local jumpAnimTime = 0
  1150. local jumpAnimDuration = 0.3
  1151.  
  1152. local toolTransitionTime = 0.1
  1153. local fallTransitionTime = 0.3
  1154. local jumpMaxLimbVelocity = 0.75
  1155.  
  1156. -- functions
  1157.  
  1158. function stopAllAnimations()
  1159. local oldAnim = currentAnim
  1160.  
  1161. -- return to idle if finishing an emote
  1162. if (emoteNames[oldAnim] ~= nil and emoteNames[oldAnim] == false) then
  1163. oldAnim = "idle"
  1164. end
  1165.  
  1166. currentAnim = ""
  1167. if (currentAnimKeyframeHandler ~= nil) then
  1168. currentAnimKeyframeHandler:disconnect()
  1169. end
  1170.  
  1171. if (currentAnimTrack ~= nil) then
  1172. currentAnimTrack:Stop()
  1173. currentAnimTrack:Destroy()
  1174. currentAnimTrack = nil
  1175. end
  1176. return oldAnim
  1177. end
  1178.  
  1179. function setAnimationSpeed(speed)
  1180. if speed ~= currentAnimSpeed then
  1181. currentAnimSpeed = speed
  1182. currentAnimTrack:AdjustSpeed(currentAnimSpeed)
  1183. end
  1184. end
  1185.  
  1186. function keyFrameReachedFunc(frameName)
  1187. if (frameName == "End") then
  1188. -- print("Keyframe : ".. frameName)
  1189. local repeatAnim = stopAllAnimations()
  1190. local animSpeed = currentAnimSpeed
  1191. playAnimation(repeatAnim, 0.0, Humanoid)
  1192. setAnimationSpeed(animSpeed)
  1193. end
  1194. end
  1195.  
  1196. -- Preload animations
  1197. function playAnimation(animName, transitionTime, humanoid)
  1198. local idleFromEmote = (animName == "idle" and emoteNames[currentAnim] ~= nil)
  1199. if (animName ~= currentAnim and not idleFromEmote) then
  1200.  
  1201. if (currentAnimTrack ~= nil) then
  1202. currentAnimTrack:Stop(transitionTime)
  1203. currentAnimTrack:Destroy()
  1204. end
  1205.  
  1206. currentAnimSpeed = 1.0
  1207. local roll = math.random(1, animTable[animName].totalWeight)
  1208. local origRoll = roll
  1209. local idx = 1
  1210. while (roll > animTable[animName][idx].weight) do
  1211. roll = roll - animTable[animName][idx].weight
  1212. idx = idx + 1
  1213. end
  1214. -- print(animName .. " " .. idx .. " [" .. origRoll .. "]")
  1215. local anim = animTable[animName][idx].anim
  1216.  
  1217. -- load it to the humanoid; get AnimationTrack
  1218. currentAnimTrack = humanoid:LoadAnimation(anim)
  1219.  
  1220. -- play the animation
  1221. currentAnimTrack:Play(transitionTime)
  1222. currentAnim = animName
  1223.  
  1224. -- set up keyframe name triggers
  1225. if (currentAnimKeyframeHandler ~= nil) then
  1226. currentAnimKeyframeHandler:disconnect()
  1227. end
  1228. currentAnimKeyframeHandler = currentAnimTrack.KeyframeReached:connect(keyFrameReachedFunc)
  1229. end
  1230. end
  1231.  
  1232. -------------------------------------------------------------------------------------------
  1233. -------------------------------------------------------------------------------------------
  1234.  
  1235. local toolAnimName = ""
  1236. local toolAnimTrack = nil
  1237. local currentToolAnimKeyframeHandler = nil
  1238.  
  1239. function toolKeyFrameReachedFunc(frameName)
  1240. if (frameName == "End") then
  1241. -- print("Keyframe : ".. frameName)
  1242. local repeatAnim = stopToolAnimations()
  1243. playToolAnimation(repeatAnim, 0.0, Humanoid)
  1244. end
  1245. end
  1246.  
  1247.  
  1248. function playToolAnimation(animName, transitionTime, humanoid)
  1249. if (animName ~= toolAnimName) then
  1250.  
  1251. if (toolAnimTrack ~= nil) then
  1252. toolAnimTrack:Stop()
  1253. toolAnimTrack:Destroy()
  1254. transitionTime = 0
  1255. end
  1256.  
  1257. local roll = math.random(1, animTable[animName].totalWeight)
  1258. local origRoll = roll
  1259. local idx = 1
  1260. while (roll > animTable[animName][idx].weight) do
  1261. roll = roll - animTable[animName][idx].weight
  1262. idx = idx + 1
  1263. end
  1264. -- print(animName .. " * " .. idx .. " [" .. origRoll .. "]")
  1265. local anim = animTable[animName][idx].anim
  1266.  
  1267. -- load it to the humanoid; get AnimationTrack
  1268. toolAnimTrack = humanoid:LoadAnimation(anim)
  1269.  
  1270. -- play the animation
  1271. toolAnimTrack:Play(transitionTime)
  1272. toolAnimName = animName
  1273.  
  1274. currentToolAnimKeyframeHandler = toolAnimTrack.KeyframeReached:connect(toolKeyFrameReachedFunc)
  1275. end
  1276. end
  1277.  
  1278. function stopToolAnimations()
  1279. local oldAnim = toolAnimName
  1280.  
  1281. if (currentToolAnimKeyframeHandler ~= nil) then
  1282. currentToolAnimKeyframeHandler:disconnect()
  1283. end
  1284.  
  1285. toolAnimName = ""
  1286. if (toolAnimTrack ~= nil) then
  1287. toolAnimTrack:Stop()
  1288. toolAnimTrack:Destroy()
  1289. toolAnimTrack = nil
  1290. end
  1291.  
  1292.  
  1293. return oldAnim
  1294. end
  1295.  
  1296. -------------------------------------------------------------------------------------------
  1297. -------------------------------------------------------------------------------------------
  1298.  
  1299.  
  1300. function onRunning(speed)
  1301. if speed>0.01 then
  1302. playAnimation("walk", 0.1, Humanoid)
  1303. pose = "Running"
  1304. else
  1305. playAnimation("idle", 0.1, Humanoid)
  1306. pose = "Standing"
  1307. end
  1308. end
  1309.  
  1310. function onDied()
  1311. pose = "Dead"
  1312. end
  1313.  
  1314. function onJumping()
  1315. playAnimation("jump", 0.1, Humanoid)
  1316. jumpAnimTime = jumpAnimDuration
  1317. pose = "Jumping"
  1318. end
  1319.  
  1320. function onClimbing(speed)
  1321. playAnimation("climb", 0.1, Humanoid)
  1322. setAnimationSpeed(speed / 12.0)
  1323. pose = "Climbing"
  1324. end
  1325.  
  1326. function onGettingUp()
  1327. pose = "GettingUp"
  1328. end
  1329.  
  1330. function onFreeFall()
  1331. if (jumpAnimTime <= 0) then
  1332. playAnimation("fall", fallTransitionTime, Humanoid)
  1333. end
  1334. pose = "FreeFall"
  1335. end
  1336.  
  1337. function onFallingDown()
  1338. pose = "FallingDown"
  1339. end
  1340.  
  1341. function onSeated()
  1342. pose = "Seated"
  1343. end
  1344.  
  1345. function onPlatformStanding()
  1346. pose = "PlatformStanding"
  1347. end
  1348.  
  1349. function onSwimming(speed)
  1350. if speed>0 then
  1351. pose = "Running"
  1352. else
  1353. pose = "Standing"
  1354. end
  1355. end
  1356.  
  1357. function getTool()
  1358. for _, kid in ipairs(Figure:GetChildren()) do
  1359. if kid.className == "Tool" then return kid end
  1360. end
  1361. return nil
  1362. end
  1363.  
  1364. function getToolAnim(tool)
  1365. for _, c in ipairs(tool:GetChildren()) do
  1366. if c.Name == "toolanim" and c.className == "StringValue" then
  1367. return c
  1368. end
  1369. end
  1370. return nil
  1371. end
  1372.  
  1373. function animateTool()
  1374.  
  1375. if (toolAnim == "None") then
  1376. playToolAnimation("toolnone", toolTransitionTime, Humanoid)
  1377. return
  1378. end
  1379.  
  1380. if (toolAnim == "Slash") then
  1381. playToolAnimation("toolslash", 0, Humanoid)
  1382. return
  1383. end
  1384.  
  1385. if (toolAnim == "Lunge") then
  1386. playToolAnimation("toollunge", 0, Humanoid)
  1387. return
  1388. end
  1389. end
  1390.  
  1391. function moveSit()
  1392. RightShoulder.MaxVelocity = 0.15
  1393. LeftShoulder.MaxVelocity = 0.15
  1394. RightShoulder:SetDesiredAngle(3.14 /2)
  1395. LeftShoulder:SetDesiredAngle(-3.14 /2)
  1396. RightHip:SetDesiredAngle(3.14 /2)
  1397. LeftHip:SetDesiredAngle(-3.14 /2)
  1398. end
  1399.  
  1400. local lastTick = 0
  1401.  
  1402. function move(time)
  1403. local amplitude = 1
  1404. local frequency = 1
  1405. local deltaTime = time - lastTick
  1406. lastTick = time
  1407.  
  1408. local climbFudge = 0
  1409. local setAngles = false
  1410.  
  1411. if (jumpAnimTime > 0) then
  1412. jumpAnimTime = jumpAnimTime - deltaTime
  1413. end
  1414.  
  1415. if (pose == "FreeFall" and jumpAnimTime <= 0) then
  1416. playAnimation("fall", fallTransitionTime, Humanoid)
  1417. elseif (pose == "Seated") then
  1418. stopAllAnimations()
  1419. moveSit()
  1420. return
  1421. elseif (pose == "Running") then
  1422. playAnimation("walk", 0.1, Humanoid)
  1423. elseif (pose == "Dead" or pose == "GettingUp" or pose == "FallingDown" or pose == "Seated" or pose == "PlatformStanding") then
  1424. -- print("Wha " .. pose)
  1425. amplitude = 0.1
  1426. frequency = 1
  1427. setAngles = true
  1428. end
  1429.  
  1430. if (setAngles) then
  1431. desiredAngle = amplitude * math.sin(time * frequency)
  1432.  
  1433. RightShoulder:SetDesiredAngle(desiredAngle + climbFudge)
  1434. LeftShoulder:SetDesiredAngle(desiredAngle - climbFudge)
  1435. RightHip:SetDesiredAngle(-desiredAngle)
  1436. LeftHip:SetDesiredAngle(-desiredAngle)
  1437. end
  1438.  
  1439. -- Tool Animation handling
  1440. local tool = getTool()
  1441. if tool then
  1442.  
  1443. animStringValueObject = getToolAnim(tool)
  1444.  
  1445. if animStringValueObject then
  1446. toolAnim = animStringValueObject.Value
  1447. -- message recieved, delete StringValue
  1448. animStringValueObject.Parent = nil
  1449. toolAnimTime = time + .3
  1450. end
  1451.  
  1452. if time > toolAnimTime then
  1453. toolAnimTime = 0
  1454. toolAnim = "None"
  1455. end
  1456.  
  1457. animateTool()
  1458. else
  1459. stopToolAnimations()
  1460. toolAnim = "None"
  1461. toolAnimTime = 0
  1462. end
  1463. end
  1464.  
  1465. -- connect events
  1466. Humanoid.Died:connect(onDied)
  1467. Humanoid.Running:connect(onRunning)
  1468. Humanoid.Jumping:connect(onJumping)
  1469. Humanoid.Climbing:connect(onClimbing)
  1470. Humanoid.GettingUp:connect(onGettingUp)
  1471. Humanoid.FreeFalling:connect(onFreeFall)
  1472. Humanoid.FallingDown:connect(onFallingDown)
  1473. Humanoid.Seated:connect(onSeated)
  1474. Humanoid.PlatformStanding:connect(onPlatformStanding)
  1475. Humanoid.Swimming:connect(onSwimming)
  1476.  
  1477. -- setup emote chat hook
  1478.  
  1479.  
  1480. -- main program
  1481.  
  1482. local runService = game:service("RunService");
  1483.  
  1484. -- initialize to idle
  1485. playAnimation("idle", 0.1, Humanoid)
  1486. pose = "Standing"
  1487.  
  1488. while Figure.Parent~=nil do
  1489. local _, time = wait(0.1)
  1490. move(time)
  1491. end
  1492.  
  1493.  
  1494.  
  1495. end))
  1496. StringValue16.Name = "climb"
  1497. StringValue16.Parent = Script15
  1498. Animation17.Name = "ClimbAnim"
  1499. Animation17.Parent = StringValue16
  1500. Animation17.AnimationId = "http://www.roblox.com/asset/?id=125750800"
  1501. StringValue18.Name = "fall"
  1502. StringValue18.Parent = Script15
  1503. Animation19.Name = "FallAnim"
  1504. Animation19.Parent = StringValue18
  1505. Animation19.AnimationId = "http://www.roblox.com/asset/?id=125750759"
  1506. StringValue20.Name = "idle"
  1507. StringValue20.Parent = Script15
  1508. Animation21.Name = "Animation1"
  1509. Animation21.Parent = StringValue20
  1510. Animation21.AnimationId = "http://www.roblox.com/asset/?id=125750544"
  1511. NumberValue22.Name = "Weight"
  1512. NumberValue22.Parent = Animation21
  1513. NumberValue22.Value = 9
  1514. Animation23.Name = "Animation2"
  1515. Animation23.Parent = StringValue20
  1516. Animation23.AnimationId = "http://www.roblox.com/asset/?id=125750618"
  1517. NumberValue24.Name = "Weight"
  1518. NumberValue24.Parent = Animation23
  1519. NumberValue24.Value = 1
  1520. StringValue25.Name = "jump"
  1521. StringValue25.Parent = Script15
  1522. Animation26.Name = "JumpAnim"
  1523. Animation26.Parent = StringValue25
  1524. Animation26.AnimationId = "http://www.roblox.com/asset/?id=125750702"
  1525. StringValue27.Name = "run"
  1526. StringValue27.Parent = Script15
  1527. Animation28.Name = "RunAnim"
  1528. Animation28.Parent = StringValue27
  1529. Animation28.AnimationId = "http://www.roblox.com/asset/?id=125749145"
  1530. StringValue29.Name = "toolnone"
  1531. StringValue29.Parent = Script15
  1532. Animation30.Name = "ToolNoneAnim"
  1533. Animation30.Parent = StringValue29
  1534. Animation30.AnimationId = "http://www.roblox.com/asset/?id=125750867"
  1535. StringValue31.Name = "walk"
  1536. StringValue31.Parent = Script15
  1537. Animation32.Name = "WalkAnim"
  1538. Animation32.Parent = StringValue31
  1539. Animation32.AnimationId = "http://www.roblox.com/asset/?id=125749145"
  1540. Part33.Name = "Head"
  1541. Part33.Parent = Model1
  1542. Part33.BrickColor = BrickColor.new("Cool yellow")
  1543. Part33.Rotation = Vector3.new(0, 90, 0)
  1544. Part33.FormFactor = Enum.FormFactor.Symmetric
  1545. Part33.Size = Vector3.new(2, 1, 1)
  1546. Part33.CFrame = CFrame.new(8.79732513, 4.45095634, -21.2196484, 0.000532949809, -0.000846050854, 1.00000048, 7.0162085e-09, 0.999999642, 0.000846053765, -1.00000155, -4.46565792e-07, 0.000533248123)
  1547. Part33.BottomSurface = Enum.SurfaceType.Smooth
  1548. Part33.TopSurface = Enum.SurfaceType.Smooth
  1549. Part33.Color = Color3.new(0.992157, 0.917647, 0.552941)
  1550. Part33.Position = Vector3.new(8.79732513, 4.45095634, -21.2196484)
  1551. Part33.Orientation = Vector3.new(-0.049999997, 89.9700012, 0)
  1552. Part33.Color = Color3.new(0.992157, 0.917647, 0.552941)
  1553. SpecialMesh34.Parent = Part33
  1554. SpecialMesh34.Scale = Vector3.new(1.25, 1.25, 1.25)
  1555. SpecialMesh34.Scale = Vector3.new(1.25, 1.25, 1.25)
  1556. Decal35.Parent = Part33
  1557. Decal35.Texture = "http://www.roblox.com/asset/?id=134724710"
  1558. Part36.Name = "Right Arm"
  1559. Part36.Parent = Model1
  1560. Part36.BrickColor = BrickColor.new("Cool yellow")
  1561. Part36.Rotation = Vector3.new(0, 90, 0)
  1562. Part36.CanCollide = false
  1563. Part36.FormFactor = Enum.FormFactor.Symmetric
  1564. Part36.Size = Vector3.new(1, 2, 1)
  1565. Part36.CFrame = CFrame.new(8.79939365, 2.95095706, -22.7196503, 0.000532949809, -0.000846050738, 1.00000048, 7.0162085e-09, 0.999999523, 0.000846053765, -1.00000155, -4.46565736e-07, 0.000533248123)
  1566. Part36.BottomSurface = Enum.SurfaceType.Smooth
  1567. Part36.TopSurface = Enum.SurfaceType.Smooth
  1568. Part36.Color = Color3.new(0.992157, 0.917647, 0.552941)
  1569. Part36.Position = Vector3.new(8.79939365, 2.95095706, -22.7196503)
  1570. Part36.Orientation = Vector3.new(-0.049999997, 89.9700012, 0)
  1571. Part36.Color = Color3.new(0.992157, 0.917647, 0.552941)
  1572. Part37.Name = "Left Arm"
  1573. Part37.Parent = Model1
  1574. Part37.BrickColor = BrickColor.new("Cool yellow")
  1575. Part37.Rotation = Vector3.new(0, 90, 0)
  1576. Part37.CanCollide = false
  1577. Part37.FormFactor = Enum.FormFactor.Symmetric
  1578. Part37.Size = Vector3.new(1, 2, 1)
  1579. Part37.CFrame = CFrame.new(8.7977953, 2.95095706, -19.7196465, 0.000532949809, -0.000846050738, 1.00000048, 7.0162085e-09, 0.999999523, 0.000846053765, -1.00000155, -4.46565736e-07, 0.000533248123)
  1580. Part37.BottomSurface = Enum.SurfaceType.Smooth
  1581. Part37.TopSurface = Enum.SurfaceType.Smooth
  1582. Part37.Color = Color3.new(0.992157, 0.917647, 0.552941)
  1583. Part37.Position = Vector3.new(8.7977953, 2.95095706, -19.7196465)
  1584. Part37.Orientation = Vector3.new(-0.049999997, 89.9700012, 0)
  1585. Part37.Color = Color3.new(0.992157, 0.917647, 0.552941)
  1586. Part38.Name = "Right Leg"
  1587. Part38.Parent = Model1
  1588. Part38.BrickColor = BrickColor.new("Bright blue")
  1589. Part38.Rotation = Vector3.new(0, 90, 0)
  1590. Part38.CanCollide = false
  1591. Part38.FormFactor = Enum.FormFactor.Symmetric
  1592. Part38.Size = Vector3.new(1, 2, 1)
  1593. Part38.CFrame = CFrame.new(8.80055332, 0.950957894, -21.7196484, 0.000532949809, -0.000846050738, 1.00000048, 7.0162085e-09, 0.999999523, 0.000846053765, -1.00000155, -4.46565736e-07, 0.000533248123)
  1594. Part38.BottomSurface = Enum.SurfaceType.Smooth
  1595. Part38.TopSurface = Enum.SurfaceType.Smooth
  1596. Part38.Color = Color3.new(0.0509804, 0.411765, 0.67451)
  1597. Part38.Position = Vector3.new(8.80055332, 0.950957894, -21.7196484)
  1598. Part38.Orientation = Vector3.new(-0.049999997, 89.9700012, 0)
  1599. Part38.Color = Color3.new(0.0509804, 0.411765, 0.67451)
  1600. Part39.Name = "Left Leg"
  1601. Part39.Parent = Model1
  1602. Part39.BrickColor = BrickColor.new("Bright blue")
  1603. Part39.Rotation = Vector3.new(0, 90, 0)
  1604. Part39.CanCollide = false
  1605. Part39.FormFactor = Enum.FormFactor.Symmetric
  1606. Part39.Size = Vector3.new(1, 2, 1)
  1607. Part39.CFrame = CFrame.new(8.80002022, 0.950957894, -20.7196465, 0.000532949809, -0.000846050738, 1.00000048, 7.0162085e-09, 0.999999523, 0.000846053765, -1.00000155, -4.46565736e-07, 0.000533248123)
  1608. Part39.BottomSurface = Enum.SurfaceType.Smooth
  1609. Part39.TopSurface = Enum.SurfaceType.Smooth
  1610. Part39.Color = Color3.new(0.0509804, 0.411765, 0.67451)
  1611. Part39.Position = Vector3.new(8.80002022, 0.950957894, -20.7196465)
  1612. Part39.Orientation = Vector3.new(-0.049999997, 89.9700012, 0)
  1613. Part39.Color = Color3.new(0.0509804, 0.411765, 0.67451)
  1614. Part40.Name = "Torso"
  1615. Part40.Parent = Model1
  1616. Part40.BrickColor = BrickColor.new("Dark green")
  1617. Part40.Rotation = Vector3.new(0, 90, 0)
  1618. Part40.CanCollide = false
  1619. Part40.FormFactor = Enum.FormFactor.Symmetric
  1620. Part40.Size = Vector3.new(2, 2, 1)
  1621. Part40.CFrame = CFrame.new(8.79859447, 2.95095706, -21.2196484, 0.000532949809, -0.000846050854, 1.00000048, 7.0162085e-09, 0.999999642, 0.000846053765, -1.00000155, -4.46565792e-07, 0.000533248123)
  1622. Part40.BottomSurface = Enum.SurfaceType.Smooth
  1623. Part40.TopSurface = Enum.SurfaceType.Smooth
  1624. Part40.Color = Color3.new(0.156863, 0.498039, 0.278431)
  1625. Part40.Position = Vector3.new(8.79859447, 2.95095706, -21.2196484)
  1626. Part40.Orientation = Vector3.new(-0.049999997, 89.9700012, 0)
  1627. Part40.Color = Color3.new(0.156863, 0.498039, 0.278431)
  1628. Sound41.Name = "HitSound"
  1629. Sound41.Parent = Part40
  1630. Sound41.SoundId = "http://www.roblox.com/asset/?id=93591808"
  1631. Motor6D42.Name = "Left Hip"
  1632. Motor6D42.Parent = Part40
  1633. Motor6D42.C0 = CFrame.new(-1, -1, 0, -4.37113883e-08, 0, -1, 0, 0.99999994, 0, 1, 0, -4.37113883e-08)
  1634. Motor6D42.C1 = CFrame.new(-0.5, 1, 0, -4.37113883e-08, 0, -1, 0, 0.99999994, 0, 1, 0, -4.37113883e-08)
  1635. Motor6D42.Part0 = Part40
  1636. Motor6D42.Part1 = Part39
  1637. Motor6D42.MaxVelocity = 0.10000000149012
  1638. Motor6D43.Name = "Right Hip"
  1639. Motor6D43.Parent = Part40
  1640. Motor6D43.C0 = CFrame.new(1, -1, 0, -4.37113883e-08, 0, 1, -0, 0.99999994, 0, -1, 0, -4.37113883e-08)
  1641. Motor6D43.C1 = CFrame.new(0.5, 1, 0, -4.37113883e-08, 0, 1, 0, 0.99999994, 0, -1, 0, -4.37113883e-08)
  1642. Motor6D43.Part0 = Part40
  1643. Motor6D43.Part1 = Part38
  1644. Motor6D43.MaxVelocity = 0.10000000149012
  1645. Motor6D44.Name = "Left Shoulder"
  1646. Motor6D44.Parent = Part40
  1647. Motor6D44.C0 = CFrame.new(-1, 0.5, 0, -4.37113883e-08, 0, -1, 0, 0.99999994, 0, 1, 0, -4.37113883e-08)
  1648. Motor6D44.C1 = CFrame.new(0.5, 0.5, 0, -4.37113883e-08, 0, -1, 0, 0.99999994, 0, 1, 0, -4.37113883e-08)
  1649. Motor6D44.Part0 = Part40
  1650. Motor6D44.Part1 = Part37
  1651. Motor6D44.MaxVelocity = 0.10000000149012
  1652. Motor6D45.Name = "Right Shoulder"
  1653. Motor6D45.Parent = Part40
  1654. Motor6D45.C0 = CFrame.new(1, 0.5, 0, -4.37113883e-08, 0, 1, -0, 0.99999994, 0, -1, 0, -4.37113883e-08)
  1655. Motor6D45.C1 = CFrame.new(-0.5, 0.5, 0, -4.37113883e-08, 0, 1, 0, 0.99999994, 0, -1, 0, -4.37113883e-08)
  1656. Motor6D45.Part0 = Part40
  1657. Motor6D45.Part1 = Part36
  1658. Motor6D45.MaxVelocity = 0.10000000149012
  1659. Motor6D46.Name = "Neck"
  1660. Motor6D46.Parent = Part40
  1661. Motor6D46.C0 = CFrame.new(0, 1, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
  1662. Motor6D46.C1 = CFrame.new(0, -0.5, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
  1663. Motor6D46.Part0 = Part40
  1664. Motor6D46.Part1 = Part33
  1665. Motor6D46.MaxVelocity = 0.10000000149012
  1666. Part47.Name = "HumanoidRootPart"
  1667. Part47.Parent = Model1
  1668. Part47.Transparency = 1
  1669. Part47.Rotation = Vector3.new(0, 90, 0)
  1670. Part47.FormFactor = Enum.FormFactor.Symmetric
  1671. Part47.Size = Vector3.new(2, 2, 1)
  1672. Part47.CFrame = CFrame.new(8.79859447, 2.95095706, -21.2196484, 0.000532949809, -0.000846050854, 1.00000048, 7.0162085e-09, 0.999999642, 0.000846053765, -1.00000155, -4.46565792e-07, 0.000533248123)
  1673. Part47.BottomSurface = Enum.SurfaceType.Smooth
  1674. Part47.TopSurface = Enum.SurfaceType.Smooth
  1675. Part47.Position = Vector3.new(8.79859447, 2.95095706, -21.2196484)
  1676. Part47.Orientation = Vector3.new(-0.049999997, 89.9700012, 0)
  1677. Motor6D48.Name = "Root Hip"
  1678. Motor6D48.Parent = Part47
  1679. Motor6D48.C0 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
  1680. Motor6D48.C1 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
  1681. Motor6D48.Part0 = Part47
  1682. Motor6D48.Part1 = Part40
  1683. Motor6D48.MaxVelocity = 0.10000000149012
  1684. Script49.Name = "READ ME"
  1685. Script49.Parent = Model1
  1686. table.insert(cors,sandbox(Script49,function()
  1687. --- Please support and like and fav. Zombie wars for more updates.
  1688.  
  1689.  
  1690.  
  1691.  
  1692.  
  1693.  
  1694.  
  1695.  
  1696.  
  1697.  
  1698.  
  1699.  
  1700.  
  1701.  
  1702.  
  1703.  
  1704. ---THANK YOU
  1705.  
  1706.  
  1707.  
  1708.  
  1709.  
  1710. --YUANRAVIEH190
  1711. end))
  1712. Part50.Name = "MonsterSpawn"
  1713. Part50.Parent = Model0
  1714. Part50.Material = Enum.Material.Neon
  1715. Part50.BrickColor = BrickColor.new("Reddish brown")
  1716. Part50.Rotation = Vector3.new(0, 90, 0)
  1717. Part50.Anchored = true
  1718. Part50.CanCollide = false
  1719. Part50.FormFactor = Enum.FormFactor.Custom
  1720. Part50.Size = Vector3.new(6, 0.200000003, 6)
  1721. Part50.CFrame = CFrame.new(8.40015602, -0.149426997, -21.229414, -1.94256427e-06, 2.03144737e-08, 1.00000048, 1.57338604e-08, 0.999990463, -3.37604433e-09, -1.00000083, 1.46186778e-08, -1.79343624e-06)
  1722. Part50.BottomSurface = Enum.SurfaceType.Smooth
  1723. Part50.TopSurface = Enum.SurfaceType.Smooth
  1724. Part50.Color = Color3.new(0.411765, 0.25098, 0.156863)
  1725. Part50.Position = Vector3.new(8.40015602, -0.149426997, -21.229414)
  1726. Part50.Orientation = Vector3.new(0, 90, 0)
  1727. Part50.Color = Color3.new(0.411765, 0.25098, 0.156863)
  1728. Decal51.Parent = Part50
  1729. Decal51.Texture = "http://www.roblox.com/asset/?id=134724710"
  1730. Decal51.Face = Enum.NormalId.Top
  1731. Script52.Parent = Part50
  1732. table.insert(cors,sandbox(Script52,function()
  1733. zombie = script.Parent.Parent.Zombie
  1734. zombiebackup = zombie:Clone()
  1735. zombie:remove()
  1736.  
  1737. while true do
  1738. wait(5)
  1739. local newzombie = zombiebackup:Clone()
  1740. newzombie.Parent = game.Workspace
  1741. newzombie:MakeJoints()
  1742. newzombie.Torso.CFrame = script.Parent.CFrame + Vector3.new(0, 5, 0)
  1743. newzombie:MakeJoints()
  1744. zombie = newzombie
  1745. zombiebackup = zombie:Clone()
  1746. end
  1747. end))
  1748. ManualWeld53.Name = "MonsterSpawn-to-MonsterSpawn Strong Joint"
  1749. ManualWeld53.Parent = Part50
  1750. ManualWeld53.C0 = CFrame.new(3, -0.100000001, 3, 0, 0, 1, 0, 1, -0, -1, 0, 0)
  1751. ManualWeld53.C1 = CFrame.new(-3, -0.100000001, 3, 0, 0, 1, 0, 1, -0, -1, 0, 0)
  1752. ManualWeld53.Part0 = Part50
  1753. Model54.Parent = mas
  1754. Model55.Name = "Zombie"
  1755. Model55.Parent = Model54
  1756. Script56.Name = "Ragdoller"
  1757. Script56.Parent = Model55
  1758. table.insert(cors,sandbox(Script56,function()
  1759. print("Ragdoll script activated")
  1760. Gibs = game.Workspace
  1761.  
  1762. function getKillerOfHumanoidIfStillInGame(humanoid)
  1763. local tag = humanoid:findFirstChild("creator")
  1764. if tag ~= nil then
  1765. local killer = tag.Value
  1766. if killer.Parent ~= nil then
  1767. return killer
  1768. end
  1769. end
  1770. return nil
  1771. end
  1772.  
  1773. function OnDeath(Character)
  1774. local svch = Character
  1775. local hum = Character:findFirstChild("Humanoid")
  1776. local getkiller = getKillerOfHumanoidIfStillInGame(hum)
  1777. Character.Archivable = true
  1778. local chrclone = Character:clone()
  1779. Character.Archivable = false
  1780.  
  1781. local ch = chrclone:GetChildren()
  1782. local i
  1783. for i = 1,#ch do
  1784. if ch[i].Name == "THandle1" or ch[i].Name == "THandle2" or ch[i].ClassName == "Script" then
  1785. ch[i]:remove()
  1786. end
  1787. end
  1788. local function Scan(ch)
  1789. local e
  1790. for e = 1,#ch do
  1791. Scan(ch[e]:GetChildren())
  1792. if ch[e].ClassName == "Weld" or ch[e].ClassName == "Motor6D" then
  1793. ch[e]:remove()
  1794. end
  1795. end
  1796. end
  1797. Scan(chrclone:GetChildren())
  1798.  
  1799. local hum2 = chrclone:findFirstChild("Humanoid")
  1800.  
  1801.  
  1802. if hum2 ~= nil then
  1803. hum2.Name = "Humanoid2"
  1804. hum2.PlatformStand = true
  1805. hum2.Sit = true
  1806. hum2.MaxHealth = 0
  1807. hum2.Health = 0
  1808. end
  1809.  
  1810. local ch = Character:GetChildren()
  1811. local i
  1812. for i = 1,#ch do
  1813. if ch[i].Name == "THandle1" or ch[i].Name == "THandle2" then
  1814. ch[i]:remove()
  1815. end
  1816. end
  1817.  
  1818. wait(0.2)
  1819.  
  1820. local ch = Character:GetChildren()
  1821. local i
  1822. for i = 1,#ch do
  1823. if ch[i].ClassName == "Part" or ch[i].ClassName == "Hat" or ch[i].Name == "THandle1" or ch[i].Name == "THandle2" then
  1824. ch[i]:remove()
  1825. end
  1826. end
  1827. Character = chrclone
  1828. local Torso = Character.Torso
  1829. local movevector = Vector3.new()
  1830.  
  1831. if Torso then
  1832. if getkiller ~= nil then
  1833. if getkiller.Character ~= nil then
  1834. local killtors = getkiller.Character:findFirstChild("Torso")
  1835. if killtors ~= nil then
  1836. movevector = CFrame.new(killtors.Position,Torso.Position).lookVector
  1837. end
  1838. end
  1839. end
  1840. local Head = Character:FindFirstChild("Head")
  1841. if Head then
  1842. local Neck = Instance.new("Weld")
  1843. Neck.Name = "Neck"
  1844. Neck.Part0 = Torso
  1845. Neck.Part1 = Head
  1846. Neck.C0 = CFrame.new(0, 1.5, 0)
  1847. Neck.C1 = CFrame.new()
  1848. Neck.Parent = Torso
  1849.  
  1850. local nsc = script.CamAttach:clone()
  1851. nsc.CamPart.Value = hum2.Parent.Head
  1852. nsc.Disabled = false
  1853. nsc.Parent = svch
  1854. end
  1855. local Limb = Character:FindFirstChild("Right Arm")
  1856. if Limb then
  1857.  
  1858. Limb.CFrame = Torso.CFrame * CFrame.new(1.5, 0, 0)
  1859. local Joint = Instance.new("Glue")
  1860. Joint.Name = "RightShoulder"
  1861. Joint.Part0 = Torso
  1862. Joint.Part1 = Limb
  1863. Joint.C0 = CFrame.new(1.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  1864. Joint.C1 = CFrame.new(-0, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  1865. Joint.Parent = Torso
  1866.  
  1867. local B = Instance.new("Part")
  1868. B.TopSurface = 0
  1869. B.BottomSurface = 0
  1870. B.formFactor = "Symmetric"
  1871. B.Size = Vector3.new(1, 1, 1)
  1872. B.Transparency = 1
  1873. B.CFrame = Limb.CFrame * CFrame.new(0, -0.5, 0)
  1874. B.Parent = Character
  1875. local W = Instance.new("Weld")
  1876. W.Part0 = Limb
  1877. W.Part1 = B
  1878. W.C0 = CFrame.new(0, -0.5, 0)
  1879. W.Parent = Limb
  1880.  
  1881. end
  1882. local Limb = Character:FindFirstChild("Left Arm")
  1883. if Limb then
  1884.  
  1885. Limb.CFrame = Torso.CFrame * CFrame.new(-1.5, 0, 0)
  1886. local Joint = Instance.new("Glue")
  1887. Joint.Name = "LeftShoulder"
  1888. Joint.Part0 = Torso
  1889. Joint.Part1 = Limb
  1890. Joint.C0 = CFrame.new(-1.5, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  1891. Joint.C1 = CFrame.new(0, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  1892. Joint.Parent = Torso
  1893.  
  1894. local B = Instance.new("Part")
  1895. B.TopSurface = 0
  1896. B.BottomSurface = 0
  1897. B.formFactor = "Symmetric"
  1898. B.Size = Vector3.new(1, 1, 1)
  1899. B.Transparency = 1
  1900. B.CFrame = Limb.CFrame * CFrame.new(0, -0.5, 0)
  1901. B.Parent = Character
  1902. local W = Instance.new("Weld")
  1903. W.Part0 = Limb
  1904. W.Part1 = B
  1905. W.C0 = CFrame.new(0, -0.5, 0)
  1906. W.Parent = Limb
  1907.  
  1908. end
  1909. local Limb = Character:FindFirstChild("Right Leg")
  1910. if Limb then
  1911.  
  1912. Limb.CFrame = Torso.CFrame * CFrame.new(0.5, -2, 0)
  1913. local Joint = Instance.new("Glue")
  1914. Joint.Name = "RightHip"
  1915. Joint.Part0 = Torso
  1916. Joint.Part1 = Limb
  1917. Joint.C0 = CFrame.new(0.5, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  1918. Joint.C1 = CFrame.new(0, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  1919. Joint.Parent = Torso
  1920.  
  1921. local B = Instance.new("Part")
  1922. B.TopSurface = 0
  1923. B.BottomSurface = 0
  1924. B.formFactor = "Symmetric"
  1925. B.Size = Vector3.new(1, 1, 1)
  1926. B.Transparency = 1
  1927. B.CFrame = Limb.CFrame * CFrame.new(0, -0.5, 0)
  1928. B.Parent = Character
  1929. local W = Instance.new("Weld")
  1930. W.Part0 = Limb
  1931. W.Part1 = B
  1932. W.C0 = CFrame.new(0, -0.5, 0)
  1933. W.Parent = Limb
  1934.  
  1935. end
  1936. local Limb = Character:FindFirstChild("Left Leg")
  1937. if Limb then
  1938.  
  1939. Limb.CFrame = Torso.CFrame * CFrame.new(-0.5, -2, 0)
  1940. local Joint = Instance.new("Glue")
  1941. Joint.Name = "LeftHip"
  1942. Joint.Part0 = Torso
  1943. Joint.Part1 = Limb
  1944. Joint.C0 = CFrame.new(-0.5, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  1945. Joint.C1 = CFrame.new(-0, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  1946. Joint.Parent = Torso
  1947.  
  1948. local B = Instance.new("Part")
  1949. B.TopSurface = 0
  1950. B.BottomSurface = 0
  1951. B.formFactor = "Symmetric"
  1952. B.Size = Vector3.new(1, 1, 1)
  1953. B.Transparency = 1
  1954. B.CFrame = Limb.CFrame * CFrame.new(0, -0.5, 0)
  1955. B.Parent = Character
  1956. local W = Instance.new("Weld")
  1957. W.Part0 = Limb
  1958. W.Part1 = B
  1959. W.C0 = CFrame.new(0, -0.5, 0)
  1960. W.Parent = Limb
  1961.  
  1962. end
  1963. --[
  1964. local Bar = Instance.new("Part")
  1965. Bar.TopSurface = 0
  1966. Bar.BottomSurface = 0
  1967. Bar.formFactor = "Symmetric"
  1968. Bar.Size = Vector3.new(1, 1, 1)
  1969. Bar.Transparency = 1
  1970. Bar.CFrame = Torso.CFrame * CFrame.new(0, 0.5, 0)
  1971. Bar.Parent = Character
  1972. local Weld = Instance.new("Weld")
  1973. Weld.Part0 = Torso
  1974. Weld.Part1 = Bar
  1975. Weld.C0 = CFrame.new(0, 0.5, 0)
  1976. Weld.Parent = Torso
  1977. --]]
  1978. end
  1979. Character.Parent = Gibs
  1980. game.Debris:AddItem(Character, 12)
  1981. if movevector ~= Vector3.new() then
  1982. for i = 1,10 do
  1983. wait()
  1984. Torso.Velocity = movevector * 30
  1985. end
  1986. end
  1987. end
  1988.  
  1989. script.Parent.Humanoid.Died:connect(function()
  1990. OnDeath(script.Parent)
  1991. end)
  1992.  
  1993.  
  1994. end))
  1995. LocalScript57.Name = "CamAttach"
  1996. LocalScript57.Parent = Script56
  1997. LocalScript57.Disabled = true
  1998. table.insert(cors,sandbox(LocalScript57,function()
  1999. wait()
  2000. game.Workspace.CurrentCamera.CameraSubject = script.CamPart.Value
  2001. end))
  2002. ObjectValue58.Name = "CamPart"
  2003. ObjectValue58.Parent = LocalScript57
  2004. Script59.Name = "ZombieScript"
  2005. Script59.Parent = Model55
  2006. table.insert(cors,sandbox(Script59,function()
  2007. wait()
  2008. -- Handles damage, sounds
  2009.  
  2010. local hum = script.Parent:FindFirstChild("Humanoid")
  2011. local torso = script.Parent:FindFirstChild("HumanoidRootPart")
  2012. local head = script.Parent:FindFirstChild("Head")
  2013.  
  2014. DB = false
  2015. local function onTouch(hit)
  2016. if DB then return end
  2017. if hit == nil then return end
  2018. if hit.Parent == nil then return end
  2019. local vhum = hit.Parent:FindFirstChild("Humanoid")
  2020. if vhum ~= nil then
  2021. if hum.Health <= 0 then return end
  2022. if vhum ~= hum and not hit.Parent:FindFirstChild("ZombieScript") then -- keeps it from hurting itself/ zombies
  2023. vhum:TakeDamage(math.random(6, 9))
  2024. DB = true
  2025. wait(1)
  2026. DB = false
  2027. end
  2028. end
  2029. end
  2030. torso.Touched:connect(onTouch)
  2031.  
  2032. local zombienoises = {93591696, 208668860, 179266532, 229895387, 150076506}
  2033. local moan = head:FindFirstChild("Moan")
  2034.  
  2035. while head ~= nil do
  2036. wait(math.random(6, 13))
  2037. moan.Pitch = math.random(8, 10)/10
  2038. moan.SoundId = "rbxassetid://"..tostring(zombienoises[math.random(1, #zombienoises)])
  2039. moan:Play()
  2040. end
  2041.  
  2042. end))
  2043. Script60.Name = "Follow"
  2044. Script60.Parent = Model55
  2045. table.insert(cors,sandbox(Script60,function()
  2046. wait()
  2047. local hum = script.Parent:FindFirstChild("Humanoid")
  2048. local torso = script.Parent:FindFirstChild("HumanoidRootPart")
  2049.  
  2050. local max_dist = 200
  2051.  
  2052. function findNearestTorso()
  2053. for _, player in pairs(game.Players:GetPlayers()) do
  2054. if player.Character ~= nil then
  2055. local target_torso = player.Character:FindFirstChild("HumanoidRootPart")
  2056. if target_torso ~= nil then
  2057. if (target_torso.Position - torso.Position).magnitude < max_dist then
  2058. return target_torso
  2059. end
  2060. end
  2061. end
  2062. end
  2063. end
  2064.  
  2065. local old_pos = torso.Position
  2066.  
  2067. wait(math.random(0, 90)/100)
  2068.  
  2069. while hum ~= nil do
  2070. local target = findNearestTorso()
  2071. if target ~= nil then
  2072. while target ~= nil and target.Parent ~= nil and hum ~= nil do
  2073. if (target.Position - torso.Position).magnitude < max_dist then
  2074. hum:MoveTo(target.Position, target)
  2075. if target.Position.Y > torso.Position.Y + 3 then
  2076. hum.Jump = true
  2077. end
  2078. if (old_pos - torso.Position).magnitude < 0.5 then
  2079. if math.random(1, 3) == 1 then
  2080. torso.Velocity = torso.CFrame.lookVector * -40
  2081. hum:MoveTo(torso.Position + Vector3.new(math.random(-1, 1), 0, math.random(-1, 1))*20)
  2082. wait(1.2)
  2083. else
  2084. hum.Jump = true
  2085. hum:MoveTo(target.Position, target)
  2086. end
  2087. end
  2088. else break end
  2089. old_pos = torso.Position
  2090. wait(0.5)
  2091. end
  2092. end
  2093. wait(4)
  2094. end
  2095. end))
  2096. Script61.Name = "Die"
  2097. Script61.Parent = Model55
  2098. table.insert(cors,sandbox(Script61,function()
  2099. human = script.Parent.Humanoid
  2100. --tool = script.Parent.Pistol
  2101.  
  2102. function Die()
  2103. --if tool ~= nil then tool:remove() end
  2104. game.workspace.Scripts.WaveScript.Dead_Zombies.Value = game.workspace.Scripts.WaveScript.Dead_Zombies.Value + 1
  2105. wait(2.5)
  2106. script.Parent:remove()
  2107. end
  2108.  
  2109. human.Died:connect(Die)
  2110. end))
  2111. Script62.Name = "ZombieScript"
  2112. Script62.Parent = Model55
  2113. table.insert(cors,sandbox(Script62,function()
  2114. --Made by Stickmasterluke
  2115.  
  2116. --Zombie artificial stupidity script
  2117.  
  2118.  
  2119. sp=script.Parent
  2120. lastattack=0
  2121. nextrandom=0
  2122. nextsound=0
  2123. nextjump=0
  2124. chasing=false
  2125.  
  2126. variance=4
  2127.  
  2128. damage=10
  2129. attackrange=4.5
  2130. sightrange=999--60
  2131. runspeed=10
  2132. wonderspeed=8
  2133. healthregen=false
  2134. colors={"Sand red","Dusty Rose","Medium blue","Sand blue","Lavender","Earth green","Brown","Medium stone grey","Brick yellow"}
  2135.  
  2136. function raycast(spos,vec,currentdist)
  2137. local hit2,pos2=game.Workspace:FindPartOnRay(Ray.new(spos+(vec*.01),vec*currentdist),script.Parent)
  2138. if hit2~=nil and pos2 then
  2139. if hit2.Parent==script.Parent and hit2.Transparency>=.8 or hit2.Name=="Handle" or string.sub(hit2.Name,1,6)=="Effect" or hit2.Parent:IsA("Hat") or hit2.Parent:IsA("Tool") or (hit2.Parent:FindFirstChild("Humanoid") and hit2.Parent:FindFirstChild("TEAM") and hit2.Parent:FindFirstChild("TEAM").Value == script.Parent.TEAM.Value) or (not hit2.Parent:FindFirstChild("Humanoid") and hit2.CanCollide==false) then
  2140. local currentdist=currentdist-(pos2-spos).magnitude
  2141. return raycast(pos2,vec,currentdist)
  2142. end
  2143. end
  2144. return hit2,pos2
  2145. end
  2146.  
  2147. function waitForChild(parent,childName)
  2148. local child=parent:findFirstChild(childName)
  2149. if child then return child end
  2150. while true do
  2151. child=parent.ChildAdded:wait()
  2152. if child.Name==childName then return child end
  2153. end
  2154. end
  2155.  
  2156. -- ANIMATION
  2157.  
  2158. -- declarations
  2159.  
  2160. local Torso=waitForChild(sp,"Torso")
  2161. local Head=waitForChild(sp,"Head")
  2162. local RightShoulder=waitForChild(Torso,"Right Shoulder")
  2163. local LeftShoulder=waitForChild(Torso,"Left Shoulder")
  2164. local RightHip=waitForChild(Torso,"Right Hip")
  2165. local LeftHip=waitForChild(Torso,"Left Hip")
  2166. local Neck=waitForChild(Torso,"Neck")
  2167. local Humanoid=waitForChild(sp,"Humanoid")
  2168. local BodyColors=waitForChild(sp,"Body Colors")
  2169. local pose="Standing"
  2170. local hitsound=waitForChild(Torso,"HitSound")
  2171. local Anim = Humanoid:LoadAnimation(sp.AttackAnim)
  2172.  
  2173. --[[local sounds={
  2174. waitForChild(Torso,"GroanSound"),
  2175. waitForChild(Torso,"RawrSound")
  2176. }]]
  2177.  
  2178. if healthregen then
  2179. local regenscript=waitForChild(sp,"HealthRegenerationScript")
  2180. regenscript.Disabled=false
  2181. end
  2182. Humanoid.WalkSpeed=wonderspeed
  2183.  
  2184. local toolAnim="None"
  2185. local toolAnimTime=0
  2186.  
  2187. --[[BodyColors.HeadColor=BrickColor.new("Grime")
  2188. local randomcolor1=colors[math.random(1,#colors)]
  2189. BodyColors.TorsoColor=BrickColor.new(randomcolor1)
  2190. BodyColors.LeftArmColor=BrickColor.new(randomcolor1)
  2191. BodyColors.RightArmColor=BrickColor.new(randomcolor1)
  2192. local randomcolor2=colors[math.random(1,#colors)]
  2193. BodyColors.LeftLegColor=BrickColor.new(randomcolor2)
  2194. BodyColors.RightLegColor=BrickColor.new(randomcolor2)]]
  2195.  
  2196.  
  2197. function onRunning(speed)
  2198. if speed>0 then
  2199. pose="Running"
  2200. else
  2201. pose="Standing"
  2202. end
  2203. end
  2204. function onDied()
  2205. pose="Dead"
  2206. end
  2207. function onJumping()
  2208. pose="Jumping"
  2209. end
  2210. function onClimbing()
  2211. pose="Climbing"
  2212. end
  2213. function onGettingUp()
  2214. pose = "GettingUp"
  2215. end
  2216. function onFreeFall()
  2217. pose = "FreeFall"
  2218. end
  2219. function onFallingDown()
  2220. pose = "FallingDown"
  2221. end
  2222. function onSeated()
  2223. pose = "Seated"
  2224. end
  2225. function onPlatformStanding()
  2226. pose = "PlatformStanding"
  2227. end
  2228.  
  2229. function moveJump()
  2230. RightShoulder.MaxVelocity = 0.5
  2231. LeftShoulder.MaxVelocity = 0.5
  2232. RightShoulder.DesiredAngle=3.14
  2233. LeftShoulder.DesiredAngle=-3.14
  2234. RightHip.DesiredAngle=0
  2235. LeftHip.DesiredAngle=0
  2236. end
  2237.  
  2238. function moveFreeFall()
  2239. RightShoulder.MaxVelocity = 0.5
  2240. LeftShoulder.MaxVelocity =0.5
  2241. RightShoulder.DesiredAngle=3.14
  2242. LeftShoulder.DesiredAngle=-3.14
  2243. RightHip.DesiredAngle=0
  2244. LeftHip.DesiredAngle=0
  2245. end
  2246.  
  2247. function moveSit()
  2248. RightShoulder.MaxVelocity = 0.15
  2249. LeftShoulder.MaxVelocity = 0.15
  2250. RightShoulder.DesiredAngle=3.14 /2
  2251. LeftShoulder.DesiredAngle=-3.14 /2
  2252. RightHip.DesiredAngle=3.14 /2
  2253. LeftHip.DesiredAngle=-3.14 /2
  2254. end
  2255.  
  2256. function animate(time)
  2257. local amplitude
  2258. local frequency
  2259. if (pose == "Jumping") then
  2260. moveJump()
  2261. return
  2262. end
  2263. if (pose == "FreeFall") then
  2264. moveFreeFall()
  2265. return
  2266. end
  2267. if (pose == "Seated") then
  2268. moveSit()
  2269. return
  2270. end
  2271. local climbFudge = 0
  2272. if (pose == "Running") then
  2273. RightShoulder.MaxVelocity = 0.15
  2274. LeftShoulder.MaxVelocity = 0.15
  2275. amplitude = 1
  2276. frequency = 9
  2277. elseif (pose == "Climbing") then
  2278. RightShoulder.MaxVelocity = 0.5
  2279. LeftShoulder.MaxVelocity = 0.5
  2280. amplitude = 1
  2281. frequency = 9
  2282. climbFudge = 3.14
  2283. else
  2284. amplitude = 0.1
  2285. frequency = 1
  2286. end
  2287. desiredAngle = amplitude * math.sin(time*frequency)
  2288. if not chasing and frequency==9 then
  2289. frequency=4
  2290. end
  2291. if chasing then
  2292. --[[RightShoulder.DesiredAngle=math.pi/2
  2293. LeftShoulder.DesiredAngle=-math.pi/2
  2294. RightHip.DesiredAngle=-desiredAngle*2
  2295. LeftHip.DesiredAngle=-desiredAngle*2]]
  2296. else
  2297. RightShoulder.DesiredAngle=desiredAngle + climbFudge
  2298. LeftShoulder.DesiredAngle=desiredAngle - climbFudge
  2299. RightHip.DesiredAngle=-desiredAngle
  2300. LeftHip.DesiredAngle=-desiredAngle
  2301. end
  2302. end
  2303.  
  2304.  
  2305. function attack(time,attackpos)
  2306. if time-lastattack>=0.25 then
  2307. local hit,pos=raycast(Torso.Position,(attackpos-Torso.Position).unit,attackrange)
  2308. if hit and hit.Parent~=nil then
  2309. local h=hit.Parent:FindFirstChild("Humanoid")
  2310. local TEAM=hit.Parent:FindFirstChild("TEAM")
  2311. if h and TEAM and TEAM.Value~=sp.TEAM.Value then
  2312. local creator=sp:FindFirstChild("creator")
  2313. if creator then
  2314. if creator.Value~=nil then
  2315. if creator.Value~=game.Players:GetPlayerFromCharacter(h.Parent) then
  2316. for i,oldtag in ipairs(h:GetChildren()) do
  2317. if oldtag.Name=="creator" then
  2318. oldtag:remove()
  2319. end
  2320. end
  2321. creator:clone().Parent=h
  2322. else
  2323. return
  2324. end
  2325. end
  2326. end
  2327. if Anim then Anim:Play(nil,nil,1.5) end
  2328. h:TakeDamage(damage)
  2329. hitsound.Volume=1
  2330. hitsound.Pitch=.75+(math.random()*.5)
  2331. hitsound:Play()
  2332. --[[if RightShoulder and LeftShoulder then
  2333. RightShoulder.CurrentAngle=0
  2334. LeftShoulder.CurrentAngle=0
  2335. end]]
  2336. end
  2337. end
  2338. lastattack=time
  2339. end
  2340. end
  2341.  
  2342.  
  2343. Humanoid.Died:connect(onDied)
  2344. Humanoid.Running:connect(onRunning)
  2345. Humanoid.Jumping:connect(onJumping)
  2346. Humanoid.Climbing:connect(onClimbing)
  2347. Humanoid.GettingUp:connect(onGettingUp)
  2348. Humanoid.FreeFalling:connect(onFreeFall)
  2349. Humanoid.FallingDown:connect(onFallingDown)
  2350. Humanoid.Seated:connect(onSeated)
  2351. Humanoid.PlatformStanding:connect(onPlatformStanding)
  2352.  
  2353.  
  2354. function populatehumanoids(mdl)
  2355. if mdl.ClassName=="Humanoid" then
  2356. if mdl.Parent:FindFirstChild("TEAM") and mdl.Parent:FindFirstChild("TEAM").Value~=sp.TEAM.Value then
  2357. table.insert(humanoids,mdl)
  2358. end
  2359. end
  2360. for i2,mdl2 in ipairs(mdl:GetChildren()) do
  2361. populatehumanoids(mdl2)
  2362. end
  2363. end
  2364.  
  2365. --[[function playsound(time)
  2366. nextsound=time+5+(math.random()*5)
  2367. local randomsound=sounds[math.random(1,#sounds)]
  2368. randomsound.Volume=.5+(.5*math.random())
  2369. randomsound.Pitch=.5+(.5*math.random())
  2370. randomsound:Play()
  2371. end]]
  2372.  
  2373. while sp.Parent~=nil and Humanoid and Humanoid.Parent~=nil and Humanoid.Health>0 and Torso and Head and Torso~=nil and Torso.Parent~=nil do
  2374. local _,time=wait(0.25)--wait(1/3)
  2375. humanoids={}
  2376. populatehumanoids(game.Workspace)
  2377. closesttarget=nil
  2378. closestdist=sightrange
  2379. local creator=sp:FindFirstChild("creator")
  2380. for i,h in ipairs(humanoids) do
  2381. if h and h.Parent~=nil then
  2382. if h.Health>0 and h.Parent~=sp then
  2383. local plr=game.Players:GetPlayerFromCharacter(h.Parent)
  2384. if creator==nil or plr==nil or creator.Value~=plr then
  2385. local t=h.Parent:FindFirstChild("Torso")
  2386. if t~=nil then
  2387. local dist=(t.Position-Torso.Position).magnitude
  2388. if dist<closestdist then
  2389. closestdist=dist
  2390. closesttarget=t
  2391. end
  2392. end
  2393. end
  2394. end
  2395. end
  2396. end
  2397. if closesttarget~=nil then
  2398. if not chasing then
  2399. --playsound(time)
  2400. chasing=true
  2401. Humanoid.WalkSpeed=runspeed
  2402. end
  2403. Humanoid:MoveTo(closesttarget.Position+(Vector3.new(1,1,1)*(variance*((math.random()*2)-1))),closesttarget)
  2404. if math.random()<.5 then
  2405. attack(time,closesttarget.Position)
  2406. end
  2407. else
  2408. if chasing then
  2409. chasing=false
  2410. Humanoid.WalkSpeed=wonderspeed
  2411. end
  2412. if time>nextrandom then
  2413. nextrandom=time+3+(math.random()*5)
  2414. local randompos=Torso.Position+((Vector3.new(1,1,1)*math.random()-Vector3.new(.5,.5,.5))*40)
  2415. Humanoid:MoveTo(randompos,game.Workspace.Terrain)
  2416. end
  2417. end
  2418. if time>nextsound then
  2419. --playsound(time)
  2420. end
  2421. if time>nextjump then
  2422. nextjump=time+7+(math.random()*5)
  2423. Humanoid.Jump=true
  2424. end
  2425. animate(time)
  2426. end
  2427.  
  2428. wait(4)
  2429. sp:remove() --Rest In Pizza
  2430.  
  2431. end))
  2432. Animation63.Name = "AttackAnim"
  2433. Animation63.Parent = Model55
  2434. Animation63.AnimationId = "http://www.roblox.com/Asset?ID=105211514"
  2435. BodyColors64.Parent = Model55
  2436. BodyColors64.HeadColor = BrickColor.new("Medium green")
  2437. BodyColors64.LeftArmColor = BrickColor.new("Medium green")
  2438. BodyColors64.LeftLegColor = BrickColor.new("Reddish brown")
  2439. BodyColors64.RightArmColor = BrickColor.new("Medium green")
  2440. BodyColors64.RightLegColor = BrickColor.new("Reddish brown")
  2441. BodyColors64.TorsoColor = BrickColor.new("Reddish brown")
  2442. BrickColorValue65.Name = "TEAM"
  2443. BrickColorValue65.Parent = Model55
  2444. BrickColorValue65.Value = BrickColor.new("Bright green")
  2445. Script66.Name = "Sound"
  2446. Script66.Parent = Model55
  2447. table.insert(cors,sandbox(Script66,function()
  2448. -- util
  2449.  
  2450. function waitForChild(parent, childName)
  2451. local child = parent:findFirstChild(childName)
  2452. if child then return child end
  2453. while true do
  2454. child = parent.ChildAdded:wait()
  2455. if child.Name==childName then return child end
  2456. end
  2457. end
  2458.  
  2459. function newSound(id)
  2460. local sound = Instance.new("Sound")
  2461. sound.SoundId = id
  2462. sound.archivable = false
  2463. sound.Parent = script.Parent.Head
  2464. return sound
  2465. end
  2466.  
  2467. -- declarations
  2468.  
  2469. local sDied = newSound("rbxasset://sounds/uuhhh.wav")
  2470. sDied.Pitch = 0.75
  2471. local sFallingDown = newSound("rbxasset://sounds/splat.wav")
  2472. local sFreeFalling = newSound("rbxasset://sounds/swoosh.wav")
  2473. local sGettingUp = newSound("rbxasset://sounds/hit.wav")
  2474. local sJumping = newSound("rbxasset://sounds/button.wav")
  2475. local sRunning = newSound("rbxasset://sounds/bfsl-minifigfoots1.mp3")
  2476. sRunning.Looped = true
  2477.  
  2478. local Figure = script.Parent
  2479. local Head = waitForChild(Figure, "Head")
  2480. local Humanoid = waitForChild(Figure, "Humanoid")
  2481.  
  2482. -- functions
  2483.  
  2484. function onDied()
  2485. sDied:Play()
  2486. wait(2.5)
  2487. script.Parent:Destroy()
  2488. end
  2489.  
  2490. function onState(state, sound)
  2491. if state then
  2492. sound:Play()
  2493. else
  2494. sound:Pause()
  2495. end
  2496. end
  2497.  
  2498. function onRunning(speed)
  2499. if speed>0 then
  2500. sRunning:Play()
  2501. else
  2502. sRunning:Pause()
  2503. end
  2504. end
  2505.  
  2506. -- connect up
  2507.  
  2508. Humanoid.Died:connect(onDied)
  2509. Humanoid.Running:connect(onRunning)
  2510. Humanoid.Jumping:connect(function(state) onState(state, sJumping) end)
  2511. Humanoid.GettingUp:connect(function(state) onState(state, sGettingUp) end)
  2512. Humanoid.FreeFalling:connect(function(state) onState(state, sFreeFalling) end)
  2513. Humanoid.FallingDown:connect(function(state) onState(state, sFallingDown) end)
  2514.  
  2515. end))
  2516. Humanoid67.Parent = Model55
  2517. Humanoid67.RightLeg = Part92
  2518. Humanoid67.LeftLeg = Part93
  2519. Humanoid67.Torso = Part101
  2520. Script68.Name = "HealthRegenerationScript"
  2521. Script68.Parent = Model55
  2522. Script68.Disabled = true
  2523. table.insert(cors,sandbox(Script68,function()
  2524. -- Renegeration Script for the bot
  2525. -- Renegerates about 1% of max hp per second until it reaches max health
  2526. bot = script.Parent
  2527. Humanoid = bot:FindFirstChild("Humanoid")
  2528.  
  2529. local regen = false
  2530.  
  2531. function regenerate()
  2532. if regen then return end
  2533. -- Lock this function until the regeneration to max health is complete by using a boolean toggle
  2534. regen = true
  2535. while Humanoid.Health < Humanoid.MaxHealth do
  2536. local delta = wait(1)
  2537. local health = Humanoid.Health
  2538. if health > 0 and health < Humanoid.MaxHealth then
  2539. -- This delta is for regenerating 1% of max hp per second instead of 1 hp per second
  2540. delta = 0.01 * delta * Humanoid.MaxHealth
  2541. health = health + delta
  2542. Humanoid.Health = math.min(health, Humanoid.MaxHealth)
  2543. end
  2544. end
  2545. -- release the lock, since the health is at max now, and if the character loses health again
  2546. -- it needs to start regenerating
  2547. regen = false
  2548. end
  2549.  
  2550. if Humanoid then
  2551. -- Better than a while true do loop since it only fires when the health actually changes
  2552. Humanoid.HealthChanged:connect(regenerate)
  2553. end
  2554.  
  2555. end))
  2556. Script69.Name = "Animate"
  2557. Script69.Parent = Model55
  2558. table.insert(cors,sandbox(Script69,function()
  2559. function waitForChild(parent, childName)
  2560. local child = parent:findFirstChild(childName)
  2561. if child then return child end
  2562. while true do
  2563. child = parent.ChildAdded:wait()
  2564. if child.Name==childName then return child end
  2565. end
  2566. end
  2567.  
  2568. local Figure = script.Parent
  2569. local Torso = waitForChild(Figure, "Torso")
  2570. local RightShoulder = waitForChild(Torso, "Right Shoulder")
  2571. local LeftShoulder = waitForChild(Torso, "Left Shoulder")
  2572. local RightHip = waitForChild(Torso, "Right Hip")
  2573. local LeftHip = waitForChild(Torso, "Left Hip")
  2574. local Neck = waitForChild(Torso, "Neck")
  2575. local Humanoid = waitForChild(Figure, "Humanoid")
  2576. local pose = "Standing"
  2577.  
  2578. local currentAnim = ""
  2579. local currentAnimTrack = nil
  2580. local currentAnimKeyframeHandler = nil
  2581. local currentAnimSpeed = 1.0
  2582. local animTable = {}
  2583. local animNames = {
  2584. idle = {
  2585. { id = "http://www.roblox.com/asset/?id=125750544", weight = 9 },
  2586. { id = "http://www.roblox.com/asset/?id=125750618", weight = 1 }
  2587. },
  2588. walk = {
  2589. { id = "http://www.roblox.com/asset/?id=125749145", weight = 10 }
  2590. },
  2591. run = {
  2592. { id = "run.xml", weight = 10 }
  2593. },
  2594. jump = {
  2595. { id = "http://www.roblox.com/asset/?id=125750702", weight = 10 }
  2596. },
  2597. fall = {
  2598. { id = "http://www.roblox.com/asset/?id=125750759", weight = 10 }
  2599. },
  2600. climb = {
  2601. { id = "http://www.roblox.com/asset/?id=125750800", weight = 10 }
  2602. },
  2603. toolnone = {
  2604. { id = "http://www.roblox.com/asset/?id=125750867", weight = 10 }
  2605. },
  2606. toolslash = {
  2607. { id = "http://www.roblox.com/asset/?id=129967390", weight = 10 }
  2608. -- { id = "slash.xml", weight = 10 }
  2609. },
  2610. toollunge = {
  2611. { id = "http://www.roblox.com/asset/?id=129967478", weight = 10 }
  2612. },
  2613. wave = {
  2614. { id = "http://www.roblox.com/asset/?id=128777973", weight = 10 }
  2615. },
  2616. point = {
  2617. { id = "http://www.roblox.com/asset/?id=128853357", weight = 10 }
  2618. },
  2619. dance = {
  2620. { id = "http://www.roblox.com/asset/?id=130018893", weight = 10 },
  2621. { id = "http://www.roblox.com/asset/?id=132546839", weight = 10 },
  2622. { id = "http://www.roblox.com/asset/?id=132546884", weight = 10 }
  2623. },
  2624. dance2 = {
  2625. { id = "http://www.roblox.com/asset/?id=160934142", weight = 10 },
  2626. { id = "http://www.roblox.com/asset/?id=160934298", weight = 10 },
  2627. { id = "http://www.roblox.com/asset/?id=160934376", weight = 10 }
  2628. },
  2629. dance3 = {
  2630. { id = "http://www.roblox.com/asset/?id=160934458", weight = 10 },
  2631. { id = "http://www.roblox.com/asset/?id=160934530", weight = 10 },
  2632. { id = "http://www.roblox.com/asset/?id=160934593", weight = 10 }
  2633. },
  2634. laugh = {
  2635. { id = "http://www.roblox.com/asset/?id=129423131", weight = 10 }
  2636. },
  2637. cheer = {
  2638. { id = "http://www.roblox.com/asset/?id=129423030", weight = 10 }
  2639. },
  2640. }
  2641.  
  2642. -- Existance in this list signifies that it is an emote, the value indicates if it is a looping emote
  2643. local emoteNames = { wave = false, point = false, dance = true, dance2 = true, dance3 = true, laugh = false, cheer = false}
  2644.  
  2645. math.randomseed(tick())
  2646.  
  2647. function configureAnimationSet(name, fileList)
  2648. if (animTable[name] ~= nil) then
  2649. for _, connection in pairs(animTable[name].connections) do
  2650. connection:disconnect()
  2651. end
  2652. end
  2653. animTable[name] = {}
  2654. animTable[name].count = 0
  2655. animTable[name].totalWeight = 0
  2656. animTable[name].connections = {}
  2657.  
  2658. -- check for config values
  2659. local config = script:FindFirstChild(name)
  2660. if (config ~= nil) then
  2661. -- print("Loading anims " .. name)
  2662. table.insert(animTable[name].connections, config.ChildAdded:connect(function(child) configureAnimationSet(name, fileList) end))
  2663. table.insert(animTable[name].connections, config.ChildRemoved:connect(function(child) configureAnimationSet(name, fileList) end))
  2664. local idx = 1
  2665. for _, childPart in pairs(config:GetChildren()) do
  2666. if (childPart:IsA("Animation")) then
  2667. table.insert(animTable[name].connections, childPart.Changed:connect(function(property) configureAnimationSet(name, fileList) end))
  2668. animTable[name][idx] = {}
  2669. animTable[name][idx].anim = childPart
  2670. local weightObject = childPart:FindFirstChild("Weight")
  2671. if (weightObject == nil) then
  2672. animTable[name][idx].weight = 1
  2673. else
  2674. animTable[name][idx].weight = weightObject.Value
  2675. end
  2676. animTable[name].count = animTable[name].count + 1
  2677. animTable[name].totalWeight = animTable[name].totalWeight + animTable[name][idx].weight
  2678. -- print(name .. " [" .. idx .. "] " .. animTable[name][idx].anim.AnimationId .. " (" .. animTable[name][idx].weight .. ")")
  2679. idx = idx + 1
  2680. end
  2681. end
  2682. end
  2683.  
  2684. -- fallback to defaults
  2685. if (animTable[name].count <= 0) then
  2686. for idx, anim in pairs(fileList) do
  2687. animTable[name][idx] = {}
  2688. animTable[name][idx].anim = Instance.new("Animation")
  2689. animTable[name][idx].anim.Name = name
  2690. animTable[name][idx].anim.AnimationId = anim.id
  2691. animTable[name][idx].weight = anim.weight
  2692. animTable[name].count = animTable[name].count + 1
  2693. animTable[name].totalWeight = animTable[name].totalWeight + anim.weight
  2694. -- print(name .. " [" .. idx .. "] " .. anim.id .. " (" .. anim.weight .. ")")
  2695. end
  2696. end
  2697. end
  2698.  
  2699. -- Setup animation objects
  2700. function scriptChildModified(child)
  2701. local fileList = animNames[child.Name]
  2702. if (fileList ~= nil) then
  2703. configureAnimationSet(child.Name, fileList)
  2704. end
  2705. end
  2706.  
  2707. script.ChildAdded:connect(scriptChildModified)
  2708. script.ChildRemoved:connect(scriptChildModified)
  2709.  
  2710.  
  2711. for name, fileList in pairs(animNames) do
  2712. configureAnimationSet(name, fileList)
  2713. end
  2714.  
  2715. -- ANIMATION
  2716.  
  2717. -- declarations
  2718. local toolAnim = "None"
  2719. local toolAnimTime = 0
  2720.  
  2721. local jumpAnimTime = 0
  2722. local jumpAnimDuration = 0.3
  2723.  
  2724. local toolTransitionTime = 0.1
  2725. local fallTransitionTime = 0.3
  2726. local jumpMaxLimbVelocity = 0.75
  2727.  
  2728. -- functions
  2729.  
  2730. function stopAllAnimations()
  2731. local oldAnim = currentAnim
  2732.  
  2733. -- return to idle if finishing an emote
  2734. if (emoteNames[oldAnim] ~= nil and emoteNames[oldAnim] == false) then
  2735. oldAnim = "idle"
  2736. end
  2737.  
  2738. currentAnim = ""
  2739. if (currentAnimKeyframeHandler ~= nil) then
  2740. currentAnimKeyframeHandler:disconnect()
  2741. end
  2742.  
  2743. if (currentAnimTrack ~= nil) then
  2744. currentAnimTrack:Stop()
  2745. currentAnimTrack:Destroy()
  2746. currentAnimTrack = nil
  2747. end
  2748. return oldAnim
  2749. end
  2750.  
  2751. function setAnimationSpeed(speed)
  2752. if speed ~= currentAnimSpeed then
  2753. currentAnimSpeed = speed
  2754. currentAnimTrack:AdjustSpeed(currentAnimSpeed)
  2755. end
  2756. end
  2757.  
  2758. function keyFrameReachedFunc(frameName)
  2759. if (frameName == "End") then
  2760. -- print("Keyframe : ".. frameName)
  2761. local repeatAnim = stopAllAnimations()
  2762. local animSpeed = currentAnimSpeed
  2763. playAnimation(repeatAnim, 0.0, Humanoid)
  2764. setAnimationSpeed(animSpeed)
  2765. end
  2766. end
  2767.  
  2768. -- Preload animations
  2769. function playAnimation(animName, transitionTime, humanoid)
  2770. local idleFromEmote = (animName == "idle" and emoteNames[currentAnim] ~= nil)
  2771. if (animName ~= currentAnim and not idleFromEmote) then
  2772.  
  2773. if (currentAnimTrack ~= nil) then
  2774. currentAnimTrack:Stop(transitionTime)
  2775. currentAnimTrack:Destroy()
  2776. end
  2777.  
  2778. currentAnimSpeed = 1.0
  2779. local roll = math.random(1, animTable[animName].totalWeight)
  2780. local origRoll = roll
  2781. local idx = 1
  2782. while (roll > animTable[animName][idx].weight) do
  2783. roll = roll - animTable[animName][idx].weight
  2784. idx = idx + 1
  2785. end
  2786. -- print(animName .. " " .. idx .. " [" .. origRoll .. "]")
  2787. local anim = animTable[animName][idx].anim
  2788.  
  2789. -- load it to the humanoid; get AnimationTrack
  2790. currentAnimTrack = humanoid:LoadAnimation(anim)
  2791.  
  2792. -- play the animation
  2793. currentAnimTrack:Play(transitionTime)
  2794. currentAnim = animName
  2795.  
  2796. -- set up keyframe name triggers
  2797. if (currentAnimKeyframeHandler ~= nil) then
  2798. currentAnimKeyframeHandler:disconnect()
  2799. end
  2800. currentAnimKeyframeHandler = currentAnimTrack.KeyframeReached:connect(keyFrameReachedFunc)
  2801. end
  2802. end
  2803.  
  2804. -------------------------------------------------------------------------------------------
  2805. -------------------------------------------------------------------------------------------
  2806.  
  2807. local toolAnimName = ""
  2808. local toolAnimTrack = nil
  2809. local currentToolAnimKeyframeHandler = nil
  2810.  
  2811. function toolKeyFrameReachedFunc(frameName)
  2812. if (frameName == "End") then
  2813. -- print("Keyframe : ".. frameName)
  2814. local repeatAnim = stopToolAnimations()
  2815. playToolAnimation(repeatAnim, 0.0, Humanoid)
  2816. end
  2817. end
  2818.  
  2819.  
  2820. function playToolAnimation(animName, transitionTime, humanoid)
  2821. if (animName ~= toolAnimName) then
  2822.  
  2823. if (toolAnimTrack ~= nil) then
  2824. toolAnimTrack:Stop()
  2825. toolAnimTrack:Destroy()
  2826. transitionTime = 0
  2827. end
  2828.  
  2829. local roll = math.random(1, animTable[animName].totalWeight)
  2830. local origRoll = roll
  2831. local idx = 1
  2832. while (roll > animTable[animName][idx].weight) do
  2833. roll = roll - animTable[animName][idx].weight
  2834. idx = idx + 1
  2835. end
  2836. -- print(animName .. " * " .. idx .. " [" .. origRoll .. "]")
  2837. local anim = animTable[animName][idx].anim
  2838.  
  2839. -- load it to the humanoid; get AnimationTrack
  2840. toolAnimTrack = humanoid:LoadAnimation(anim)
  2841.  
  2842. -- play the animation
  2843. toolAnimTrack:Play(transitionTime)
  2844. toolAnimName = animName
  2845.  
  2846. currentToolAnimKeyframeHandler = toolAnimTrack.KeyframeReached:connect(toolKeyFrameReachedFunc)
  2847. end
  2848. end
  2849.  
  2850. function stopToolAnimations()
  2851. local oldAnim = toolAnimName
  2852.  
  2853. if (currentToolAnimKeyframeHandler ~= nil) then
  2854. currentToolAnimKeyframeHandler:disconnect()
  2855. end
  2856.  
  2857. toolAnimName = ""
  2858. if (toolAnimTrack ~= nil) then
  2859. toolAnimTrack:Stop()
  2860. toolAnimTrack:Destroy()
  2861. toolAnimTrack = nil
  2862. end
  2863.  
  2864.  
  2865. return oldAnim
  2866. end
  2867.  
  2868. -------------------------------------------------------------------------------------------
  2869. -------------------------------------------------------------------------------------------
  2870.  
  2871.  
  2872. function onRunning(speed)
  2873. if speed>0.01 then
  2874. playAnimation("walk", 0.1, Humanoid)
  2875. pose = "Running"
  2876. else
  2877. playAnimation("idle", 0.1, Humanoid)
  2878. pose = "Standing"
  2879. end
  2880. end
  2881.  
  2882. function onDied()
  2883. pose = "Dead"
  2884. end
  2885.  
  2886. function onJumping()
  2887. playAnimation("jump", 0.1, Humanoid)
  2888. jumpAnimTime = jumpAnimDuration
  2889. pose = "Jumping"
  2890. end
  2891.  
  2892. function onClimbing(speed)
  2893. playAnimation("climb", 0.1, Humanoid)
  2894. setAnimationSpeed(speed / 12.0)
  2895. pose = "Climbing"
  2896. end
  2897.  
  2898. function onGettingUp()
  2899. pose = "GettingUp"
  2900. end
  2901.  
  2902. function onFreeFall()
  2903. if (jumpAnimTime <= 0) then
  2904. playAnimation("fall", fallTransitionTime, Humanoid)
  2905. end
  2906. pose = "FreeFall"
  2907. end
  2908.  
  2909. function onFallingDown()
  2910. pose = "FallingDown"
  2911. end
  2912.  
  2913. function onSeated()
  2914. pose = "Seated"
  2915. end
  2916.  
  2917. function onPlatformStanding()
  2918. pose = "PlatformStanding"
  2919. end
  2920.  
  2921. function onSwimming(speed)
  2922. if speed>0 then
  2923. pose = "Running"
  2924. else
  2925. pose = "Standing"
  2926. end
  2927. end
  2928.  
  2929. function getTool()
  2930. for _, kid in ipairs(Figure:GetChildren()) do
  2931. if kid.className == "Tool" then return kid end
  2932. end
  2933. return nil
  2934. end
  2935.  
  2936. function getToolAnim(tool)
  2937. for _, c in ipairs(tool:GetChildren()) do
  2938. if c.Name == "toolanim" and c.className == "StringValue" then
  2939. return c
  2940. end
  2941. end
  2942. return nil
  2943. end
  2944.  
  2945. function animateTool()
  2946.  
  2947. if (toolAnim == "None") then
  2948. playToolAnimation("toolnone", toolTransitionTime, Humanoid)
  2949. return
  2950. end
  2951.  
  2952. if (toolAnim == "Slash") then
  2953. playToolAnimation("toolslash", 0, Humanoid)
  2954. return
  2955. end
  2956.  
  2957. if (toolAnim == "Lunge") then
  2958. playToolAnimation("toollunge", 0, Humanoid)
  2959. return
  2960. end
  2961. end
  2962.  
  2963. function moveSit()
  2964. RightShoulder.MaxVelocity = 0.15
  2965. LeftShoulder.MaxVelocity = 0.15
  2966. RightShoulder:SetDesiredAngle(3.14 /2)
  2967. LeftShoulder:SetDesiredAngle(-3.14 /2)
  2968. RightHip:SetDesiredAngle(3.14 /2)
  2969. LeftHip:SetDesiredAngle(-3.14 /2)
  2970. end
  2971.  
  2972. local lastTick = 0
  2973.  
  2974. function move(time)
  2975. local amplitude = 1
  2976. local frequency = 1
  2977. local deltaTime = time - lastTick
  2978. lastTick = time
  2979.  
  2980. local climbFudge = 0
  2981. local setAngles = false
  2982.  
  2983. if (jumpAnimTime > 0) then
  2984. jumpAnimTime = jumpAnimTime - deltaTime
  2985. end
  2986.  
  2987. if (pose == "FreeFall" and jumpAnimTime <= 0) then
  2988. playAnimation("fall", fallTransitionTime, Humanoid)
  2989. elseif (pose == "Seated") then
  2990. stopAllAnimations()
  2991. moveSit()
  2992. return
  2993. elseif (pose == "Running") then
  2994. playAnimation("walk", 0.1, Humanoid)
  2995. elseif (pose == "Dead" or pose == "GettingUp" or pose == "FallingDown" or pose == "Seated" or pose == "PlatformStanding") then
  2996. -- print("Wha " .. pose)
  2997. amplitude = 0.1
  2998. frequency = 1
  2999. setAngles = true
  3000. end
  3001.  
  3002. if (setAngles) then
  3003. desiredAngle = amplitude * math.sin(time * frequency)
  3004.  
  3005. RightShoulder:SetDesiredAngle(desiredAngle + climbFudge)
  3006. LeftShoulder:SetDesiredAngle(desiredAngle - climbFudge)
  3007. RightHip:SetDesiredAngle(-desiredAngle)
  3008. LeftHip:SetDesiredAngle(-desiredAngle)
  3009. end
  3010.  
  3011. -- Tool Animation handling
  3012. local tool = getTool()
  3013. if tool then
  3014.  
  3015. animStringValueObject = getToolAnim(tool)
  3016.  
  3017. if animStringValueObject then
  3018. toolAnim = animStringValueObject.Value
  3019. -- message recieved, delete StringValue
  3020. animStringValueObject.Parent = nil
  3021. toolAnimTime = time + .3
  3022. end
  3023.  
  3024. if time > toolAnimTime then
  3025. toolAnimTime = 0
  3026. toolAnim = "None"
  3027. end
  3028.  
  3029. animateTool()
  3030. else
  3031. stopToolAnimations()
  3032. toolAnim = "None"
  3033. toolAnimTime = 0
  3034. end
  3035. end
  3036.  
  3037. -- connect events
  3038. Humanoid.Died:connect(onDied)
  3039. Humanoid.Running:connect(onRunning)
  3040. Humanoid.Jumping:connect(onJumping)
  3041. Humanoid.Climbing:connect(onClimbing)
  3042. Humanoid.GettingUp:connect(onGettingUp)
  3043. Humanoid.FreeFalling:connect(onFreeFall)
  3044. Humanoid.FallingDown:connect(onFallingDown)
  3045. Humanoid.Seated:connect(onSeated)
  3046. Humanoid.PlatformStanding:connect(onPlatformStanding)
  3047. Humanoid.Swimming:connect(onSwimming)
  3048.  
  3049. -- setup emote chat hook
  3050.  
  3051.  
  3052. -- main program
  3053.  
  3054. local runService = game:service("RunService");
  3055.  
  3056. -- initialize to idle
  3057. playAnimation("idle", 0.1, Humanoid)
  3058. pose = "Standing"
  3059.  
  3060. while Figure.Parent~=nil do
  3061. local _, time = wait(0.1)
  3062. move(time)
  3063. end
  3064.  
  3065.  
  3066.  
  3067. end))
  3068. StringValue70.Name = "climb"
  3069. StringValue70.Parent = Script69
  3070. Animation71.Name = "ClimbAnim"
  3071. Animation71.Parent = StringValue70
  3072. Animation71.AnimationId = "http://www.roblox.com/asset/?id=125750800"
  3073. StringValue72.Name = "fall"
  3074. StringValue72.Parent = Script69
  3075. Animation73.Name = "FallAnim"
  3076. Animation73.Parent = StringValue72
  3077. Animation73.AnimationId = "http://www.roblox.com/asset/?id=125750759"
  3078. StringValue74.Name = "idle"
  3079. StringValue74.Parent = Script69
  3080. Animation75.Name = "Animation1"
  3081. Animation75.Parent = StringValue74
  3082. Animation75.AnimationId = "http://www.roblox.com/asset/?id=125750544"
  3083. NumberValue76.Name = "Weight"
  3084. NumberValue76.Parent = Animation75
  3085. NumberValue76.Value = 9
  3086. Animation77.Name = "Animation2"
  3087. Animation77.Parent = StringValue74
  3088. Animation77.AnimationId = "http://www.roblox.com/asset/?id=125750618"
  3089. NumberValue78.Name = "Weight"
  3090. NumberValue78.Parent = Animation77
  3091. NumberValue78.Value = 1
  3092. StringValue79.Name = "jump"
  3093. StringValue79.Parent = Script69
  3094. Animation80.Name = "JumpAnim"
  3095. Animation80.Parent = StringValue79
  3096. Animation80.AnimationId = "http://www.roblox.com/asset/?id=125750702"
  3097. StringValue81.Name = "run"
  3098. StringValue81.Parent = Script69
  3099. Animation82.Name = "RunAnim"
  3100. Animation82.Parent = StringValue81
  3101. Animation82.AnimationId = "http://www.roblox.com/asset/?id=125749145"
  3102. StringValue83.Name = "toolnone"
  3103. StringValue83.Parent = Script69
  3104. Animation84.Name = "ToolNoneAnim"
  3105. Animation84.Parent = StringValue83
  3106. Animation84.AnimationId = "http://www.roblox.com/asset/?id=125750867"
  3107. StringValue85.Name = "walk"
  3108. StringValue85.Parent = Script69
  3109. Animation86.Name = "WalkAnim"
  3110. Animation86.Parent = StringValue85
  3111. Animation86.AnimationId = "http://www.roblox.com/asset/?id=125749145"
  3112. Part87.Name = "Head"
  3113. Part87.Parent = Model55
  3114. Part87.BrickColor = BrickColor.new("Cool yellow")
  3115. Part87.Rotation = Vector3.new(0, 90, 0)
  3116. Part87.FormFactor = Enum.FormFactor.Symmetric
  3117. Part87.Size = Vector3.new(2, 1, 1)
  3118. Part87.CFrame = CFrame.new(8.79734039, 4.45095634, -13.1970339, 0.000532949809, -0.000846050854, 1.00000048, 7.0162085e-09, 0.999999642, 0.000846053765, -1.00000155, -4.46565792e-07, 0.000533248123)
  3119. Part87.BottomSurface = Enum.SurfaceType.Smooth
  3120. Part87.TopSurface = Enum.SurfaceType.Smooth
  3121. Part87.Color = Color3.new(0.992157, 0.917647, 0.552941)
  3122. Part87.Position = Vector3.new(8.79734039, 4.45095634, -13.1970339)
  3123. Part87.Orientation = Vector3.new(-0.049999997, 89.9700012, 0)
  3124. Part87.Color = Color3.new(0.992157, 0.917647, 0.552941)
  3125. SpecialMesh88.Parent = Part87
  3126. SpecialMesh88.Scale = Vector3.new(1.25, 1.25, 1.25)
  3127. SpecialMesh88.Scale = Vector3.new(1.25, 1.25, 1.25)
  3128. Decal89.Parent = Part87
  3129. Decal89.Texture = "http://www.roblox.com/asset/?id=134724710"
  3130. Part90.Name = "Right Arm"
  3131. Part90.Parent = Model55
  3132. Part90.BrickColor = BrickColor.new("Cool yellow")
  3133. Part90.Rotation = Vector3.new(0, 90, 0)
  3134. Part90.CanCollide = false
  3135. Part90.FormFactor = Enum.FormFactor.Symmetric
  3136. Part90.Size = Vector3.new(1, 2, 1)
  3137. Part90.CFrame = CFrame.new(8.79940891, 2.95095706, -14.6970348, 0.000532949809, -0.000846050738, 1.00000048, 7.0162085e-09, 0.999999523, 0.000846053765, -1.00000155, -4.46565736e-07, 0.000533248123)
  3138. Part90.BottomSurface = Enum.SurfaceType.Smooth
  3139. Part90.TopSurface = Enum.SurfaceType.Smooth
  3140. Part90.Color = Color3.new(0.992157, 0.917647, 0.552941)
  3141. Part90.Position = Vector3.new(8.79940891, 2.95095706, -14.6970348)
  3142. Part90.Orientation = Vector3.new(-0.049999997, 89.9700012, 0)
  3143. Part90.Color = Color3.new(0.992157, 0.917647, 0.552941)
  3144. Part91.Name = "Left Arm"
  3145. Part91.Parent = Model55
  3146. Part91.BrickColor = BrickColor.new("Cool yellow")
  3147. Part91.Rotation = Vector3.new(0, 90, 0)
  3148. Part91.CanCollide = false
  3149. Part91.FormFactor = Enum.FormFactor.Symmetric
  3150. Part91.Size = Vector3.new(1, 2, 1)
  3151. Part91.CFrame = CFrame.new(8.79781055, 2.95095706, -11.697031, 0.000532949809, -0.000846050738, 1.00000048, 7.0162085e-09, 0.999999523, 0.000846053765, -1.00000155, -4.46565736e-07, 0.000533248123)
  3152. Part91.BottomSurface = Enum.SurfaceType.Smooth
  3153. Part91.TopSurface = Enum.SurfaceType.Smooth
  3154. Part91.Color = Color3.new(0.992157, 0.917647, 0.552941)
  3155. Part91.Position = Vector3.new(8.79781055, 2.95095706, -11.697031)
  3156. Part91.Orientation = Vector3.new(-0.049999997, 89.9700012, 0)
  3157. Part91.Color = Color3.new(0.992157, 0.917647, 0.552941)
  3158. Part92.Name = "Right Leg"
  3159. Part92.Parent = Model55
  3160. Part92.BrickColor = BrickColor.new("Bright blue")
  3161. Part92.Rotation = Vector3.new(0, 90, 0)
  3162. Part92.CanCollide = false
  3163. Part92.FormFactor = Enum.FormFactor.Symmetric
  3164. Part92.Size = Vector3.new(1, 2, 1)
  3165. Part92.CFrame = CFrame.new(8.80056858, 0.950957894, -13.6970329, 0.000532949809, -0.000846050738, 1.00000048, 7.0162085e-09, 0.999999523, 0.000846053765, -1.00000155, -4.46565736e-07, 0.000533248123)
  3166. Part92.BottomSurface = Enum.SurfaceType.Smooth
  3167. Part92.TopSurface = Enum.SurfaceType.Smooth
  3168. Part92.Color = Color3.new(0.0509804, 0.411765, 0.67451)
  3169. Part92.Position = Vector3.new(8.80056858, 0.950957894, -13.6970329)
  3170. Part92.Orientation = Vector3.new(-0.049999997, 89.9700012, 0)
  3171. Part92.Color = Color3.new(0.0509804, 0.411765, 0.67451)
  3172. Part93.Name = "Left Leg"
  3173. Part93.Parent = Model55
  3174. Part93.BrickColor = BrickColor.new("Bright blue")
  3175. Part93.Rotation = Vector3.new(0, 90, 0)
  3176. Part93.CanCollide = false
  3177. Part93.FormFactor = Enum.FormFactor.Symmetric
  3178. Part93.Size = Vector3.new(1, 2, 1)
  3179. Part93.CFrame = CFrame.new(8.80003548, 0.950957894, -12.697031, 0.000532949809, -0.000846050738, 1.00000048, 7.0162085e-09, 0.999999523, 0.000846053765, -1.00000155, -4.46565736e-07, 0.000533248123)
  3180. Part93.BottomSurface = Enum.SurfaceType.Smooth
  3181. Part93.TopSurface = Enum.SurfaceType.Smooth
  3182. Part93.Color = Color3.new(0.0509804, 0.411765, 0.67451)
  3183. Part93.Position = Vector3.new(8.80003548, 0.950957894, -12.697031)
  3184. Part93.Orientation = Vector3.new(-0.049999997, 89.9700012, 0)
  3185. Part93.Color = Color3.new(0.0509804, 0.411765, 0.67451)
  3186. Part94.Name = "Torso"
  3187. Part94.Parent = Model55
  3188. Part94.BrickColor = BrickColor.new("Dark green")
  3189. Part94.Rotation = Vector3.new(0, 90, 0)
  3190. Part94.CanCollide = false
  3191. Part94.FormFactor = Enum.FormFactor.Symmetric
  3192. Part94.Size = Vector3.new(2, 2, 1)
  3193. Part94.CFrame = CFrame.new(8.79860973, 2.95095706, -13.1970329, 0.000532949809, -0.000846050854, 1.00000048, 7.0162085e-09, 0.999999642, 0.000846053765, -1.00000155, -4.46565792e-07, 0.000533248123)
  3194. Part94.BottomSurface = Enum.SurfaceType.Smooth
  3195. Part94.TopSurface = Enum.SurfaceType.Smooth
  3196. Part94.Color = Color3.new(0.156863, 0.498039, 0.278431)
  3197. Part94.Position = Vector3.new(8.79860973, 2.95095706, -13.1970329)
  3198. Part94.Orientation = Vector3.new(-0.049999997, 89.9700012, 0)
  3199. Part94.Color = Color3.new(0.156863, 0.498039, 0.278431)
  3200. Sound95.Name = "HitSound"
  3201. Sound95.Parent = Part94
  3202. Sound95.SoundId = "http://www.roblox.com/asset/?id=93591808"
  3203. Motor6D96.Name = "Left Hip"
  3204. Motor6D96.Parent = Part94
  3205. Motor6D96.C0 = CFrame.new(-1, -1, 0, -4.37113883e-08, 0, -1, 0, 0.99999994, 0, 1, 0, -4.37113883e-08)
  3206. Motor6D96.C1 = CFrame.new(-0.5, 1, 0, -4.37113883e-08, 0, -1, 0, 0.99999994, 0, 1, 0, -4.37113883e-08)
  3207. Motor6D96.Part0 = Part94
  3208. Motor6D96.Part1 = Part93
  3209. Motor6D96.MaxVelocity = 0.10000000149012
  3210. Motor6D97.Name = "Right Hip"
  3211. Motor6D97.Parent = Part94
  3212. Motor6D97.C0 = CFrame.new(1, -1, 0, -4.37113883e-08, 0, 1, -0, 0.99999994, 0, -1, 0, -4.37113883e-08)
  3213. Motor6D97.C1 = CFrame.new(0.5, 1, 0, -4.37113883e-08, 0, 1, 0, 0.99999994, 0, -1, 0, -4.37113883e-08)
  3214. Motor6D97.Part0 = Part94
  3215. Motor6D97.Part1 = Part92
  3216. Motor6D97.MaxVelocity = 0.10000000149012
  3217. Motor6D98.Name = "Left Shoulder"
  3218. Motor6D98.Parent = Part94
  3219. Motor6D98.C0 = CFrame.new(-1, 0.5, 0, -4.37113883e-08, 0, -1, 0, 0.99999994, 0, 1, 0, -4.37113883e-08)
  3220. Motor6D98.C1 = CFrame.new(0.5, 0.5, 0, -4.37113883e-08, 0, -1, 0, 0.99999994, 0, 1, 0, -4.37113883e-08)
  3221. Motor6D98.Part0 = Part94
  3222. Motor6D98.Part1 = Part91
  3223. Motor6D98.MaxVelocity = 0.10000000149012
  3224. Motor6D99.Name = "Right Shoulder"
  3225. Motor6D99.Parent = Part94
  3226. Motor6D99.C0 = CFrame.new(1, 0.5, 0, -4.37113883e-08, 0, 1, -0, 0.99999994, 0, -1, 0, -4.37113883e-08)
  3227. Motor6D99.C1 = CFrame.new(-0.5, 0.5, 0, -4.37113883e-08, 0, 1, 0, 0.99999994, 0, -1, 0, -4.37113883e-08)
  3228. Motor6D99.Part0 = Part94
  3229. Motor6D99.Part1 = Part90
  3230. Motor6D99.MaxVelocity = 0.10000000149012
  3231. Motor6D100.Name = "Neck"
  3232. Motor6D100.Parent = Part94
  3233. Motor6D100.C0 = CFrame.new(0, 1, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
  3234. Motor6D100.C1 = CFrame.new(0, -0.5, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
  3235. Motor6D100.Part0 = Part94
  3236. Motor6D100.Part1 = Part87
  3237. Motor6D100.MaxVelocity = 0.10000000149012
  3238. Part101.Name = "HumanoidRootPart"
  3239. Part101.Parent = Model55
  3240. Part101.Transparency = 1
  3241. Part101.Rotation = Vector3.new(0, 90, 0)
  3242. Part101.FormFactor = Enum.FormFactor.Symmetric
  3243. Part101.Size = Vector3.new(2, 2, 1)
  3244. Part101.CFrame = CFrame.new(8.79860973, 2.95095706, -13.1970329, 0.000532949809, -0.000846050854, 1.00000048, 7.0162085e-09, 0.999999642, 0.000846053765, -1.00000155, -4.46565792e-07, 0.000533248123)
  3245. Part101.BottomSurface = Enum.SurfaceType.Smooth
  3246. Part101.TopSurface = Enum.SurfaceType.Smooth
  3247. Part101.Position = Vector3.new(8.79860973, 2.95095706, -13.1970329)
  3248. Part101.Orientation = Vector3.new(-0.049999997, 89.9700012, 0)
  3249. Motor6D102.Name = "Root Hip"
  3250. Motor6D102.Parent = Part101
  3251. Motor6D102.C0 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
  3252. Motor6D102.C1 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
  3253. Motor6D102.Part0 = Part101
  3254. Motor6D102.Part1 = Part94
  3255. Motor6D102.MaxVelocity = 0.10000000149012
  3256. Script103.Name = "READ ME"
  3257. Script103.Parent = Model55
  3258. table.insert(cors,sandbox(Script103,function()
  3259. --- Please support and like and fav. Zombie wars for more updates.
  3260.  
  3261.  
  3262.  
  3263.  
  3264.  
  3265.  
  3266.  
  3267.  
  3268.  
  3269.  
  3270.  
  3271.  
  3272.  
  3273.  
  3274.  
  3275.  
  3276. ---THANK YOU
  3277.  
  3278.  
  3279.  
  3280.  
  3281.  
  3282. --YUANRAVIEH190
  3283. end))
  3284. Part104.Name = "MonsterSpawn"
  3285. Part104.Parent = Model54
  3286. Part104.Material = Enum.Material.Neon
  3287. Part104.BrickColor = BrickColor.new("Reddish brown")
  3288. Part104.Rotation = Vector3.new(0, 90, 0)
  3289. Part104.Anchored = true
  3290. Part104.CanCollide = false
  3291. Part104.FormFactor = Enum.FormFactor.Custom
  3292. Part104.Size = Vector3.new(6, 0.200000003, 6)
  3293. Part104.CFrame = CFrame.new(8.40017128, -0.149426997, -13.2067986, -1.94256427e-06, 2.03144737e-08, 1.00000048, 1.57338604e-08, 0.999990463, -3.37604433e-09, -1.00000083, 1.46186778e-08, -1.79343624e-06)
  3294. Part104.BottomSurface = Enum.SurfaceType.Smooth
  3295. Part104.TopSurface = Enum.SurfaceType.Smooth
  3296. Part104.Color = Color3.new(0.411765, 0.25098, 0.156863)
  3297. Part104.Position = Vector3.new(8.40017128, -0.149426997, -13.2067986)
  3298. Part104.Orientation = Vector3.new(0, 90, 0)
  3299. Part104.Color = Color3.new(0.411765, 0.25098, 0.156863)
  3300. Decal105.Parent = Part104
  3301. Decal105.Texture = "http://www.roblox.com/asset/?id=134724710"
  3302. Decal105.Face = Enum.NormalId.Top
  3303. Script106.Parent = Part104
  3304. table.insert(cors,sandbox(Script106,function()
  3305. zombie = script.Parent.Parent.Zombie
  3306. zombiebackup = zombie:Clone()
  3307. zombie:remove()
  3308.  
  3309. while true do
  3310. wait(5)
  3311. local newzombie = zombiebackup:Clone()
  3312. newzombie.Parent = game.Workspace
  3313. newzombie:MakeJoints()
  3314. newzombie.Torso.CFrame = script.Parent.CFrame + Vector3.new(0, 5, 0)
  3315. newzombie:MakeJoints()
  3316. zombie = newzombie
  3317. zombiebackup = zombie:Clone()
  3318. end
  3319. end))
  3320. ManualWeld107.Name = "MonsterSpawn-to-MonsterSpawn Strong Joint"
  3321. ManualWeld107.Parent = Part104
  3322. ManualWeld107.C0 = CFrame.new(3, -0.100000001, 3, 0, 0, 1, 0, 1, -0, -1, 0, 0)
  3323. ManualWeld107.C1 = CFrame.new(-3, -0.100000001, 3, 0, 0, 1, 0, 1, -0, -1, 0, 0)
  3324. ManualWeld107.Part0 = Part104
  3325. Model108.Parent = mas
  3326. Model109.Name = "Zombie"
  3327. Model109.Parent = Model108
  3328. Script110.Name = "Ragdoller"
  3329. Script110.Parent = Model109
  3330. table.insert(cors,sandbox(Script110,function()
  3331. print("Ragdoll script activated")
  3332. Gibs = game.Workspace
  3333.  
  3334. function getKillerOfHumanoidIfStillInGame(humanoid)
  3335. local tag = humanoid:findFirstChild("creator")
  3336. if tag ~= nil then
  3337. local killer = tag.Value
  3338. if killer.Parent ~= nil then
  3339. return killer
  3340. end
  3341. end
  3342. return nil
  3343. end
  3344.  
  3345. function OnDeath(Character)
  3346. local svch = Character
  3347. local hum = Character:findFirstChild("Humanoid")
  3348. local getkiller = getKillerOfHumanoidIfStillInGame(hum)
  3349. Character.Archivable = true
  3350. local chrclone = Character:clone()
  3351. Character.Archivable = false
  3352.  
  3353. local ch = chrclone:GetChildren()
  3354. local i
  3355. for i = 1,#ch do
  3356. if ch[i].Name == "THandle1" or ch[i].Name == "THandle2" or ch[i].ClassName == "Script" then
  3357. ch[i]:remove()
  3358. end
  3359. end
  3360. local function Scan(ch)
  3361. local e
  3362. for e = 1,#ch do
  3363. Scan(ch[e]:GetChildren())
  3364. if ch[e].ClassName == "Weld" or ch[e].ClassName == "Motor6D" then
  3365. ch[e]:remove()
  3366. end
  3367. end
  3368. end
  3369. Scan(chrclone:GetChildren())
  3370.  
  3371. local hum2 = chrclone:findFirstChild("Humanoid")
  3372.  
  3373.  
  3374. if hum2 ~= nil then
  3375. hum2.Name = "Humanoid2"
  3376. hum2.PlatformStand = true
  3377. hum2.Sit = true
  3378. hum2.MaxHealth = 0
  3379. hum2.Health = 0
  3380. end
  3381.  
  3382. local ch = Character:GetChildren()
  3383. local i
  3384. for i = 1,#ch do
  3385. if ch[i].Name == "THandle1" or ch[i].Name == "THandle2" then
  3386. ch[i]:remove()
  3387. end
  3388. end
  3389.  
  3390. wait(0.2)
  3391.  
  3392. local ch = Character:GetChildren()
  3393. local i
  3394. for i = 1,#ch do
  3395. if ch[i].ClassName == "Part" or ch[i].ClassName == "Hat" or ch[i].Name == "THandle1" or ch[i].Name == "THandle2" then
  3396. ch[i]:remove()
  3397. end
  3398. end
  3399. Character = chrclone
  3400. local Torso = Character.Torso
  3401. local movevector = Vector3.new()
  3402.  
  3403. if Torso then
  3404. if getkiller ~= nil then
  3405. if getkiller.Character ~= nil then
  3406. local killtors = getkiller.Character:findFirstChild("Torso")
  3407. if killtors ~= nil then
  3408. movevector = CFrame.new(killtors.Position,Torso.Position).lookVector
  3409. end
  3410. end
  3411. end
  3412. local Head = Character:FindFirstChild("Head")
  3413. if Head then
  3414. local Neck = Instance.new("Weld")
  3415. Neck.Name = "Neck"
  3416. Neck.Part0 = Torso
  3417. Neck.Part1 = Head
  3418. Neck.C0 = CFrame.new(0, 1.5, 0)
  3419. Neck.C1 = CFrame.new()
  3420. Neck.Parent = Torso
  3421.  
  3422. local nsc = script.CamAttach:clone()
  3423. nsc.CamPart.Value = hum2.Parent.Head
  3424. nsc.Disabled = false
  3425. nsc.Parent = svch
  3426. end
  3427. local Limb = Character:FindFirstChild("Right Arm")
  3428. if Limb then
  3429.  
  3430. Limb.CFrame = Torso.CFrame * CFrame.new(1.5, 0, 0)
  3431. local Joint = Instance.new("Glue")
  3432. Joint.Name = "RightShoulder"
  3433. Joint.Part0 = Torso
  3434. Joint.Part1 = Limb
  3435. Joint.C0 = CFrame.new(1.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  3436. Joint.C1 = CFrame.new(-0, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  3437. Joint.Parent = Torso
  3438.  
  3439. local B = Instance.new("Part")
  3440. B.TopSurface = 0
  3441. B.BottomSurface = 0
  3442. B.formFactor = "Symmetric"
  3443. B.Size = Vector3.new(1, 1, 1)
  3444. B.Transparency = 1
  3445. B.CFrame = Limb.CFrame * CFrame.new(0, -0.5, 0)
  3446. B.Parent = Character
  3447. local W = Instance.new("Weld")
  3448. W.Part0 = Limb
  3449. W.Part1 = B
  3450. W.C0 = CFrame.new(0, -0.5, 0)
  3451. W.Parent = Limb
  3452.  
  3453. end
  3454. local Limb = Character:FindFirstChild("Left Arm")
  3455. if Limb then
  3456.  
  3457. Limb.CFrame = Torso.CFrame * CFrame.new(-1.5, 0, 0)
  3458. local Joint = Instance.new("Glue")
  3459. Joint.Name = "LeftShoulder"
  3460. Joint.Part0 = Torso
  3461. Joint.Part1 = Limb
  3462. Joint.C0 = CFrame.new(-1.5, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  3463. Joint.C1 = CFrame.new(0, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  3464. Joint.Parent = Torso
  3465.  
  3466. local B = Instance.new("Part")
  3467. B.TopSurface = 0
  3468. B.BottomSurface = 0
  3469. B.formFactor = "Symmetric"
  3470. B.Size = Vector3.new(1, 1, 1)
  3471. B.Transparency = 1
  3472. B.CFrame = Limb.CFrame * CFrame.new(0, -0.5, 0)
  3473. B.Parent = Character
  3474. local W = Instance.new("Weld")
  3475. W.Part0 = Limb
  3476. W.Part1 = B
  3477. W.C0 = CFrame.new(0, -0.5, 0)
  3478. W.Parent = Limb
  3479.  
  3480. end
  3481. local Limb = Character:FindFirstChild("Right Leg")
  3482. if Limb then
  3483.  
  3484. Limb.CFrame = Torso.CFrame * CFrame.new(0.5, -2, 0)
  3485. local Joint = Instance.new("Glue")
  3486. Joint.Name = "RightHip"
  3487. Joint.Part0 = Torso
  3488. Joint.Part1 = Limb
  3489. Joint.C0 = CFrame.new(0.5, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  3490. Joint.C1 = CFrame.new(0, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  3491. Joint.Parent = Torso
  3492.  
  3493. local B = Instance.new("Part")
  3494. B.TopSurface = 0
  3495. B.BottomSurface = 0
  3496. B.formFactor = "Symmetric"
  3497. B.Size = Vector3.new(1, 1, 1)
  3498. B.Transparency = 1
  3499. B.CFrame = Limb.CFrame * CFrame.new(0, -0.5, 0)
  3500. B.Parent = Character
  3501. local W = Instance.new("Weld")
  3502. W.Part0 = Limb
  3503. W.Part1 = B
  3504. W.C0 = CFrame.new(0, -0.5, 0)
  3505. W.Parent = Limb
  3506.  
  3507. end
  3508. local Limb = Character:FindFirstChild("Left Leg")
  3509. if Limb then
  3510.  
  3511. Limb.CFrame = Torso.CFrame * CFrame.new(-0.5, -2, 0)
  3512. local Joint = Instance.new("Glue")
  3513. Joint.Name = "LeftHip"
  3514. Joint.Part0 = Torso
  3515. Joint.Part1 = Limb
  3516. Joint.C0 = CFrame.new(-0.5, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  3517. Joint.C1 = CFrame.new(-0, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  3518. Joint.Parent = Torso
  3519.  
  3520. local B = Instance.new("Part")
  3521. B.TopSurface = 0
  3522. B.BottomSurface = 0
  3523. B.formFactor = "Symmetric"
  3524. B.Size = Vector3.new(1, 1, 1)
  3525. B.Transparency = 1
  3526. B.CFrame = Limb.CFrame * CFrame.new(0, -0.5, 0)
  3527. B.Parent = Character
  3528. local W = Instance.new("Weld")
  3529. W.Part0 = Limb
  3530. W.Part1 = B
  3531. W.C0 = CFrame.new(0, -0.5, 0)
  3532. W.Parent = Limb
  3533.  
  3534. end
  3535. --[
  3536. local Bar = Instance.new("Part")
  3537. Bar.TopSurface = 0
  3538. Bar.BottomSurface = 0
  3539. Bar.formFactor = "Symmetric"
  3540. Bar.Size = Vector3.new(1, 1, 1)
  3541. Bar.Transparency = 1
  3542. Bar.CFrame = Torso.CFrame * CFrame.new(0, 0.5, 0)
  3543. Bar.Parent = Character
  3544. local Weld = Instance.new("Weld")
  3545. Weld.Part0 = Torso
  3546. Weld.Part1 = Bar
  3547. Weld.C0 = CFrame.new(0, 0.5, 0)
  3548. Weld.Parent = Torso
  3549. --]]
  3550. end
  3551. Character.Parent = Gibs
  3552. game.Debris:AddItem(Character, 12)
  3553. if movevector ~= Vector3.new() then
  3554. for i = 1,10 do
  3555. wait()
  3556. Torso.Velocity = movevector * 30
  3557. end
  3558. end
  3559. end
  3560.  
  3561. script.Parent.Humanoid.Died:connect(function()
  3562. OnDeath(script.Parent)
  3563. end)
  3564.  
  3565.  
  3566. end))
  3567. LocalScript111.Name = "CamAttach"
  3568. LocalScript111.Parent = Script110
  3569. LocalScript111.Disabled = true
  3570. table.insert(cors,sandbox(LocalScript111,function()
  3571. wait()
  3572. game.Workspace.CurrentCamera.CameraSubject = script.CamPart.Value
  3573. end))
  3574. ObjectValue112.Name = "CamPart"
  3575. ObjectValue112.Parent = LocalScript111
  3576. Script113.Name = "ZombieScript"
  3577. Script113.Parent = Model109
  3578. table.insert(cors,sandbox(Script113,function()
  3579. wait()
  3580. -- Handles damage, sounds
  3581.  
  3582. local hum = script.Parent:FindFirstChild("Humanoid")
  3583. local torso = script.Parent:FindFirstChild("HumanoidRootPart")
  3584. local head = script.Parent:FindFirstChild("Head")
  3585.  
  3586. DB = false
  3587. local function onTouch(hit)
  3588. if DB then return end
  3589. if hit == nil then return end
  3590. if hit.Parent == nil then return end
  3591. local vhum = hit.Parent:FindFirstChild("Humanoid")
  3592. if vhum ~= nil then
  3593. if hum.Health <= 0 then return end
  3594. if vhum ~= hum and not hit.Parent:FindFirstChild("ZombieScript") then -- keeps it from hurting itself/ zombies
  3595. vhum:TakeDamage(math.random(6, 9))
  3596. DB = true
  3597. wait(1)
  3598. DB = false
  3599. end
  3600. end
  3601. end
  3602. torso.Touched:connect(onTouch)
  3603.  
  3604. local zombienoises = {93591696, 208668860, 179266532, 229895387, 150076506}
  3605. local moan = head:FindFirstChild("Moan")
  3606.  
  3607. while head ~= nil do
  3608. wait(math.random(6, 13))
  3609. moan.Pitch = math.random(8, 10)/10
  3610. moan.SoundId = "rbxassetid://"..tostring(zombienoises[math.random(1, #zombienoises)])
  3611. moan:Play()
  3612. end
  3613.  
  3614. end))
  3615. Script114.Name = "Follow"
  3616. Script114.Parent = Model109
  3617. table.insert(cors,sandbox(Script114,function()
  3618. wait()
  3619. local hum = script.Parent:FindFirstChild("Humanoid")
  3620. local torso = script.Parent:FindFirstChild("HumanoidRootPart")
  3621.  
  3622. local max_dist = 200
  3623.  
  3624. function findNearestTorso()
  3625. for _, player in pairs(game.Players:GetPlayers()) do
  3626. if player.Character ~= nil then
  3627. local target_torso = player.Character:FindFirstChild("HumanoidRootPart")
  3628. if target_torso ~= nil then
  3629. if (target_torso.Position - torso.Position).magnitude < max_dist then
  3630. return target_torso
  3631. end
  3632. end
  3633. end
  3634. end
  3635. end
  3636.  
  3637. local old_pos = torso.Position
  3638.  
  3639. wait(math.random(0, 90)/100)
  3640.  
  3641. while hum ~= nil do
  3642. local target = findNearestTorso()
  3643. if target ~= nil then
  3644. while target ~= nil and target.Parent ~= nil and hum ~= nil do
  3645. if (target.Position - torso.Position).magnitude < max_dist then
  3646. hum:MoveTo(target.Position, target)
  3647. if target.Position.Y > torso.Position.Y + 3 then
  3648. hum.Jump = true
  3649. end
  3650. if (old_pos - torso.Position).magnitude < 0.5 then
  3651. if math.random(1, 3) == 1 then
  3652. torso.Velocity = torso.CFrame.lookVector * -40
  3653. hum:MoveTo(torso.Position + Vector3.new(math.random(-1, 1), 0, math.random(-1, 1))*20)
  3654. wait(1.2)
  3655. else
  3656. hum.Jump = true
  3657. hum:MoveTo(target.Position, target)
  3658. end
  3659. end
  3660. else break end
  3661. old_pos = torso.Position
  3662. wait(0.5)
  3663. end
  3664. end
  3665. wait(4)
  3666. end
  3667. end))
  3668. Script115.Name = "Die"
  3669. Script115.Parent = Model109
  3670. table.insert(cors,sandbox(Script115,function()
  3671. human = script.Parent.Humanoid
  3672. --tool = script.Parent.Pistol
  3673.  
  3674. function Die()
  3675. --if tool ~= nil then tool:remove() end
  3676. game.workspace.Scripts.WaveScript.Dead_Zombies.Value = game.workspace.Scripts.WaveScript.Dead_Zombies.Value + 1
  3677. wait(2.5)
  3678. script.Parent:remove()
  3679. end
  3680.  
  3681. human.Died:connect(Die)
  3682. end))
  3683. Script116.Name = "ZombieScript"
  3684. Script116.Parent = Model109
  3685. table.insert(cors,sandbox(Script116,function()
  3686. --Made by Stickmasterluke
  3687.  
  3688. --Zombie artificial stupidity script
  3689.  
  3690.  
  3691. sp=script.Parent
  3692. lastattack=0
  3693. nextrandom=0
  3694. nextsound=0
  3695. nextjump=0
  3696. chasing=false
  3697.  
  3698. variance=4
  3699.  
  3700. damage=10
  3701. attackrange=4.5
  3702. sightrange=999--60
  3703. runspeed=10
  3704. wonderspeed=8
  3705. healthregen=false
  3706. colors={"Sand red","Dusty Rose","Medium blue","Sand blue","Lavender","Earth green","Brown","Medium stone grey","Brick yellow"}
  3707.  
  3708. function raycast(spos,vec,currentdist)
  3709. local hit2,pos2=game.Workspace:FindPartOnRay(Ray.new(spos+(vec*.01),vec*currentdist),script.Parent)
  3710. if hit2~=nil and pos2 then
  3711. if hit2.Parent==script.Parent and hit2.Transparency>=.8 or hit2.Name=="Handle" or string.sub(hit2.Name,1,6)=="Effect" or hit2.Parent:IsA("Hat") or hit2.Parent:IsA("Tool") or (hit2.Parent:FindFirstChild("Humanoid") and hit2.Parent:FindFirstChild("TEAM") and hit2.Parent:FindFirstChild("TEAM").Value == script.Parent.TEAM.Value) or (not hit2.Parent:FindFirstChild("Humanoid") and hit2.CanCollide==false) then
  3712. local currentdist=currentdist-(pos2-spos).magnitude
  3713. return raycast(pos2,vec,currentdist)
  3714. end
  3715. end
  3716. return hit2,pos2
  3717. end
  3718.  
  3719. function waitForChild(parent,childName)
  3720. local child=parent:findFirstChild(childName)
  3721. if child then return child end
  3722. while true do
  3723. child=parent.ChildAdded:wait()
  3724. if child.Name==childName then return child end
  3725. end
  3726. end
  3727.  
  3728. -- ANIMATION
  3729.  
  3730. -- declarations
  3731.  
  3732. local Torso=waitForChild(sp,"Torso")
  3733. local Head=waitForChild(sp,"Head")
  3734. local RightShoulder=waitForChild(Torso,"Right Shoulder")
  3735. local LeftShoulder=waitForChild(Torso,"Left Shoulder")
  3736. local RightHip=waitForChild(Torso,"Right Hip")
  3737. local LeftHip=waitForChild(Torso,"Left Hip")
  3738. local Neck=waitForChild(Torso,"Neck")
  3739. local Humanoid=waitForChild(sp,"Humanoid")
  3740. local BodyColors=waitForChild(sp,"Body Colors")
  3741. local pose="Standing"
  3742. local hitsound=waitForChild(Torso,"HitSound")
  3743. local Anim = Humanoid:LoadAnimation(sp.AttackAnim)
  3744.  
  3745. --[[local sounds={
  3746. waitForChild(Torso,"GroanSound"),
  3747. waitForChild(Torso,"RawrSound")
  3748. }]]
  3749.  
  3750. if healthregen then
  3751. local regenscript=waitForChild(sp,"HealthRegenerationScript")
  3752. regenscript.Disabled=false
  3753. end
  3754. Humanoid.WalkSpeed=wonderspeed
  3755.  
  3756. local toolAnim="None"
  3757. local toolAnimTime=0
  3758.  
  3759. --[[BodyColors.HeadColor=BrickColor.new("Grime")
  3760. local randomcolor1=colors[math.random(1,#colors)]
  3761. BodyColors.TorsoColor=BrickColor.new(randomcolor1)
  3762. BodyColors.LeftArmColor=BrickColor.new(randomcolor1)
  3763. BodyColors.RightArmColor=BrickColor.new(randomcolor1)
  3764. local randomcolor2=colors[math.random(1,#colors)]
  3765. BodyColors.LeftLegColor=BrickColor.new(randomcolor2)
  3766. BodyColors.RightLegColor=BrickColor.new(randomcolor2)]]
  3767.  
  3768.  
  3769. function onRunning(speed)
  3770. if speed>0 then
  3771. pose="Running"
  3772. else
  3773. pose="Standing"
  3774. end
  3775. end
  3776. function onDied()
  3777. pose="Dead"
  3778. end
  3779. function onJumping()
  3780. pose="Jumping"
  3781. end
  3782. function onClimbing()
  3783. pose="Climbing"
  3784. end
  3785. function onGettingUp()
  3786. pose = "GettingUp"
  3787. end
  3788. function onFreeFall()
  3789. pose = "FreeFall"
  3790. end
  3791. function onFallingDown()
  3792. pose = "FallingDown"
  3793. end
  3794. function onSeated()
  3795. pose = "Seated"
  3796. end
  3797. function onPlatformStanding()
  3798. pose = "PlatformStanding"
  3799. end
  3800.  
  3801. function moveJump()
  3802. RightShoulder.MaxVelocity = 0.5
  3803. LeftShoulder.MaxVelocity = 0.5
  3804. RightShoulder.DesiredAngle=3.14
  3805. LeftShoulder.DesiredAngle=-3.14
  3806. RightHip.DesiredAngle=0
  3807. LeftHip.DesiredAngle=0
  3808. end
  3809.  
  3810. function moveFreeFall()
  3811. RightShoulder.MaxVelocity = 0.5
  3812. LeftShoulder.MaxVelocity =0.5
  3813. RightShoulder.DesiredAngle=3.14
  3814. LeftShoulder.DesiredAngle=-3.14
  3815. RightHip.DesiredAngle=0
  3816. LeftHip.DesiredAngle=0
  3817. end
  3818.  
  3819. function moveSit()
  3820. RightShoulder.MaxVelocity = 0.15
  3821. LeftShoulder.MaxVelocity = 0.15
  3822. RightShoulder.DesiredAngle=3.14 /2
  3823. LeftShoulder.DesiredAngle=-3.14 /2
  3824. RightHip.DesiredAngle=3.14 /2
  3825. LeftHip.DesiredAngle=-3.14 /2
  3826. end
  3827.  
  3828. function animate(time)
  3829. local amplitude
  3830. local frequency
  3831. if (pose == "Jumping") then
  3832. moveJump()
  3833. return
  3834. end
  3835. if (pose == "FreeFall") then
  3836. moveFreeFall()
  3837. return
  3838. end
  3839. if (pose == "Seated") then
  3840. moveSit()
  3841. return
  3842. end
  3843. local climbFudge = 0
  3844. if (pose == "Running") then
  3845. RightShoulder.MaxVelocity = 0.15
  3846. LeftShoulder.MaxVelocity = 0.15
  3847. amplitude = 1
  3848. frequency = 9
  3849. elseif (pose == "Climbing") then
  3850. RightShoulder.MaxVelocity = 0.5
  3851. LeftShoulder.MaxVelocity = 0.5
  3852. amplitude = 1
  3853. frequency = 9
  3854. climbFudge = 3.14
  3855. else
  3856. amplitude = 0.1
  3857. frequency = 1
  3858. end
  3859. desiredAngle = amplitude * math.sin(time*frequency)
  3860. if not chasing and frequency==9 then
  3861. frequency=4
  3862. end
  3863. if chasing then
  3864. --[[RightShoulder.DesiredAngle=math.pi/2
  3865. LeftShoulder.DesiredAngle=-math.pi/2
  3866. RightHip.DesiredAngle=-desiredAngle*2
  3867. LeftHip.DesiredAngle=-desiredAngle*2]]
  3868. else
  3869. RightShoulder.DesiredAngle=desiredAngle + climbFudge
  3870. LeftShoulder.DesiredAngle=desiredAngle - climbFudge
  3871. RightHip.DesiredAngle=-desiredAngle
  3872. LeftHip.DesiredAngle=-desiredAngle
  3873. end
  3874. end
  3875.  
  3876.  
  3877. function attack(time,attackpos)
  3878. if time-lastattack>=0.25 then
  3879. local hit,pos=raycast(Torso.Position,(attackpos-Torso.Position).unit,attackrange)
  3880. if hit and hit.Parent~=nil then
  3881. local h=hit.Parent:FindFirstChild("Humanoid")
  3882. local TEAM=hit.Parent:FindFirstChild("TEAM")
  3883. if h and TEAM and TEAM.Value~=sp.TEAM.Value then
  3884. local creator=sp:FindFirstChild("creator")
  3885. if creator then
  3886. if creator.Value~=nil then
  3887. if creator.Value~=game.Players:GetPlayerFromCharacter(h.Parent) then
  3888. for i,oldtag in ipairs(h:GetChildren()) do
  3889. if oldtag.Name=="creator" then
  3890. oldtag:remove()
  3891. end
  3892. end
  3893. creator:clone().Parent=h
  3894. else
  3895. return
  3896. end
  3897. end
  3898. end
  3899. if Anim then Anim:Play(nil,nil,1.5) end
  3900. h:TakeDamage(damage)
  3901. hitsound.Volume=1
  3902. hitsound.Pitch=.75+(math.random()*.5)
  3903. hitsound:Play()
  3904. --[[if RightShoulder and LeftShoulder then
  3905. RightShoulder.CurrentAngle=0
  3906. LeftShoulder.CurrentAngle=0
  3907. end]]
  3908. end
  3909. end
  3910. lastattack=time
  3911. end
  3912. end
  3913.  
  3914.  
  3915. Humanoid.Died:connect(onDied)
  3916. Humanoid.Running:connect(onRunning)
  3917. Humanoid.Jumping:connect(onJumping)
  3918. Humanoid.Climbing:connect(onClimbing)
  3919. Humanoid.GettingUp:connect(onGettingUp)
  3920. Humanoid.FreeFalling:connect(onFreeFall)
  3921. Humanoid.FallingDown:connect(onFallingDown)
  3922. Humanoid.Seated:connect(onSeated)
  3923. Humanoid.PlatformStanding:connect(onPlatformStanding)
  3924.  
  3925.  
  3926. function populatehumanoids(mdl)
  3927. if mdl.ClassName=="Humanoid" then
  3928. if mdl.Parent:FindFirstChild("TEAM") and mdl.Parent:FindFirstChild("TEAM").Value~=sp.TEAM.Value then
  3929. table.insert(humanoids,mdl)
  3930. end
  3931. end
  3932. for i2,mdl2 in ipairs(mdl:GetChildren()) do
  3933. populatehumanoids(mdl2)
  3934. end
  3935. end
  3936.  
  3937. --[[function playsound(time)
  3938. nextsound=time+5+(math.random()*5)
  3939. local randomsound=sounds[math.random(1,#sounds)]
  3940. randomsound.Volume=.5+(.5*math.random())
  3941. randomsound.Pitch=.5+(.5*math.random())
  3942. randomsound:Play()
  3943. end]]
  3944.  
  3945. while sp.Parent~=nil and Humanoid and Humanoid.Parent~=nil and Humanoid.Health>0 and Torso and Head and Torso~=nil and Torso.Parent~=nil do
  3946. local _,time=wait(0.25)--wait(1/3)
  3947. humanoids={}
  3948. populatehumanoids(game.Workspace)
  3949. closesttarget=nil
  3950. closestdist=sightrange
  3951. local creator=sp:FindFirstChild("creator")
  3952. for i,h in ipairs(humanoids) do
  3953. if h and h.Parent~=nil then
  3954. if h.Health>0 and h.Parent~=sp then
  3955. local plr=game.Players:GetPlayerFromCharacter(h.Parent)
  3956. if creator==nil or plr==nil or creator.Value~=plr then
  3957. local t=h.Parent:FindFirstChild("Torso")
  3958. if t~=nil then
  3959. local dist=(t.Position-Torso.Position).magnitude
  3960. if dist<closestdist then
  3961. closestdist=dist
  3962. closesttarget=t
  3963. end
  3964. end
  3965. end
  3966. end
  3967. end
  3968. end
  3969. if closesttarget~=nil then
  3970. if not chasing then
  3971. --playsound(time)
  3972. chasing=true
  3973. Humanoid.WalkSpeed=runspeed
  3974. end
  3975. Humanoid:MoveTo(closesttarget.Position+(Vector3.new(1,1,1)*(variance*((math.random()*2)-1))),closesttarget)
  3976. if math.random()<.5 then
  3977. attack(time,closesttarget.Position)
  3978. end
  3979. else
  3980. if chasing then
  3981. chasing=false
  3982. Humanoid.WalkSpeed=wonderspeed
  3983. end
  3984. if time>nextrandom then
  3985. nextrandom=time+3+(math.random()*5)
  3986. local randompos=Torso.Position+((Vector3.new(1,1,1)*math.random()-Vector3.new(.5,.5,.5))*40)
  3987. Humanoid:MoveTo(randompos,game.Workspace.Terrain)
  3988. end
  3989. end
  3990. if time>nextsound then
  3991. --playsound(time)
  3992. end
  3993. if time>nextjump then
  3994. nextjump=time+7+(math.random()*5)
  3995. Humanoid.Jump=true
  3996. end
  3997. animate(time)
  3998. end
  3999.  
  4000. wait(4)
  4001. sp:remove() --Rest In Pizza
  4002.  
  4003. end))
  4004. Animation117.Name = "AttackAnim"
  4005. Animation117.Parent = Model109
  4006. Animation117.AnimationId = "http://www.roblox.com/Asset?ID=105211514"
  4007. BodyColors118.Parent = Model109
  4008. BodyColors118.HeadColor = BrickColor.new("Medium green")
  4009. BodyColors118.LeftArmColor = BrickColor.new("Medium green")
  4010. BodyColors118.LeftLegColor = BrickColor.new("Reddish brown")
  4011. BodyColors118.RightArmColor = BrickColor.new("Medium green")
  4012. BodyColors118.RightLegColor = BrickColor.new("Reddish brown")
  4013. BodyColors118.TorsoColor = BrickColor.new("Reddish brown")
  4014. BrickColorValue119.Name = "TEAM"
  4015. BrickColorValue119.Parent = Model109
  4016. BrickColorValue119.Value = BrickColor.new("Bright green")
  4017. Script120.Name = "Sound"
  4018. Script120.Parent = Model109
  4019. table.insert(cors,sandbox(Script120,function()
  4020. -- util
  4021.  
  4022. function waitForChild(parent, childName)
  4023. local child = parent:findFirstChild(childName)
  4024. if child then return child end
  4025. while true do
  4026. child = parent.ChildAdded:wait()
  4027. if child.Name==childName then return child end
  4028. end
  4029. end
  4030.  
  4031. function newSound(id)
  4032. local sound = Instance.new("Sound")
  4033. sound.SoundId = id
  4034. sound.archivable = false
  4035. sound.Parent = script.Parent.Head
  4036. return sound
  4037. end
  4038.  
  4039. -- declarations
  4040.  
  4041. local sDied = newSound("rbxasset://sounds/uuhhh.wav")
  4042. sDied.Pitch = 0.75
  4043. local sFallingDown = newSound("rbxasset://sounds/splat.wav")
  4044. local sFreeFalling = newSound("rbxasset://sounds/swoosh.wav")
  4045. local sGettingUp = newSound("rbxasset://sounds/hit.wav")
  4046. local sJumping = newSound("rbxasset://sounds/button.wav")
  4047. local sRunning = newSound("rbxasset://sounds/bfsl-minifigfoots1.mp3")
  4048. sRunning.Looped = true
  4049.  
  4050. local Figure = script.Parent
  4051. local Head = waitForChild(Figure, "Head")
  4052. local Humanoid = waitForChild(Figure, "Humanoid")
  4053.  
  4054. -- functions
  4055.  
  4056. function onDied()
  4057. sDied:Play()
  4058. wait(2.5)
  4059. script.Parent:Destroy()
  4060. end
  4061.  
  4062. function onState(state, sound)
  4063. if state then
  4064. sound:Play()
  4065. else
  4066. sound:Pause()
  4067. end
  4068. end
  4069.  
  4070. function onRunning(speed)
  4071. if speed>0 then
  4072. sRunning:Play()
  4073. else
  4074. sRunning:Pause()
  4075. end
  4076. end
  4077.  
  4078. -- connect up
  4079.  
  4080. Humanoid.Died:connect(onDied)
  4081. Humanoid.Running:connect(onRunning)
  4082. Humanoid.Jumping:connect(function(state) onState(state, sJumping) end)
  4083. Humanoid.GettingUp:connect(function(state) onState(state, sGettingUp) end)
  4084. Humanoid.FreeFalling:connect(function(state) onState(state, sFreeFalling) end)
  4085. Humanoid.FallingDown:connect(function(state) onState(state, sFallingDown) end)
  4086.  
  4087. end))
  4088. Humanoid121.Parent = Model109
  4089. Humanoid121.RightLeg = Part146
  4090. Humanoid121.LeftLeg = Part147
  4091. Humanoid121.Torso = Part155
  4092. Script122.Name = "HealthRegenerationScript"
  4093. Script122.Parent = Model109
  4094. Script122.Disabled = true
  4095. table.insert(cors,sandbox(Script122,function()
  4096. -- Renegeration Script for the bot
  4097. -- Renegerates about 1% of max hp per second until it reaches max health
  4098. bot = script.Parent
  4099. Humanoid = bot:FindFirstChild("Humanoid")
  4100.  
  4101. local regen = false
  4102.  
  4103. function regenerate()
  4104. if regen then return end
  4105. -- Lock this function until the regeneration to max health is complete by using a boolean toggle
  4106. regen = true
  4107. while Humanoid.Health < Humanoid.MaxHealth do
  4108. local delta = wait(1)
  4109. local health = Humanoid.Health
  4110. if health > 0 and health < Humanoid.MaxHealth then
  4111. -- This delta is for regenerating 1% of max hp per second instead of 1 hp per second
  4112. delta = 0.01 * delta * Humanoid.MaxHealth
  4113. health = health + delta
  4114. Humanoid.Health = math.min(health, Humanoid.MaxHealth)
  4115. end
  4116. end
  4117. -- release the lock, since the health is at max now, and if the character loses health again
  4118. -- it needs to start regenerating
  4119. regen = false
  4120. end
  4121.  
  4122. if Humanoid then
  4123. -- Better than a while true do loop since it only fires when the health actually changes
  4124. Humanoid.HealthChanged:connect(regenerate)
  4125. end
  4126.  
  4127. end))
  4128. Script123.Name = "Animate"
  4129. Script123.Parent = Model109
  4130. table.insert(cors,sandbox(Script123,function()
  4131. function waitForChild(parent, childName)
  4132. local child = parent:findFirstChild(childName)
  4133. if child then return child end
  4134. while true do
  4135. child = parent.ChildAdded:wait()
  4136. if child.Name==childName then return child end
  4137. end
  4138. end
  4139.  
  4140. local Figure = script.Parent
  4141. local Torso = waitForChild(Figure, "Torso")
  4142. local RightShoulder = waitForChild(Torso, "Right Shoulder")
  4143. local LeftShoulder = waitForChild(Torso, "Left Shoulder")
  4144. local RightHip = waitForChild(Torso, "Right Hip")
  4145. local LeftHip = waitForChild(Torso, "Left Hip")
  4146. local Neck = waitForChild(Torso, "Neck")
  4147. local Humanoid = waitForChild(Figure, "Humanoid")
  4148. local pose = "Standing"
  4149.  
  4150. local currentAnim = ""
  4151. local currentAnimTrack = nil
  4152. local currentAnimKeyframeHandler = nil
  4153. local currentAnimSpeed = 1.0
  4154. local animTable = {}
  4155. local animNames = {
  4156. idle = {
  4157. { id = "http://www.roblox.com/asset/?id=125750544", weight = 9 },
  4158. { id = "http://www.roblox.com/asset/?id=125750618", weight = 1 }
  4159. },
  4160. walk = {
  4161. { id = "http://www.roblox.com/asset/?id=125749145", weight = 10 }
  4162. },
  4163. run = {
  4164. { id = "run.xml", weight = 10 }
  4165. },
  4166. jump = {
  4167. { id = "http://www.roblox.com/asset/?id=125750702", weight = 10 }
  4168. },
  4169. fall = {
  4170. { id = "http://www.roblox.com/asset/?id=125750759", weight = 10 }
  4171. },
  4172. climb = {
  4173. { id = "http://www.roblox.com/asset/?id=125750800", weight = 10 }
  4174. },
  4175. toolnone = {
  4176. { id = "http://www.roblox.com/asset/?id=125750867", weight = 10 }
  4177. },
  4178. toolslash = {
  4179. { id = "http://www.roblox.com/asset/?id=129967390", weight = 10 }
  4180. -- { id = "slash.xml", weight = 10 }
  4181. },
  4182. toollunge = {
  4183. { id = "http://www.roblox.com/asset/?id=129967478", weight = 10 }
  4184. },
  4185. wave = {
  4186. { id = "http://www.roblox.com/asset/?id=128777973", weight = 10 }
  4187. },
  4188. point = {
  4189. { id = "http://www.roblox.com/asset/?id=128853357", weight = 10 }
  4190. },
  4191. dance = {
  4192. { id = "http://www.roblox.com/asset/?id=130018893", weight = 10 },
  4193. { id = "http://www.roblox.com/asset/?id=132546839", weight = 10 },
  4194. { id = "http://www.roblox.com/asset/?id=132546884", weight = 10 }
  4195. },
  4196. dance2 = {
  4197. { id = "http://www.roblox.com/asset/?id=160934142", weight = 10 },
  4198. { id = "http://www.roblox.com/asset/?id=160934298", weight = 10 },
  4199. { id = "http://www.roblox.com/asset/?id=160934376", weight = 10 }
  4200. },
  4201. dance3 = {
  4202. { id = "http://www.roblox.com/asset/?id=160934458", weight = 10 },
  4203. { id = "http://www.roblox.com/asset/?id=160934530", weight = 10 },
  4204. { id = "http://www.roblox.com/asset/?id=160934593", weight = 10 }
  4205. },
  4206. laugh = {
  4207. { id = "http://www.roblox.com/asset/?id=129423131", weight = 10 }
  4208. },
  4209. cheer = {
  4210. { id = "http://www.roblox.com/asset/?id=129423030", weight = 10 }
  4211. },
  4212. }
  4213.  
  4214. -- Existance in this list signifies that it is an emote, the value indicates if it is a looping emote
  4215. local emoteNames = { wave = false, point = false, dance = true, dance2 = true, dance3 = true, laugh = false, cheer = false}
  4216.  
  4217. math.randomseed(tick())
  4218.  
  4219. function configureAnimationSet(name, fileList)
  4220. if (animTable[name] ~= nil) then
  4221. for _, connection in pairs(animTable[name].connections) do
  4222. connection:disconnect()
  4223. end
  4224. end
  4225. animTable[name] = {}
  4226. animTable[name].count = 0
  4227. animTable[name].totalWeight = 0
  4228. animTable[name].connections = {}
  4229.  
  4230. -- check for config values
  4231. local config = script:FindFirstChild(name)
  4232. if (config ~= nil) then
  4233. -- print("Loading anims " .. name)
  4234. table.insert(animTable[name].connections, config.ChildAdded:connect(function(child) configureAnimationSet(name, fileList) end))
  4235. table.insert(animTable[name].connections, config.ChildRemoved:connect(function(child) configureAnimationSet(name, fileList) end))
  4236. local idx = 1
  4237. for _, childPart in pairs(config:GetChildren()) do
  4238. if (childPart:IsA("Animation")) then
  4239. table.insert(animTable[name].connections, childPart.Changed:connect(function(property) configureAnimationSet(name, fileList) end))
  4240. animTable[name][idx] = {}
  4241. animTable[name][idx].anim = childPart
  4242. local weightObject = childPart:FindFirstChild("Weight")
  4243. if (weightObject == nil) then
  4244. animTable[name][idx].weight = 1
  4245. else
  4246. animTable[name][idx].weight = weightObject.Value
  4247. end
  4248. animTable[name].count = animTable[name].count + 1
  4249. animTable[name].totalWeight = animTable[name].totalWeight + animTable[name][idx].weight
  4250. -- print(name .. " [" .. idx .. "] " .. animTable[name][idx].anim.AnimationId .. " (" .. animTable[name][idx].weight .. ")")
  4251. idx = idx + 1
  4252. end
  4253. end
  4254. end
  4255.  
  4256. -- fallback to defaults
  4257. if (animTable[name].count <= 0) then
  4258. for idx, anim in pairs(fileList) do
  4259. animTable[name][idx] = {}
  4260. animTable[name][idx].anim = Instance.new("Animation")
  4261. animTable[name][idx].anim.Name = name
  4262. animTable[name][idx].anim.AnimationId = anim.id
  4263. animTable[name][idx].weight = anim.weight
  4264. animTable[name].count = animTable[name].count + 1
  4265. animTable[name].totalWeight = animTable[name].totalWeight + anim.weight
  4266. -- print(name .. " [" .. idx .. "] " .. anim.id .. " (" .. anim.weight .. ")")
  4267. end
  4268. end
  4269. end
  4270.  
  4271. -- Setup animation objects
  4272. function scriptChildModified(child)
  4273. local fileList = animNames[child.Name]
  4274. if (fileList ~= nil) then
  4275. configureAnimationSet(child.Name, fileList)
  4276. end
  4277. end
  4278.  
  4279. script.ChildAdded:connect(scriptChildModified)
  4280. script.ChildRemoved:connect(scriptChildModified)
  4281.  
  4282.  
  4283. for name, fileList in pairs(animNames) do
  4284. configureAnimationSet(name, fileList)
  4285. end
  4286.  
  4287. -- ANIMATION
  4288.  
  4289. -- declarations
  4290. local toolAnim = "None"
  4291. local toolAnimTime = 0
  4292.  
  4293. local jumpAnimTime = 0
  4294. local jumpAnimDuration = 0.3
  4295.  
  4296. local toolTransitionTime = 0.1
  4297. local fallTransitionTime = 0.3
  4298. local jumpMaxLimbVelocity = 0.75
  4299.  
  4300. -- functions
  4301.  
  4302. function stopAllAnimations()
  4303. local oldAnim = currentAnim
  4304.  
  4305. -- return to idle if finishing an emote
  4306. if (emoteNames[oldAnim] ~= nil and emoteNames[oldAnim] == false) then
  4307. oldAnim = "idle"
  4308. end
  4309.  
  4310. currentAnim = ""
  4311. if (currentAnimKeyframeHandler ~= nil) then
  4312. currentAnimKeyframeHandler:disconnect()
  4313. end
  4314.  
  4315. if (currentAnimTrack ~= nil) then
  4316. currentAnimTrack:Stop()
  4317. currentAnimTrack:Destroy()
  4318. currentAnimTrack = nil
  4319. end
  4320. return oldAnim
  4321. end
  4322.  
  4323. function setAnimationSpeed(speed)
  4324. if speed ~= currentAnimSpeed then
  4325. currentAnimSpeed = speed
  4326. currentAnimTrack:AdjustSpeed(currentAnimSpeed)
  4327. end
  4328. end
  4329.  
  4330. function keyFrameReachedFunc(frameName)
  4331. if (frameName == "End") then
  4332. -- print("Keyframe : ".. frameName)
  4333. local repeatAnim = stopAllAnimations()
  4334. local animSpeed = currentAnimSpeed
  4335. playAnimation(repeatAnim, 0.0, Humanoid)
  4336. setAnimationSpeed(animSpeed)
  4337. end
  4338. end
  4339.  
  4340. -- Preload animations
  4341. function playAnimation(animName, transitionTime, humanoid)
  4342. local idleFromEmote = (animName == "idle" and emoteNames[currentAnim] ~= nil)
  4343. if (animName ~= currentAnim and not idleFromEmote) then
  4344.  
  4345. if (currentAnimTrack ~= nil) then
  4346. currentAnimTrack:Stop(transitionTime)
  4347. currentAnimTrack:Destroy()
  4348. end
  4349.  
  4350. currentAnimSpeed = 1.0
  4351. local roll = math.random(1, animTable[animName].totalWeight)
  4352. local origRoll = roll
  4353. local idx = 1
  4354. while (roll > animTable[animName][idx].weight) do
  4355. roll = roll - animTable[animName][idx].weight
  4356. idx = idx + 1
  4357. end
  4358. -- print(animName .. " " .. idx .. " [" .. origRoll .. "]")
  4359. local anim = animTable[animName][idx].anim
  4360.  
  4361. -- load it to the humanoid; get AnimationTrack
  4362. currentAnimTrack = humanoid:LoadAnimation(anim)
  4363.  
  4364. -- play the animation
  4365. currentAnimTrack:Play(transitionTime)
  4366. currentAnim = animName
  4367.  
  4368. -- set up keyframe name triggers
  4369. if (currentAnimKeyframeHandler ~= nil) then
  4370. currentAnimKeyframeHandler:disconnect()
  4371. end
  4372. currentAnimKeyframeHandler = currentAnimTrack.KeyframeReached:connect(keyFrameReachedFunc)
  4373. end
  4374. end
  4375.  
  4376. -------------------------------------------------------------------------------------------
  4377. -------------------------------------------------------------------------------------------
  4378.  
  4379. local toolAnimName = ""
  4380. local toolAnimTrack = nil
  4381. local currentToolAnimKeyframeHandler = nil
  4382.  
  4383. function toolKeyFrameReachedFunc(frameName)
  4384. if (frameName == "End") then
  4385. -- print("Keyframe : ".. frameName)
  4386. local repeatAnim = stopToolAnimations()
  4387. playToolAnimation(repeatAnim, 0.0, Humanoid)
  4388. end
  4389. end
  4390.  
  4391.  
  4392. function playToolAnimation(animName, transitionTime, humanoid)
  4393. if (animName ~= toolAnimName) then
  4394.  
  4395. if (toolAnimTrack ~= nil) then
  4396. toolAnimTrack:Stop()
  4397. toolAnimTrack:Destroy()
  4398. transitionTime = 0
  4399. end
  4400.  
  4401. local roll = math.random(1, animTable[animName].totalWeight)
  4402. local origRoll = roll
  4403. local idx = 1
  4404. while (roll > animTable[animName][idx].weight) do
  4405. roll = roll - animTable[animName][idx].weight
  4406. idx = idx + 1
  4407. end
  4408. -- print(animName .. " * " .. idx .. " [" .. origRoll .. "]")
  4409. local anim = animTable[animName][idx].anim
  4410.  
  4411. -- load it to the humanoid; get AnimationTrack
  4412. toolAnimTrack = humanoid:LoadAnimation(anim)
  4413.  
  4414. -- play the animation
  4415. toolAnimTrack:Play(transitionTime)
  4416. toolAnimName = animName
  4417.  
  4418. currentToolAnimKeyframeHandler = toolAnimTrack.KeyframeReached:connect(toolKeyFrameReachedFunc)
  4419. end
  4420. end
  4421.  
  4422. function stopToolAnimations()
  4423. local oldAnim = toolAnimName
  4424.  
  4425. if (currentToolAnimKeyframeHandler ~= nil) then
  4426. currentToolAnimKeyframeHandler:disconnect()
  4427. end
  4428.  
  4429. toolAnimName = ""
  4430. if (toolAnimTrack ~= nil) then
  4431. toolAnimTrack:Stop()
  4432. toolAnimTrack:Destroy()
  4433. toolAnimTrack = nil
  4434. end
  4435.  
  4436.  
  4437. return oldAnim
  4438. end
  4439.  
  4440. -------------------------------------------------------------------------------------------
  4441. -------------------------------------------------------------------------------------------
  4442.  
  4443.  
  4444. function onRunning(speed)
  4445. if speed>0.01 then
  4446. playAnimation("walk", 0.1, Humanoid)
  4447. pose = "Running"
  4448. else
  4449. playAnimation("idle", 0.1, Humanoid)
  4450. pose = "Standing"
  4451. end
  4452. end
  4453.  
  4454. function onDied()
  4455. pose = "Dead"
  4456. end
  4457.  
  4458. function onJumping()
  4459. playAnimation("jump", 0.1, Humanoid)
  4460. jumpAnimTime = jumpAnimDuration
  4461. pose = "Jumping"
  4462. end
  4463.  
  4464. function onClimbing(speed)
  4465. playAnimation("climb", 0.1, Humanoid)
  4466. setAnimationSpeed(speed / 12.0)
  4467. pose = "Climbing"
  4468. end
  4469.  
  4470. function onGettingUp()
  4471. pose = "GettingUp"
  4472. end
  4473.  
  4474. function onFreeFall()
  4475. if (jumpAnimTime <= 0) then
  4476. playAnimation("fall", fallTransitionTime, Humanoid)
  4477. end
  4478. pose = "FreeFall"
  4479. end
  4480.  
  4481. function onFallingDown()
  4482. pose = "FallingDown"
  4483. end
  4484.  
  4485. function onSeated()
  4486. pose = "Seated"
  4487. end
  4488.  
  4489. function onPlatformStanding()
  4490. pose = "PlatformStanding"
  4491. end
  4492.  
  4493. function onSwimming(speed)
  4494. if speed>0 then
  4495. pose = "Running"
  4496. else
  4497. pose = "Standing"
  4498. end
  4499. end
  4500.  
  4501. function getTool()
  4502. for _, kid in ipairs(Figure:GetChildren()) do
  4503. if kid.className == "Tool" then return kid end
  4504. end
  4505. return nil
  4506. end
  4507.  
  4508. function getToolAnim(tool)
  4509. for _, c in ipairs(tool:GetChildren()) do
  4510. if c.Name == "toolanim" and c.className == "StringValue" then
  4511. return c
  4512. end
  4513. end
  4514. return nil
  4515. end
  4516.  
  4517. function animateTool()
  4518.  
  4519. if (toolAnim == "None") then
  4520. playToolAnimation("toolnone", toolTransitionTime, Humanoid)
  4521. return
  4522. end
  4523.  
  4524. if (toolAnim == "Slash") then
  4525. playToolAnimation("toolslash", 0, Humanoid)
  4526. return
  4527. end
  4528.  
  4529. if (toolAnim == "Lunge") then
  4530. playToolAnimation("toollunge", 0, Humanoid)
  4531. return
  4532. end
  4533. end
  4534.  
  4535. function moveSit()
  4536. RightShoulder.MaxVelocity = 0.15
  4537. LeftShoulder.MaxVelocity = 0.15
  4538. RightShoulder:SetDesiredAngle(3.14 /2)
  4539. LeftShoulder:SetDesiredAngle(-3.14 /2)
  4540. RightHip:SetDesiredAngle(3.14 /2)
  4541. LeftHip:SetDesiredAngle(-3.14 /2)
  4542. end
  4543.  
  4544. local lastTick = 0
  4545.  
  4546. function move(time)
  4547. local amplitude = 1
  4548. local frequency = 1
  4549. local deltaTime = time - lastTick
  4550. lastTick = time
  4551.  
  4552. local climbFudge = 0
  4553. local setAngles = false
  4554.  
  4555. if (jumpAnimTime > 0) then
  4556. jumpAnimTime = jumpAnimTime - deltaTime
  4557. end
  4558.  
  4559. if (pose == "FreeFall" and jumpAnimTime <= 0) then
  4560. playAnimation("fall", fallTransitionTime, Humanoid)
  4561. elseif (pose == "Seated") then
  4562. stopAllAnimations()
  4563. moveSit()
  4564. return
  4565. elseif (pose == "Running") then
  4566. playAnimation("walk", 0.1, Humanoid)
  4567. elseif (pose == "Dead" or pose == "GettingUp" or pose == "FallingDown" or pose == "Seated" or pose == "PlatformStanding") then
  4568. -- print("Wha " .. pose)
  4569. amplitude = 0.1
  4570. frequency = 1
  4571. setAngles = true
  4572. end
  4573.  
  4574. if (setAngles) then
  4575. desiredAngle = amplitude * math.sin(time * frequency)
  4576.  
  4577. RightShoulder:SetDesiredAngle(desiredAngle + climbFudge)
  4578. LeftShoulder:SetDesiredAngle(desiredAngle - climbFudge)
  4579. RightHip:SetDesiredAngle(-desiredAngle)
  4580. LeftHip:SetDesiredAngle(-desiredAngle)
  4581. end
  4582.  
  4583. -- Tool Animation handling
  4584. local tool = getTool()
  4585. if tool then
  4586.  
  4587. animStringValueObject = getToolAnim(tool)
  4588.  
  4589. if animStringValueObject then
  4590. toolAnim = animStringValueObject.Value
  4591. -- message recieved, delete StringValue
  4592. animStringValueObject.Parent = nil
  4593. toolAnimTime = time + .3
  4594. end
  4595.  
  4596. if time > toolAnimTime then
  4597. toolAnimTime = 0
  4598. toolAnim = "None"
  4599. end
  4600.  
  4601. animateTool()
  4602. else
  4603. stopToolAnimations()
  4604. toolAnim = "None"
  4605. toolAnimTime = 0
  4606. end
  4607. end
  4608.  
  4609. -- connect events
  4610. Humanoid.Died:connect(onDied)
  4611. Humanoid.Running:connect(onRunning)
  4612. Humanoid.Jumping:connect(onJumping)
  4613. Humanoid.Climbing:connect(onClimbing)
  4614. Humanoid.GettingUp:connect(onGettingUp)
  4615. Humanoid.FreeFalling:connect(onFreeFall)
  4616. Humanoid.FallingDown:connect(onFallingDown)
  4617. Humanoid.Seated:connect(onSeated)
  4618. Humanoid.PlatformStanding:connect(onPlatformStanding)
  4619. Humanoid.Swimming:connect(onSwimming)
  4620.  
  4621. -- setup emote chat hook
  4622.  
  4623.  
  4624. -- main program
  4625.  
  4626. local runService = game:service("RunService");
  4627.  
  4628. -- initialize to idle
  4629. playAnimation("idle", 0.1, Humanoid)
  4630. pose = "Standing"
  4631.  
  4632. while Figure.Parent~=nil do
  4633. local _, time = wait(0.1)
  4634. move(time)
  4635. end
  4636.  
  4637.  
  4638.  
  4639. end))
  4640. StringValue124.Name = "climb"
  4641. StringValue124.Parent = Script123
  4642. Animation125.Name = "ClimbAnim"
  4643. Animation125.Parent = StringValue124
  4644. Animation125.AnimationId = "http://www.roblox.com/asset/?id=125750800"
  4645. StringValue126.Name = "fall"
  4646. StringValue126.Parent = Script123
  4647. Animation127.Name = "FallAnim"
  4648. Animation127.Parent = StringValue126
  4649. Animation127.AnimationId = "http://www.roblox.com/asset/?id=125750759"
  4650. StringValue128.Name = "idle"
  4651. StringValue128.Parent = Script123
  4652. Animation129.Name = "Animation1"
  4653. Animation129.Parent = StringValue128
  4654. Animation129.AnimationId = "http://www.roblox.com/asset/?id=125750544"
  4655. NumberValue130.Name = "Weight"
  4656. NumberValue130.Parent = Animation129
  4657. NumberValue130.Value = 9
  4658. Animation131.Name = "Animation2"
  4659. Animation131.Parent = StringValue128
  4660. Animation131.AnimationId = "http://www.roblox.com/asset/?id=125750618"
  4661. NumberValue132.Name = "Weight"
  4662. NumberValue132.Parent = Animation131
  4663. NumberValue132.Value = 1
  4664. StringValue133.Name = "jump"
  4665. StringValue133.Parent = Script123
  4666. Animation134.Name = "JumpAnim"
  4667. Animation134.Parent = StringValue133
  4668. Animation134.AnimationId = "http://www.roblox.com/asset/?id=125750702"
  4669. StringValue135.Name = "run"
  4670. StringValue135.Parent = Script123
  4671. Animation136.Name = "RunAnim"
  4672. Animation136.Parent = StringValue135
  4673. Animation136.AnimationId = "http://www.roblox.com/asset/?id=125749145"
  4674. StringValue137.Name = "toolnone"
  4675. StringValue137.Parent = Script123
  4676. Animation138.Name = "ToolNoneAnim"
  4677. Animation138.Parent = StringValue137
  4678. Animation138.AnimationId = "http://www.roblox.com/asset/?id=125750867"
  4679. StringValue139.Name = "walk"
  4680. StringValue139.Parent = Script123
  4681. Animation140.Name = "WalkAnim"
  4682. Animation140.Parent = StringValue139
  4683. Animation140.AnimationId = "http://www.roblox.com/asset/?id=125749145"
  4684. Part141.Name = "Head"
  4685. Part141.Parent = Model109
  4686. Part141.BrickColor = BrickColor.new("Cool yellow")
  4687. Part141.Rotation = Vector3.new(0, 90, 0)
  4688. Part141.FormFactor = Enum.FormFactor.Symmetric
  4689. Part141.Size = Vector3.new(2, 1, 1)
  4690. Part141.CFrame = CFrame.new(8.79733276, 4.45095634, -17.2153912, 0.000532949809, -0.000846050854, 1.00000048, 7.0162085e-09, 0.999999642, 0.000846053765, -1.00000155, -4.46565792e-07, 0.000533248123)
  4691. Part141.BottomSurface = Enum.SurfaceType.Smooth
  4692. Part141.TopSurface = Enum.SurfaceType.Smooth
  4693. Part141.Color = Color3.new(0.992157, 0.917647, 0.552941)
  4694. Part141.Position = Vector3.new(8.79733276, 4.45095634, -17.2153912)
  4695. Part141.Orientation = Vector3.new(-0.049999997, 89.9700012, 0)
  4696. Part141.Color = Color3.new(0.992157, 0.917647, 0.552941)
  4697. SpecialMesh142.Parent = Part141
  4698. SpecialMesh142.Scale = Vector3.new(1.25, 1.25, 1.25)
  4699. SpecialMesh142.Scale = Vector3.new(1.25, 1.25, 1.25)
  4700. Decal143.Parent = Part141
  4701. Decal143.Texture = "http://www.roblox.com/asset/?id=134724710"
  4702. Part144.Name = "Right Arm"
  4703. Part144.Parent = Model109
  4704. Part144.BrickColor = BrickColor.new("Cool yellow")
  4705. Part144.Rotation = Vector3.new(0, 90, 0)
  4706. Part144.CanCollide = false
  4707. Part144.FormFactor = Enum.FormFactor.Symmetric
  4708. Part144.Size = Vector3.new(1, 2, 1)
  4709. Part144.CFrame = CFrame.new(8.79940128, 2.95095706, -18.7153931, 0.000532949809, -0.000846050738, 1.00000048, 7.0162085e-09, 0.999999523, 0.000846053765, -1.00000155, -4.46565736e-07, 0.000533248123)
  4710. Part144.BottomSurface = Enum.SurfaceType.Smooth
  4711. Part144.TopSurface = Enum.SurfaceType.Smooth
  4712. Part144.Color = Color3.new(0.992157, 0.917647, 0.552941)
  4713. Part144.Position = Vector3.new(8.79940128, 2.95095706, -18.7153931)
  4714. Part144.Orientation = Vector3.new(-0.049999997, 89.9700012, 0)
  4715. Part144.Color = Color3.new(0.992157, 0.917647, 0.552941)
  4716. Part145.Name = "Left Arm"
  4717. Part145.Parent = Model109
  4718. Part145.BrickColor = BrickColor.new("Cool yellow")
  4719. Part145.Rotation = Vector3.new(0, 90, 0)
  4720. Part145.CanCollide = false
  4721. Part145.FormFactor = Enum.FormFactor.Symmetric
  4722. Part145.Size = Vector3.new(1, 2, 1)
  4723. Part145.CFrame = CFrame.new(8.79780293, 2.95095706, -15.7153893, 0.000532949809, -0.000846050738, 1.00000048, 7.0162085e-09, 0.999999523, 0.000846053765, -1.00000155, -4.46565736e-07, 0.000533248123)
  4724. Part145.BottomSurface = Enum.SurfaceType.Smooth
  4725. Part145.TopSurface = Enum.SurfaceType.Smooth
  4726. Part145.Color = Color3.new(0.992157, 0.917647, 0.552941)
  4727. Part145.Position = Vector3.new(8.79780293, 2.95095706, -15.7153893)
  4728. Part145.Orientation = Vector3.new(-0.049999997, 89.9700012, 0)
  4729. Part145.Color = Color3.new(0.992157, 0.917647, 0.552941)
  4730. Part146.Name = "Right Leg"
  4731. Part146.Parent = Model109
  4732. Part146.BrickColor = BrickColor.new("Bright blue")
  4733. Part146.Rotation = Vector3.new(0, 90, 0)
  4734. Part146.CanCollide = false
  4735. Part146.FormFactor = Enum.FormFactor.Symmetric
  4736. Part146.Size = Vector3.new(1, 2, 1)
  4737. Part146.CFrame = CFrame.new(8.80056095, 0.950957894, -17.7153912, 0.000532949809, -0.000846050738, 1.00000048, 7.0162085e-09, 0.999999523, 0.000846053765, -1.00000155, -4.46565736e-07, 0.000533248123)
  4738. Part146.BottomSurface = Enum.SurfaceType.Smooth
  4739. Part146.TopSurface = Enum.SurfaceType.Smooth
  4740. Part146.Color = Color3.new(0.0509804, 0.411765, 0.67451)
  4741. Part146.Position = Vector3.new(8.80056095, 0.950957894, -17.7153912)
  4742. Part146.Orientation = Vector3.new(-0.049999997, 89.9700012, 0)
  4743. Part146.Color = Color3.new(0.0509804, 0.411765, 0.67451)
  4744. Part147.Name = "Left Leg"
  4745. Part147.Parent = Model109
  4746. Part147.BrickColor = BrickColor.new("Bright blue")
  4747. Part147.Rotation = Vector3.new(0, 90, 0)
  4748. Part147.CanCollide = false
  4749. Part147.FormFactor = Enum.FormFactor.Symmetric
  4750. Part147.Size = Vector3.new(1, 2, 1)
  4751. Part147.CFrame = CFrame.new(8.80002785, 0.950957894, -16.7153893, 0.000532949809, -0.000846050738, 1.00000048, 7.0162085e-09, 0.999999523, 0.000846053765, -1.00000155, -4.46565736e-07, 0.000533248123)
  4752. Part147.BottomSurface = Enum.SurfaceType.Smooth
  4753. Part147.TopSurface = Enum.SurfaceType.Smooth
  4754. Part147.Color = Color3.new(0.0509804, 0.411765, 0.67451)
  4755. Part147.Position = Vector3.new(8.80002785, 0.950957894, -16.7153893)
  4756. Part147.Orientation = Vector3.new(-0.049999997, 89.9700012, 0)
  4757. Part147.Color = Color3.new(0.0509804, 0.411765, 0.67451)
  4758. Part148.Name = "Torso"
  4759. Part148.Parent = Model109
  4760. Part148.BrickColor = BrickColor.new("Dark green")
  4761. Part148.Rotation = Vector3.new(0, 90, 0)
  4762. Part148.CanCollide = false
  4763. Part148.FormFactor = Enum.FormFactor.Symmetric
  4764. Part148.Size = Vector3.new(2, 2, 1)
  4765. Part148.CFrame = CFrame.new(8.7986021, 2.95095706, -17.2153912, 0.000532949809, -0.000846050854, 1.00000048, 7.0162085e-09, 0.999999642, 0.000846053765, -1.00000155, -4.46565792e-07, 0.000533248123)
  4766. Part148.BottomSurface = Enum.SurfaceType.Smooth
  4767. Part148.TopSurface = Enum.SurfaceType.Smooth
  4768. Part148.Color = Color3.new(0.156863, 0.498039, 0.278431)
  4769. Part148.Position = Vector3.new(8.7986021, 2.95095706, -17.2153912)
  4770. Part148.Orientation = Vector3.new(-0.049999997, 89.9700012, 0)
  4771. Part148.Color = Color3.new(0.156863, 0.498039, 0.278431)
  4772. Sound149.Name = "HitSound"
  4773. Sound149.Parent = Part148
  4774. Sound149.SoundId = "http://www.roblox.com/asset/?id=93591808"
  4775. Motor6D150.Name = "Left Hip"
  4776. Motor6D150.Parent = Part148
  4777. Motor6D150.C0 = CFrame.new(-1, -1, 0, -4.37113883e-08, 0, -1, 0, 0.99999994, 0, 1, 0, -4.37113883e-08)
  4778. Motor6D150.C1 = CFrame.new(-0.5, 1, 0, -4.37113883e-08, 0, -1, 0, 0.99999994, 0, 1, 0, -4.37113883e-08)
  4779. Motor6D150.Part0 = Part148
  4780. Motor6D150.Part1 = Part147
  4781. Motor6D150.MaxVelocity = 0.10000000149012
  4782. Motor6D151.Name = "Right Hip"
  4783. Motor6D151.Parent = Part148
  4784. Motor6D151.C0 = CFrame.new(1, -1, 0, -4.37113883e-08, 0, 1, -0, 0.99999994, 0, -1, 0, -4.37113883e-08)
  4785. Motor6D151.C1 = CFrame.new(0.5, 1, 0, -4.37113883e-08, 0, 1, 0, 0.99999994, 0, -1, 0, -4.37113883e-08)
  4786. Motor6D151.Part0 = Part148
  4787. Motor6D151.Part1 = Part146
  4788. Motor6D151.MaxVelocity = 0.10000000149012
  4789. Motor6D152.Name = "Left Shoulder"
  4790. Motor6D152.Parent = Part148
  4791. Motor6D152.C0 = CFrame.new(-1, 0.5, 0, -4.37113883e-08, 0, -1, 0, 0.99999994, 0, 1, 0, -4.37113883e-08)
  4792. Motor6D152.C1 = CFrame.new(0.5, 0.5, 0, -4.37113883e-08, 0, -1, 0, 0.99999994, 0, 1, 0, -4.37113883e-08)
  4793. Motor6D152.Part0 = Part148
  4794. Motor6D152.Part1 = Part145
  4795. Motor6D152.MaxVelocity = 0.10000000149012
  4796. Motor6D153.Name = "Right Shoulder"
  4797. Motor6D153.Parent = Part148
  4798. Motor6D153.C0 = CFrame.new(1, 0.5, 0, -4.37113883e-08, 0, 1, -0, 0.99999994, 0, -1, 0, -4.37113883e-08)
  4799. Motor6D153.C1 = CFrame.new(-0.5, 0.5, 0, -4.37113883e-08, 0, 1, 0, 0.99999994, 0, -1, 0, -4.37113883e-08)
  4800. Motor6D153.Part0 = Part148
  4801. Motor6D153.Part1 = Part144
  4802. Motor6D153.MaxVelocity = 0.10000000149012
  4803. Motor6D154.Name = "Neck"
  4804. Motor6D154.Parent = Part148
  4805. Motor6D154.C0 = CFrame.new(0, 1, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
  4806. Motor6D154.C1 = CFrame.new(0, -0.5, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
  4807. Motor6D154.Part0 = Part148
  4808. Motor6D154.Part1 = Part141
  4809. Motor6D154.MaxVelocity = 0.10000000149012
  4810. Part155.Name = "HumanoidRootPart"
  4811. Part155.Parent = Model109
  4812. Part155.Transparency = 1
  4813. Part155.Rotation = Vector3.new(0, 90, 0)
  4814. Part155.FormFactor = Enum.FormFactor.Symmetric
  4815. Part155.Size = Vector3.new(2, 2, 1)
  4816. Part155.CFrame = CFrame.new(8.7986021, 2.95095706, -17.2153912, 0.000532949809, -0.000846050854, 1.00000048, 7.0162085e-09, 0.999999642, 0.000846053765, -1.00000155, -4.46565792e-07, 0.000533248123)
  4817. Part155.BottomSurface = Enum.SurfaceType.Smooth
  4818. Part155.TopSurface = Enum.SurfaceType.Smooth
  4819. Part155.Position = Vector3.new(8.7986021, 2.95095706, -17.2153912)
  4820. Part155.Orientation = Vector3.new(-0.049999997, 89.9700012, 0)
  4821. Motor6D156.Name = "Root Hip"
  4822. Motor6D156.Parent = Part155
  4823. Motor6D156.C0 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
  4824. Motor6D156.C1 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
  4825. Motor6D156.Part0 = Part155
  4826. Motor6D156.Part1 = Part148
  4827. Motor6D156.MaxVelocity = 0.10000000149012
  4828. Script157.Name = "READ ME"
  4829. Script157.Parent = Model109
  4830. table.insert(cors,sandbox(Script157,function()
  4831. --- Please support and like and fav. Zombie wars for more updates.
  4832.  
  4833.  
  4834.  
  4835.  
  4836.  
  4837.  
  4838.  
  4839.  
  4840.  
  4841.  
  4842.  
  4843.  
  4844.  
  4845.  
  4846.  
  4847.  
  4848. ---THANK YOU
  4849.  
  4850.  
  4851.  
  4852.  
  4853.  
  4854. --YUANRAVIEH190
  4855. end))
  4856. Part158.Name = "MonsterSpawn"
  4857. Part158.Parent = Model108
  4858. Part158.Material = Enum.Material.Neon
  4859. Part158.BrickColor = BrickColor.new("Reddish brown")
  4860. Part158.Rotation = Vector3.new(0, 90, 0)
  4861. Part158.Anchored = true
  4862. Part158.CanCollide = false
  4863. Part158.FormFactor = Enum.FormFactor.Custom
  4864. Part158.Size = Vector3.new(6, 0.200000003, 6)
  4865. Part158.CFrame = CFrame.new(8.40016365, -0.149426997, -17.2251568, -1.94256427e-06, 2.03144737e-08, 1.00000048, 1.57338604e-08, 0.999990463, -3.37604433e-09, -1.00000083, 1.46186778e-08, -1.79343624e-06)
  4866. Part158.BottomSurface = Enum.SurfaceType.Smooth
  4867. Part158.TopSurface = Enum.SurfaceType.Smooth
  4868. Part158.Color = Color3.new(0.411765, 0.25098, 0.156863)
  4869. Part158.Position = Vector3.new(8.40016365, -0.149426997, -17.2251568)
  4870. Part158.Orientation = Vector3.new(0, 90, 0)
  4871. Part158.Color = Color3.new(0.411765, 0.25098, 0.156863)
  4872. Decal159.Parent = Part158
  4873. Decal159.Texture = "http://www.roblox.com/asset/?id=134724710"
  4874. Decal159.Face = Enum.NormalId.Top
  4875. Script160.Parent = Part158
  4876. table.insert(cors,sandbox(Script160,function()
  4877. zombie = script.Parent.Parent.Zombie
  4878. zombiebackup = zombie:Clone()
  4879. zombie:remove()
  4880.  
  4881. while true do
  4882. wait(5)
  4883. local newzombie = zombiebackup:Clone()
  4884. newzombie.Parent = game.Workspace
  4885. newzombie:MakeJoints()
  4886. newzombie.Torso.CFrame = script.Parent.CFrame + Vector3.new(0, 5, 0)
  4887. newzombie:MakeJoints()
  4888. zombie = newzombie
  4889. zombiebackup = zombie:Clone()
  4890. end
  4891. end))
  4892. ManualWeld161.Name = "MonsterSpawn-to-MonsterSpawn Strong Joint"
  4893. ManualWeld161.Parent = Part158
  4894. ManualWeld161.C0 = CFrame.new(3, -0.100000001, 3, 0, 0, 1, 0, 1, -0, -1, 0, 0)
  4895. ManualWeld161.C1 = CFrame.new(-3, -0.100000001, 3, 0, 0, 1, 0, 1, -0, -1, 0, 0)
  4896. ManualWeld161.Part0 = Part158
  4897. for i,v in pairs(mas:GetChildren()) do
  4898. v.Parent = workspace
  4899. pcall(function() v:MakeJoints() end)
  4900. end
  4901. mas:Destroy()
  4902. for i,v in pairs(cors) do
  4903. spawn(function()
  4904. pcall(v)
  4905. end)
  4906. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement