LelXD

Scythe Tool

Feb 11th, 2016
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 39.42 KB | None | 0 0
  1. --Created with ttyyuu12345's compiler
  2. --Errors: TouchTransmitter,LocalScript
  3. Create = function(itemClass,tabl)
  4. local item = Instance.new(itemClass)
  5. for i,v in pairs(tabl) do
  6. local a,b = ypcall(function() return item[i] end)
  7. if a then
  8. item[i] = tabl[i]
  9. end
  10. end
  11. return item
  12. end
  13. function runDummyScript(f,scri)
  14. local oldenv = getfenv(f)
  15. local newenv = setmetatable({}, {
  16. __index = function(_, k)
  17. if k:lower() == 'script' then
  18. return scri
  19. else
  20. return oldenv[k]
  21. end
  22. end
  23. })
  24. setfenv(f, newenv)
  25. ypcall(function() f() end)
  26. end
  27. cors = {}
  28. mas = Instance.new("Model",game:GetService("Lighting"))
  29. mas.Name = "CompiledModel"
  30. o1 = Create("Tool",{
  31. ["Name"] = "Necromancer's Scythe Ver.2",
  32. ["Parent"] = mas,
  33. ["TextureId"] = "http://www.roblox.com/asset/?id=26414820",
  34. ["GripForward"] = Vector3.new(-0.0100994846, -0.999948978, 0),
  35. ["GripRight"] = Vector3.new(-0.999948978, 0.0100994846, 0),
  36. ["GripUp"] = Vector3.new(0, 0, 1),
  37. })
  38. o2 = Create("Part",{
  39. ["Name"] = "Handle",
  40. ["Parent"] = o1,
  41. ["Position"] = Vector3.new(0.0470000021, 4.20000029, -2.5),
  42. ["Rotation"] = Vector3.new(-90, 0, -90),
  43. ["CFrame"] = CFrame.new(0.0470000021, 4.20000029, -2.5, -4.37113883e-008, 1, 0, 4.37113883e-008, 1.91068547e-015, 1, 1, 4.37113883e-008, -4.37113883e-008),
  44. ["CanCollide"] = false,
  45. ["Size"] = Vector3.new(1, 1.20000005, 6),
  46. })
  47. o3 = Create("Sound",{
  48. ["Parent"] = o2,
  49. ["SoundId"] = "http://www.roblox.com/asset/?id=28144277",
  50. ["Volume"] = 0.69999998807907,
  51. })
  52. o4 = Create("Sound",{
  53. ["Parent"] = o2,
  54. ["SoundId"] = "http://www.roblox.com/asset/?id=28257433",
  55. ["Volume"] = 1,
  56. })
  57. o5 = Create("SpecialMesh",{
  58. ["Parent"] = o2,
  59. ["MeshId"] = "http://www.roblox.com/asset/?id=28140935 ",
  60. ["TextureId"] = "http://www.roblox.com/asset/?id=27739981",
  61. ["MeshType"] = Enum.MeshType.FileMesh,
  62. })
  63. o6 = Create("Sound",{
  64. ["Parent"] = o2,
  65. ["SoundId"] = "http://www.roblox.com/asset/?id=28144425",
  66. ["Volume"] = 1,
  67. })
  68. o7 = Create("Sound",{
  69. ["Parent"] = o2,
  70. ["SoundId"] = "http://www.roblox.com/asset/?id=28144291",
  71. ["Volume"] = 0.69999998807907,
  72. })
  73. o9 = Create("Sound",{
  74. ["Parent"] = o1,
  75. ["SoundId"] = "http://www.roblox.com/asset/?id=25954407",
  76. ["Volume"] = 1,
  77. })
  78. o10 = Create("Script",{
  79. ["Name"] = "ChaseScript",
  80. ["Parent"] = o1,
  81. })
  82. table.insert(cors,coroutine.create(function()
  83. wait()
  84. runDummyScript(function()
  85. wait(3)
  86. zombieParent = false
  87.  
  88. while zombieParent == false do
  89.  
  90. wait(1)
  91. if script.Parent.Name == "SummonedZombie" then
  92. zombieParent = true
  93. end
  94.  
  95. end
  96.  
  97. local larm = script.Parent:FindFirstChild("Left Arm")
  98. local rarm = script.Parent:FindFirstChild("Right Arm")
  99. local waitTimer = 0
  100.  
  101. function findNearestTorso(pos)
  102. local list = game.Workspace:children()
  103. local torso = nil
  104. local dist = 100
  105. local temp = nil
  106. local human = nil
  107. local temp2 = nil
  108. for x = 1, #list do
  109. temp2 = list[x]
  110. if (temp2.className == "Model") and (temp2 ~= script.Parent) and (temp2.Name ~= "SummonedZombie") then
  111. temp = temp2:findFirstChild("Torso")
  112. human = temp2:findFirstChild("Humanoid")
  113. if (temp ~= nil) and (human ~= nil) and (human.Health > 0) and (human ~= script.Parent.Owner.Value) then
  114. if (temp.Position - pos).magnitude < dist then
  115. torso = temp
  116. dist = (temp.Position - pos).magnitude
  117. end
  118. end
  119. end
  120. end
  121. return torso
  122. end
  123.  
  124. function Hit(hit)
  125. local human = hit.Parent:FindFirstChild("Humanoid")
  126. if human ~= nil and human ~= script.Parent.Owner.Value and waitTimer == 0 and human.Parent.Name ~= "SummonedZombie" then
  127. human:TakeDamage(20)
  128. waitTimer = 1
  129. end
  130. end
  131.  
  132. larm.Touched:connect(Hit)
  133. rarm.Touched:connect(Hit)
  134.  
  135. while true do
  136. wait(1)
  137. local target = findNearestTorso(script.Parent.Torso.Position)
  138. if target ~= nil then
  139. script.Parent.Humanoid:MoveTo(target.Position, target)
  140. end
  141. if waitTimer > 0 then
  142. waitTimer = waitTimer - 1
  143. end
  144. if script.Parent.Humanoid.Health < 1 then
  145. wait(2)
  146. script.Parent:remove()
  147. end
  148. jumper = math.random(1,2)
  149. if jumper == 5 then
  150. script.Parent.Humanoid.Jump = true
  151. end
  152. end
  153.  
  154. end,o10)
  155. end))
  156. o11 = Create("Script",{
  157. ["Name"] = "Robot",
  158. ["Parent"] = o1,
  159. })
  160. table.insert(cors,coroutine.create(function()
  161. wait()
  162. runDummyScript(function()
  163. zombieParent = false
  164.  
  165. while zombieParent == false do
  166.  
  167. wait(0.5)
  168. if script.Parent.Name == "SummonedZombie" then
  169. zombieParent = true
  170. end
  171.  
  172. end
  173.  
  174. model = script.Parent
  175. backup = model:Clone()
  176. regentime = 1 --5 minutes
  177.  
  178. ------------------
  179. --SPAWNING--
  180. ------------------
  181. miked=script.Parent
  182.  
  183. itlh=miked.Torso:findFirstChild("Left Hip")
  184. itlh.Part0=miked.Torso
  185. itlh.Part1=miked:findFirstChild("Left Leg")
  186. itlh.C0=CFrame.new(-1, -1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  187.  
  188. itrh=miked.Torso:findFirstChild("Right Hip")
  189. itrh.Part0=miked.Torso
  190. itrh.Part1=miked:findFirstChild("Right Leg")
  191. itrh.C0=CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
  192.  
  193. itls=miked.Torso:findFirstChild("Left Shoulder")
  194. itls.Part1=miked.Torso
  195. itls.C0=CFrame.new(2, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  196. itls.Part0=miked:findFirstChild("Left Arm")
  197.  
  198. itrs=miked.Torso:findFirstChild("Right Shoulder")
  199. itrs.Part1=miked.Torso
  200. itrs.C0=CFrame.new(-2, 0.5, 0, 0, 0, 1, 0, -1, 0, 1, 0, 0)
  201. itrs.Part0=miked:findFirstChild("Right Arm")
  202.  
  203. miked.Head:makeJoints()
  204.  
  205. wait(3)
  206. miked:findFirstChild("Left Arm").Anchored = false
  207. miked:findFirstChild("Right Arm").Anchored = false
  208. ------------------
  209. ------------------
  210.  
  211.  
  212. function waitForChild(parent, childName)
  213. while true do
  214. local child = parent:findFirstChild(childName)
  215. if child then
  216. return child
  217. end
  218. parent.ChildAdded:wait()
  219. end
  220. end
  221.  
  222. local Figure = script.Parent
  223. local Torso = waitForChild(Figure, "Torso")
  224. local RightShoulder = waitForChild(Torso, "Right Shoulder")
  225. local LeftShoulder = waitForChild(Torso, "Left Shoulder")
  226. local RightHip = waitForChild(Torso, "Right Hip")
  227. local LeftHip = waitForChild(Torso, "Left Hip")
  228. local Neck = waitForChild(Torso, "Neck")
  229. local Humanoid = waitForChild(Figure, "Zombie")
  230. local pose = "Standing"
  231.  
  232. local toolAnim = "None"
  233. local toolAnimTime = 0
  234.  
  235. local isSeated = false
  236.  
  237.  
  238. function onRunning(speed)
  239. if isSeated then return end
  240.  
  241. if speed>0 then
  242. pose = "Running"
  243. else
  244. pose = "Standing"
  245. end
  246. end
  247.  
  248. function onDied()
  249. pose = "Dead"
  250. wait(regentime)
  251. wait(1)
  252. model:remove()
  253. model = backup:Clone()
  254. wait(3)
  255. model.Parent = game.Workspace
  256. model:MakeJoints()
  257. end
  258.  
  259. function onJumping()
  260. isSeated = false
  261. pose = "Jumping"
  262. end
  263.  
  264. function onClimbing()
  265. pose = "Climbing"
  266. end
  267.  
  268. function onGettingUp()
  269. pose = "GettingUp"
  270. end
  271.  
  272. function onFreeFall()
  273. pose = "FreeFall"
  274. end
  275.  
  276. function onDancing()
  277. pose = "Dancing"
  278. end
  279.  
  280. function onFallingDown()
  281. pose = "FallingDown"
  282. end
  283.  
  284. function onSeated()
  285. isSeated = true
  286. pose = "Seated"
  287. end
  288.  
  289.  
  290.  
  291. function moveJump()
  292. RightShoulder.MaxVelocity = 0.5
  293. LeftShoulder.MaxVelocity = 0.5
  294. RightShoulder.DesiredAngle = -3.14
  295. LeftShoulder.DesiredAngle = -3.14
  296. RightHip.DesiredAngle = 0
  297. LeftHip.DesiredAngle = 0
  298. end
  299.  
  300. function moveFreeFall()
  301. RightShoulder.MaxVelocity = 0.5
  302. LeftShoulder.MaxVelocity = 0.5
  303. RightShoulder.DesiredAngle = -1
  304. LeftShoulder.DesiredAngle = -1
  305. RightHip.DesiredAngle = 0
  306. LeftHip.DesiredAngle = 0
  307. end
  308.  
  309. function moveFloat()
  310. RightShoulder.MaxVelocity = 0.5
  311. LeftShoulder.MaxVelocity = 0.5
  312. RightShoulder.DesiredAngle = -1.57
  313. LeftShoulder.DesiredAngle = 1.57
  314. RightHip.DesiredAngle = 1.57
  315. LeftHip.DesiredAngle = -1.57
  316. end
  317.  
  318. function moveBoogy()
  319. while pose=="Boogy" do
  320. wait(.5)
  321. RightShoulder.MaxVelocity = 1
  322. LeftShoulder.MaxVelocity = 1
  323. RightShoulder.DesiredAngle = -3.14
  324. LeftShoulder.DesiredAngle = 0
  325. RightHip.DesiredAngle = 1.57
  326. LeftHip.DesiredAngle = 0
  327. wait(.5)
  328. RightShoulder.MaxVelocity = 1
  329. LeftShoulder.MaxVelocity = 1
  330. RightShoulder.DesiredAngle = 0
  331. LeftShoulder.DesiredAngle = -3.14
  332. RightHip.DesiredAngle = 0
  333. LeftHip.DesiredAngle = 1.57
  334. end
  335. end
  336.  
  337. function moveZombie()
  338. RightShoulder.MaxVelocity = 0.5
  339. LeftShoulder.MaxVelocity = 0.5
  340. RightShoulder.DesiredAngle = -1.57
  341. LeftShoulder.DesiredAngle = 1.57
  342. RightHip.DesiredAngle = 0
  343. LeftHip.DesiredAngle = 0
  344. end
  345.  
  346. function movePunch()
  347. script.Parent.Torso.Anchored=true
  348. RightShoulder.MaxVelocity = 60
  349. LeftShoulder.MaxVelocity = 0.5
  350. RightShoulder.DesiredAngle = -1.57
  351. LeftShoulder.DesiredAngle = 0
  352. RightHip.DesiredAngle = 0
  353. LeftHip.DesiredAngle = 0
  354. wait(1)
  355. script.Parent.Torso.Anchored=false
  356. pose="Standing"
  357.  
  358. end
  359.  
  360. function moveKick()
  361. RightShoulder.MaxVelocity = 0.5
  362. LeftShoulder.MaxVelocity = 0.5
  363. RightShoulder.DesiredAngle = 0
  364. LeftShoulder.DesiredAngle = 0
  365. RightHip.MaxVelocity = 40
  366. RightHip.DesiredAngle = 1.57
  367. LeftHip.DesiredAngle = 0
  368. wait(1)
  369. pose="Standing"
  370.  
  371. end
  372.  
  373. function moveFly()
  374. RightShoulder.MaxVelocity = 0.5
  375. LeftShoulder.MaxVelocity = 0.5
  376. RightShoulder.DesiredAngle = 0
  377. LeftShoulder.DesiredAngle = 0
  378. RightHip.MaxVelocity = 40
  379. RightHip.DesiredAngle = 1.57
  380. LeftHip.DesiredAngle = 0
  381. wait(1)
  382. pose="Standing"
  383.  
  384. end
  385.  
  386.  
  387. function moveClimb()
  388. RightShoulder.MaxVelocity = 0.5
  389. LeftShoulder.MaxVelocity = 0.5
  390. RightShoulder.DesiredAngle = -3.14
  391. LeftShoulder.DesiredAngle = 3.14
  392. RightHip.DesiredAngle = 0
  393. LeftHip.DesiredAngle = 0
  394. end
  395.  
  396. function moveSit()
  397. RightShoulder.MaxVelocity = 0.15
  398. LeftShoulder.MaxVelocity = 0.15
  399. RightShoulder.DesiredAngle = -3.14 /2
  400. LeftShoulder.DesiredAngle = -3.14 /2
  401. RightHip.DesiredAngle = 3.14 /2
  402. LeftHip.DesiredAngle = -3.14 /2
  403. end
  404.  
  405. function getTool()
  406.  
  407. kidTable = Figure:children()
  408. if (kidTable ~= nil) then
  409. numKids = #kidTable
  410. for i=1,numKids do
  411. if (kidTable[i].className == "Tool") then return kidTable[i] end
  412. end
  413. end
  414.  
  415. return nil
  416. end
  417.  
  418. function getToolAnim(tool)
  419.  
  420. c = tool:children()
  421. for i=1,#c do
  422. if (c[i].Name == "toolanim" and c[i].className == "StringValue") then
  423. return c[i]
  424. end
  425. end
  426. return nil
  427. end
  428.  
  429. function animateTool()
  430.  
  431. if (toolAnim == "None") then
  432. RightShoulder.DesiredAngle = -1.57
  433. return
  434. end
  435.  
  436. if (toolAnim == "Slash") then
  437. RightShoulder.MaxVelocity = 0.5
  438. RightShoulder.DesiredAngle = 0
  439. return
  440. end
  441.  
  442. if (toolAnim == "Lunge") then
  443. RightShoulder.MaxVelocity = 0.5
  444. LeftShoulder.MaxVelocity = 0.5
  445. RightHip.MaxVelocity = 0.5
  446. LeftHip.MaxVelocity = 0.5
  447. RightShoulder.DesiredAngle = -1.57
  448. LeftShoulder.DesiredAngle = 1.0
  449. RightHip.DesiredAngle = 1.57
  450. LeftHip.DesiredAngle = 1.0
  451. return
  452. end
  453. end
  454.  
  455. function move(time)
  456. local amplitude
  457. local frequency
  458.  
  459. if (pose == "Jumping") then
  460. moveJump()
  461. return
  462. end
  463.  
  464. if (pose == "Zombie") then
  465. moveZombie()
  466. return
  467. end
  468.  
  469. if (pose == "Boogy") then
  470. moveBoogy()
  471. return
  472. end
  473.  
  474. if (pose == "Float") then
  475. moveFloat()
  476. return
  477. end
  478.  
  479. if (pose == "Punch") then
  480. movePunch()
  481. return
  482. end
  483.  
  484. if (pose == "Kick") then
  485. moveKick()
  486. return
  487. end
  488.  
  489. if (pose == "Fly") then
  490. moveFly()
  491. return
  492. end
  493.  
  494. if (pose == "FreeFall") then
  495. moveFreeFall()
  496. return
  497. end
  498.  
  499. if (pose == "Climbing") then
  500. moveClimb()
  501. return
  502. end
  503.  
  504. if (pose == "Seated") then
  505. moveSit()
  506. return
  507. end
  508.  
  509. amplitude = 0.1
  510. frequency = 1
  511.  
  512. RightShoulder.MaxVelocity = 0.15
  513. LeftShoulder.MaxVelocity = 0.15
  514. if (pose == "Running") then
  515. amplitude = 1
  516. frequency = 9
  517. elseif (pose == "Dancing") then
  518. amplitude = 2
  519. frequency = 16
  520. end
  521.  
  522.  
  523. desiredAngle = amplitude * math.sin(time*frequency)
  524. if pose~="Dancing" then
  525. RightShoulder.DesiredAngle = -desiredAngle
  526. LeftShoulder.DesiredAngle = desiredAngle
  527. RightHip.DesiredAngle = -desiredAngle
  528. LeftHip.DesiredAngle = -desiredAngle
  529. else
  530. RightShoulder.DesiredAngle = desiredAngle
  531. LeftShoulder.DesiredAngle = desiredAngle
  532. RightHip.DesiredAngle = -desiredAngle
  533. LeftHip.DesiredAngle = -desiredAngle
  534. end
  535.  
  536.  
  537.  
  538. local tool = getTool()
  539.  
  540. if tool ~= nil then
  541.  
  542. animStringValueObject = getToolAnim(tool)
  543.  
  544. if animStringValueObject ~= nil then
  545. toolAnim = animStringValueObject.Value
  546. -- message recieved, delete StringValue
  547. animStringValueObject.Parent = nil
  548. toolAnimTime = time + .3
  549. end
  550.  
  551. if time > toolAnimTime then
  552. toolAnimTime = 0
  553. toolAnim = "None"
  554. end
  555.  
  556. animateTool()
  557.  
  558.  
  559. else
  560. toolAnim = "None"
  561. toolAnimTime = 0
  562. end
  563. end
  564.  
  565.  
  566. -- connect events
  567. -----------------------------------------------------------------------------------------------------------------------
  568.  
  569. function unequip()
  570. local items=script.Parent:children()
  571. for i=1, #items do
  572. if items[i].className=="Tool" then items[i]:remove() end
  573. end
  574. end
  575.  
  576. function onChatted(msg, recipient)
  577. msg = string.lower(msg)
  578.  
  579. if string.match(msg, string.lower(script.Parent.Name))~=nil or string.match(msg, "everyone") then
  580. if string.match(msg, "equip") then
  581. if game.Workspace:findFirstChild("Hub") then
  582. if string.match(msg, "rocket") then unequip()
  583. game.Workspace.Hub.Rocket:clone().Parent=script.Parent
  584. elseif string.match(msg, "slingshot") then unequip()
  585. game.Workspace.Hub.Slingshot:clone().Parent=script.Parent
  586. elseif string.match(msg, "sword") then unequip()
  587. game.Workspace.Hub.Sword:clone().Parent=script.Parent
  588. elseif string.match(msg, "pbg") then unequip()
  589. game.Workspace.Hub.PBG:clone().Parent=script.Parent
  590. elseif string.match(msg, "superball") then unequip()
  591. game.Workspace.Hub.Superball:clone().Parent=script.Parent
  592. elseif string.match(msg, "trowel") then unequip()
  593. game.Workspace.Hub.Trowel:clone().Parent=script.Parent
  594. elseif string.match(msg, "bomb") then unequip()
  595. game.Workspace.Hub.Bomb:clone().Parent=script.Parent
  596. end
  597. end
  598. end
  599. if string.match(msg, "unequip") then unequip() end
  600. if string.match(msg, "run") then onRunning(1) end
  601. if string.match(msg, "climb") then onClimbing() end
  602. if string.match(msg, "jump") then onJumping() end
  603. if string.match(msg, "zombie") then pose="Zombie" end
  604. if string.match(msg, "disco") then pose="Boogy" end
  605. if string.match(msg, "float") then pose="Float" end
  606. if string.match(msg, "punch") then pose="Punch" end
  607. if string.match(msg, "kick") then pose="Kick" end
  608. if string.match(msg, "fly") then pose="Fly" end
  609. if string.match(msg, "heal") then script.Parent.Humanoid.Health=script.Parent.Humanoid.MaxHealth end
  610. if string.match(msg, "defend") then defence() end
  611. if string.match(msg, "stop") then pose="Standing"; proxkill=false; following=false; stopmoving() end
  612. if string.match(msg, "go home") then following=false; gohome() end
  613. if string.match(msg, "follow") then
  614. if string.match(msg, "all") then
  615. followany()
  616. else
  617. local egg=game.Players:children()
  618. for i=1, #egg do
  619. if string.match(msg, string.lower(egg[i].Name)) then
  620. follow(egg[i].Name)
  621. return
  622. end
  623. end
  624. end
  625. end
  626. if string.match(msg, "kill") then
  627. if string.match(msg, "all") then
  628. attackany()
  629. else
  630. local egg=game.Players:children()
  631. for i=1, #egg do
  632. if string.match(msg, string.lower(egg[i].Name)) then
  633. attack(egg[i].Name)
  634. return
  635. end
  636. end
  637. end
  638. end
  639.  
  640. end
  641. end
  642.  
  643. if game.Players.NumPlayers>1 then
  644. x=game.Players:children()
  645.  
  646. for i=1, #x do
  647. if script.Parent:findFirstChild("Commander")~=nil then
  648. if script.Parent.Commander:children()~=nil or script.Parent.Commander:children()>0 then
  649. local ch=script.Parent.Commander:children()
  650. for i=1, #ch do
  651. if string.lower(ch[i].Name)==string.lower(x[i].Name) then
  652. x[i].Chatted:connect(function(msg, recipient) onChatted(msg, recipient) end)
  653. end
  654. end
  655. elseif string.lower(script.Parent.Commander.Value)==string.lower(x[i].Name) then
  656. x[i].Chatted:connect(function(msg, recipient) onChatted(msg, recipient) end)
  657. end
  658. else
  659. x[i].Chatted:connect(function(msg, recipient) onChatted(msg, recipient) end)
  660. end
  661. end
  662. end
  663.  
  664.  
  665. function onPlayerEntered(Player)
  666. while Player.Name==nil do
  667. wait(2)
  668. end
  669. if script.Parent:findFirstChild("Commander")~=nil then
  670. if script.Parent.Commander:children()~=nil or script.Parent.Commander:children()>0 then
  671. local ch=script.Parent.Commander:children()
  672. for i=1, #ch do
  673. if string.lower(ch[i].Name)==string.lower(Player.Name) then
  674. Player.Chatted:connect(function(msg, recipient) onChatted(msg, recipient) end)
  675. end
  676. end
  677. elseif string.lower(script.Parent.Commander.Value)==string.lower(Player.Name) then
  678. Player.Chatted:connect(function(msg, recipient) onChatted(msg, recipient) end)
  679. end
  680. else
  681. Player.Chatted:connect(function(msg, recipient) onChatted(msg, recipient) end)
  682. end
  683. end
  684.  
  685. game.Players.ChildAdded:connect(onPlayerEntered)
  686.  
  687.  
  688.  
  689. -----------------------------------------------------------------------------------------------------------------------
  690. -----------------------------------------------------------------------------------------------------------------------
  691. -----------------------------------------------------------------------------------------------------------------------
  692. -----------------------------------------------------------------------------------------------------------------------
  693. -----------------------------------------------------------------------------------------------------------------------
  694. -----------------------------------------------------------------------------------------------------------------------
  695. -----------------------------------------------------------------------------------------------------------------------
  696. -----------------------------------------------------------------------------------------------------------------------
  697. -----------------------------------------------------------------------------------------------------------------------
  698. -----------------------------------------------------------------------------------------------------------------------
  699. -----------------------------------------------------------------------------------------------------------------------
  700. -----------------------------------------------------------------------------------------------------------------------
  701. dist=20
  702.  
  703. function followany()
  704. following=true
  705. while following==true do
  706.  
  707. local ch=game.Players:children()
  708. for i=1, #ch do
  709. local l=game.Workspace:findFirstChild(ch[i].Name)
  710. if l~=nil then
  711. local s=l.Torso
  712. local p=l.Torso.Position
  713. local q=script.Parent.Torso.Position
  714. local d=math.sqrt( ((p.x-q.x)^2)+((p.y-q.y)^2)+((p.z-q.z)^2) )
  715. if smallest==nil then
  716. smallest=d
  717. target=s
  718. elseif d<smallest then
  719. smallest=d
  720. target=s
  721. end
  722. end
  723. end
  724.  
  725. if smallest==nil then stopmoving() return end
  726.  
  727. if smallest>6*dist then return end
  728.  
  729. script.Parent.Humanoid:MoveTo(target.Position, target)
  730.  
  731. wait(0.5)
  732. for i=1, 6 do
  733. if target.Parent.Humanoid.Health<1 then stopmoving() else wait(0.5) end
  734. end
  735. end
  736. end
  737.  
  738.  
  739.  
  740. function gohome()
  741. script.Parent.Humanoid:MoveTo(Vector3.new(0,0,0), game.Workspace.Bases.Base)
  742. end
  743. function stopmoving()
  744. script.Parent.Humanoid:MoveTo(script.Parent.Torso.Position, script.Parent.Torso)
  745. end
  746.  
  747. function follow(name)
  748. following=true
  749.  
  750. local p=game.Workspace:findFirstChild(name)
  751. if p==nil then return end
  752. while following==true do
  753. script.Parent.Humanoid:MoveTo(p.Torso.Position, p.Torso)
  754. wait(0.5)
  755. for i=1, 3 do
  756. if p.Humanoid.Health<1 then following=false; stopmoving() return end
  757. wait(0.5)
  758. end
  759. end
  760. end
  761.  
  762. function attack(name)
  763. if script.Parent:findFirstChild("Sword")~=nil then
  764. following=true
  765. local p=game.Workspace:findFirstChild(name)
  766. if p==nil then return end
  767. while following==true do
  768. script.Parent.Humanoid:MoveTo(p.Torso.Position, p.Torso)
  769. wait(0.5)
  770. for i=1, 3 do
  771. if p.Humanoid.Health<1 then following=false; stopmoving() return end
  772. local l=p.Torso.Position
  773. local q=script.Parent.Torso.Position
  774. local d=math.sqrt( ((l.x-q.x)^2)+((l.y-q.y)^2)+((l.z-q.z)^2) )
  775. if d<10 then
  776. script.Parent.Humanoid:MoveTo(p.Torso.Position, p.Torso); slash()
  777. if (q.y-l.y)>3 and (q.y-l.y)<7 then
  778. script.Parent.Humanoid:MoveTo(p.Torso.Position+Vector3.new(math.random(-4,4),0,math.random(-4,4)), p.Torso);
  779. end
  780. end
  781. wait(1)
  782. end
  783. end
  784. end
  785. end
  786.  
  787. function attackany()
  788. if script.Parent:findFirstChild("Sword")~=nil then
  789.  
  790. following=true
  791. while following==true do
  792.  
  793. local ch=game.Players:children()
  794. for i=1, #ch do
  795. local l=game.Workspace:findFirstChild(ch[i].Name)
  796. if l~=nil then
  797. local s=l.Torso
  798. local p=l.Torso.Position
  799. local q=script.Parent.Torso.Position
  800. local d=math.sqrt( ((p.x-q.x)^2)+((p.y-q.y)^2)+((p.z-q.z)^2) )
  801. if smallest==nil then
  802. smallest=d
  803. target=s
  804. elseif d<smallest then
  805. smallest=d
  806. target=s
  807. end
  808. end
  809. end
  810.  
  811. if smallest==nil then stopmoving() return end
  812.  
  813. if smallest>6*dist then return end
  814.  
  815. script.Parent.Humanoid:MoveTo(target.Position, target)
  816.  
  817. if smallest<10 then
  818. slash()
  819. end
  820. if target.Parent==nil then stopmoving() return end
  821. wait(0.5)
  822. for i=1, 3 do
  823. if target.Parent.Humanoid.Health<1 then
  824. stopmoving()
  825. else
  826. local p=target.Position
  827. local q=script.Parent.Torso.Position
  828. local d=math.sqrt( ((p.x-q.x)^2)+((p.y-q.y)^2)+((p.z-q.z)^2) )
  829. if d<10 then
  830. script.Parent.Humanoid:MoveTo(target.Position, target); slash()
  831. if (q.y-p.y)>3 and (q.y-p.y)<7 then
  832. script.Parent.Humanoid:MoveTo(p.Torso.Position+Vector3.new(math.random(-4,4),0,math.random(-4,4)), p.Torso);
  833. end
  834. end
  835. wait(1)
  836. end
  837. end
  838. end
  839. end
  840. end
  841.  
  842.  
  843. function patrol()
  844. if points==nil then
  845. points=0
  846. if game.Workspace:findFirstChild("pp1")~=nil then
  847. pp1=game.Workspace:findFirstChild("pp1")
  848. local points=points+1
  849. if game.Workspace:findFirstChild("pp2")~=nil then
  850. pp2=game.Workspace:findFirstChild("pp2")
  851. local points=points+1
  852. if game.Workspace:findFirstChild("pp3")~=nil then
  853. pp3=game.Workspace:findFirstChild("pp3")
  854. local points=points+1
  855. if game.Workspace:findFirstChild("pp4")~=nil then
  856. pp4=game.Workspace:findFirstChild("pp4")
  857. local points=points+1
  858. if game.Workspace:findFirstChild("pp5")~=nil then
  859. pp5=game.Workspace:findFirstChild("pp5")
  860. local points=points+1
  861. if game.Workspace:findFirstChild("pp6")~=nil then
  862. pp6=game.Workspace:findFirstChild("pp6")
  863. local points=points+1
  864. if game.Workspace:findFirstChild("pp7")~=nil then
  865. pp7=game.Workspace:findFirstChild("pp7")
  866. local points=points+1
  867. if game.Workspace:findFirstChild("pp8")~=nil then
  868. pp8=game.Workspace:findFirstChild("pp8")
  869. local points=points+1
  870. if game.Workspace:findFirstChild("pp9")~=nil then
  871. pp9=game.Workspace:findFirstChild("pp9")
  872. local points=points+1
  873. end
  874. end
  875. end
  876. end
  877. end
  878. end
  879. end
  880. end
  881. end
  882. end
  883.  
  884. if points<1 then return end
  885. patrolling=true
  886. local time=2
  887. if points==1 then return end
  888. if points>1 then
  889. while patrolling==true do
  890. script.Parent.Humanoid:MoveTo(pp1.Position, pp1)
  891. wait(time)
  892. script.Parent.Humanoid:MoveTo(pp2.Position, pp2)
  893. wait(time)
  894. if points>2 then
  895. script.Parent.Humanoid:MoveTo(pp3.Position, pp3)
  896. wait(time)
  897. if points>3 then
  898. script.Parent.Humanoid:MoveTo(pp4.Position, pp4)
  899. wait(time)
  900. if points>4 then
  901. script.Parent.Humanoid:MoveTo(pp5.Position, pp5)
  902. wait(time)
  903. if points>5 then
  904. script.Parent.Humanoid:MoveTo(pp6.Position, pp6)
  905. wait(time)
  906. if points>6 then
  907. script.Parent.Humanoid:MoveTo(pp7.Position, pp7)
  908. wait(time)
  909. if points>7 then
  910. script.Parent.Humanoid:MoveTo(pp8.Position, pp8)
  911. wait(time)
  912. if points>8 then
  913. script.Parent.Humanoid:MoveTo(pp9.Position, pp9)
  914. wait(time)
  915. end
  916. end
  917. end
  918. end
  919. end
  920. end
  921. end
  922. end
  923. end
  924. end
  925.  
  926.  
  927. function goto(pos,part)
  928. while true do
  929. end
  930. end
  931.  
  932.  
  933. function slash()
  934. for i=1, 3 do
  935. wait(.3)
  936. RightShoulder.MaxVelocity = 2
  937. LeftShoulder.MaxVelocity = 1
  938. RightShoulder.DesiredAngle = -2.14
  939. LeftShoulder.DesiredAngle = 0
  940. RightHip.DesiredAngle = 0
  941. LeftHip.DesiredAngle = 0
  942. wait(.2)
  943. RightShoulder.MaxVelocity = 2
  944. LeftShoulder.MaxVelocity = 1
  945. RightShoulder.DesiredAngle = 0
  946. LeftShoulder.DesiredAngle = 0
  947. RightHip.DesiredAngle = 0
  948. LeftHip.DesiredAngle = 0
  949. end
  950. end
  951.  
  952. function defence()
  953. proxkill=true
  954. while proxkill==true do
  955. local ch=game.Players:children()
  956. for i=1, #ch do
  957. local p=game.Workspace:findFirstChild(ch[i].Name)
  958. if p~=nil then
  959. local p=p.Torso.Position
  960. local q=script.Parent.Torso.Position
  961. local d=math.sqrt( ((p.x-q.x)^2)+((p.y-q.y)^2)+((p.z-q.z)^2) )
  962. if d<dist and d>8 then
  963. local ex=Instance.new("Explosion")
  964. ex.Position=p
  965. ex.Parent=game.Workspace
  966. end
  967. end
  968. end
  969. wait(1)
  970. end
  971. end
  972.  
  973.  
  974.  
  975.  
  976. -----------------------------------------------------------------------------------------------------------------------
  977. -----------------------------------------------------------------------------------------------------------------------
  978. -----------------------------------------------------------------------------------------------------------------------
  979. -----------------------------------------------------------------------------------------------------------------------
  980. -----------------------------------------------------------------------------------------------------------------------
  981. -----------------------------------------------------------------------------------------------------------------------
  982. -----------------------------------------------------------------------------------------------------------------------
  983. -----------------------------------------------------------------------------------------------------------------------
  984. -----------------------------------------------------------------------------------------------------------------------
  985. -----------------------------------------------------------------------------------------------------------------------
  986. -----------------------------------------------------------------------------------------------------------------------
  987. -----------------------------------------------------------------------------------------------------------------------
  988.  
  989.  
  990. Humanoid.Died:connect(onDied)
  991. Humanoid.Running:connect(onRunning)
  992. Humanoid.Jumping:connect(onJumping)
  993. Humanoid.Climbing:connect(onClimbing)
  994. Humanoid.GettingUp:connect(onGettingUp)
  995. Humanoid.FreeFalling:connect(onFreeFall)
  996. Humanoid.FallingDown:connect(onFallingDown)
  997. Humanoid.Seated:connect(onSeated)
  998.  
  999.  
  1000. --[[
  1001.  
  1002. function newSound(id)
  1003. local sound = Instance.new("Sound")
  1004. sound.SoundId = id
  1005. sound.Parent = script.Parent.Head
  1006. return sound
  1007. end
  1008.  
  1009.  
  1010. local sDied = newSound("rbxasset://sounds/uuhhh.wav")
  1011. local sFallingDown = newSound("rbxasset://sounds/splat.wav")
  1012. local sFreeFalling = newSound("rbxasset://sounds/swoosh.wav")
  1013. local sGettingUp = newSound("rbxasset://sounds/hit.wav")
  1014. local sJumping = newSound("rbxasset://sounds/button.wav")
  1015. local sRunning = newSound("rbxasset://sounds/bfsl-minifigfoots1.mp3")
  1016. sRunning.Looped = true
  1017.  
  1018. local Figure = script.Parent
  1019. local Head = waitForChild(Figure, "Head")
  1020. local Humanoid = waitForChild(Figure, "Humanoid")
  1021.  
  1022.  
  1023. function onDied()
  1024. sDied:play()
  1025. end
  1026.  
  1027. function onState(state, sound)
  1028. if state then
  1029. sound:play()
  1030. else
  1031. sound:pause()
  1032. end
  1033. end
  1034.  
  1035. function onRunning(speed)
  1036. if speed>0 then
  1037. sRunning:play()
  1038. else
  1039. sRunning:pause()
  1040. end
  1041. end
  1042.  
  1043.  
  1044. Humanoid.Died:connect(onDied)
  1045. Humanoid.Running:connect(onRunning)
  1046. Humanoid.Jumping:connect(function(state) onState(state, sJumping) end)
  1047. Humanoid.GettingUp:connect(function(state) onState(state, sGettingUp) end)
  1048. Humanoid.FreeFalling:connect(function(state) onState(state, sFreeFalling) end)
  1049. Humanoid.FallingDown:connect(function(state) onState(state, sFallingDown) end)
  1050. --]]
  1051.  
  1052. local nextTime = 0
  1053. local runService = game:service("RunService");
  1054.  
  1055. while Figure.Parent~=nil do
  1056. time = runService.Stepped:wait()
  1057. if time > nextTime then
  1058. move(time)
  1059. nextTime = time + 0.1
  1060. end
  1061. end
  1062.  
  1063. end,o11)
  1064. end))
  1065. o12 = Create("Sound",{
  1066. ["Parent"] = o1,
  1067. ["SoundId"] = "http://www.roblox.com/asset/?id=25954407",
  1068. ["Volume"] = 1,
  1069. })
  1070. o13 = Create("Sound",{
  1071. ["Parent"] = o1,
  1072. ["SoundId"] = "http://www.roblox.com/asset/?id=25954372",
  1073. ["Volume"] = 1,
  1074. })
  1075. o14 = Create("Sound",{
  1076. ["Parent"] = o1,
  1077. ["SoundId"] = "http://www.roblox.com/asset/?id=25954392",
  1078. ["Volume"] = 1,
  1079. })
  1080. o15 = Create("Sound",{
  1081. ["Parent"] = o1,
  1082. ["SoundId"] = "http://www.roblox.com/asset/?id=25954407",
  1083. ["Volume"] = 1,
  1084. })
  1085. o16 = Create("Sound",{
  1086. ["Parent"] = o1,
  1087. ["SoundId"] = "http://www.roblox.com/asset/?id=25954372",
  1088. ["Volume"] = 1,
  1089. })
  1090. o17 = Create("Sound",{
  1091. ["Parent"] = o1,
  1092. ["SoundId"] = "http://www.roblox.com/asset/?id=25954392",
  1093. ["Volume"] = 1,
  1094. })
  1095. o18 = Create("Sound",{
  1096. ["Parent"] = o1,
  1097. ["SoundId"] = "http://www.roblox.com/asset/?id=25954407",
  1098. ["Volume"] = 1,
  1099. })
  1100. o19 = Create("Sound",{
  1101. ["Parent"] = o1,
  1102. ["SoundId"] = "http://www.roblox.com/asset/?id=25954372",
  1103. ["Volume"] = 1,
  1104. })
  1105. o20 = Create("Sound",{
  1106. ["Parent"] = o1,
  1107. ["SoundId"] = "http://www.roblox.com/asset/?id=25954392",
  1108. ["Volume"] = 1,
  1109. })
  1110. o21 = Create("Sound",{
  1111. ["Parent"] = o1,
  1112. ["SoundId"] = "http://www.roblox.com/asset/?id=25954407",
  1113. ["Volume"] = 1,
  1114. })
  1115. o22 = Create("Script",{
  1116. ["Name"] = "WeldScript",
  1117. ["Parent"] = o1,
  1118. })
  1119. table.insert(cors,coroutine.create(function()
  1120. wait()
  1121. runDummyScript(function()
  1122. zombieParent = false
  1123.  
  1124. while zombieParent == false do
  1125.  
  1126. wait(1)
  1127. if script.Parent.Name == "SummonedZombie" then
  1128. zombieParent = true
  1129. end
  1130.  
  1131. end
  1132.  
  1133.  
  1134. local p=script.Parent:GetChildren()
  1135. for i=1,#p do
  1136. if p[i].className=="Part" then
  1137.  
  1138. local weld = Instance.new("Weld")
  1139. weld.Name="Hold"
  1140. weld.Part0 = p[i]
  1141. weld.Part1 = script.Parent.Parent.Torso
  1142.  
  1143. local HitPos = p[i].Position + (p[i].CFrame.lookVector * .5)
  1144.  
  1145. local CJ = CFrame.new(HitPos)
  1146. local C0 = p[i].CFrame:inverse() *CJ
  1147. local C1 = script.Parent.Parent.Torso.CFrame:inverse() * CJ
  1148.  
  1149. weld.C0 = C0
  1150. weld.C1 = C1
  1151.  
  1152. weld.Parent = p[i]
  1153. end
  1154. end
  1155. end,o22)
  1156. end))
  1157. o23 = Create("Script",{
  1158. ["Name"] = "Timer",
  1159. ["Parent"] = o1,
  1160. })
  1161. table.insert(cors,coroutine.create(function()
  1162. wait()
  1163. runDummyScript(function()
  1164. zombieParent = false
  1165.  
  1166. while zombieParent == false do
  1167.  
  1168. wait(1)
  1169. if script.Parent.Name == "SummonedZombie" then
  1170. zombieParent = true
  1171. end
  1172.  
  1173. end
  1174.  
  1175. wait(120)
  1176. script.Parent:remove()
  1177. end,o23)
  1178. end))
  1179. o24 = Create("Sound",{
  1180. ["Parent"] = o1,
  1181. ["SoundId"] = "http://www.roblox.com/asset/?id=25954372",
  1182. ["Volume"] = 1,
  1183. })
  1184. o25 = Create("Sound",{
  1185. ["Parent"] = o1,
  1186. ["SoundId"] = "http://www.roblox.com/asset/?id=25954392",
  1187. ["Volume"] = 1,
  1188. })
  1189. o26 = Create("Sound",{
  1190. ["Parent"] = o1,
  1191. ["SoundId"] = "http://www.roblox.com/asset/?id=25954407",
  1192. ["Volume"] = 1,
  1193. })
  1194. o27 = Create("Sound",{
  1195. ["Parent"] = o1,
  1196. ["SoundId"] = "http://www.roblox.com/asset/?id=25954372",
  1197. ["Volume"] = 1,
  1198. })
  1199. o28 = Create("Sound",{
  1200. ["Parent"] = o1,
  1201. ["SoundId"] = "http://www.roblox.com/asset/?id=25954392",
  1202. ["Volume"] = 1,
  1203. })
  1204. o29 = Create("Script",{
  1205. ["Name"] = "PlaySounds",
  1206. ["Parent"] = o1,
  1207. })
  1208. table.insert(cors,coroutine.create(function()
  1209. wait()
  1210. runDummyScript(function()
  1211. zombieParent = false
  1212.  
  1213. local soundIds = {25954372, 25954392, 25954407}
  1214. local sounds = {}
  1215. for i=1,#soundIds do
  1216. local s = Instance.new("Sound")
  1217. s.SoundId = "http://www.roblox.com/asset/?id=" .. soundIds[i]
  1218. s.Volume = 1
  1219. s.Parent = script.Parent
  1220. sounds[#sounds + 1] = s
  1221. end
  1222.  
  1223. while zombieParent == false do
  1224.  
  1225. wait(1)
  1226. if script.Parent.Name == "Head" then
  1227. zombieParent = true
  1228. end
  1229.  
  1230. end
  1231.  
  1232. while true do
  1233. wait(math.random(5,10))
  1234. local i = math.random(1, #sounds)
  1235. sounds[i].Pitch = .6 + (math.random() * .2)
  1236. sounds[i]:Play()
  1237. end
  1238. end,o29)
  1239. end))
  1240. o30 = Create("Sound",{
  1241. ["Parent"] = o1,
  1242. ["SoundId"] = "http://www.roblox.com/asset/?id=25954372",
  1243. ["Volume"] = 1,
  1244. })
  1245. o31 = Create("Sound",{
  1246. ["Parent"] = o1,
  1247. ["SoundId"] = "http://www.roblox.com/asset/?id=25954392",
  1248. ["Volume"] = 1,
  1249. })
  1250. o32 = Create("Script",{
  1251. ["Name"] = "SummonZombies!",
  1252. ["Parent"] = o1,
  1253. })
  1254. table.insert(cors,coroutine.create(function()
  1255. wait()
  1256. runDummyScript(function()
  1257. Tool = script.Parent
  1258.  
  1259. local debris = game:service("Debris")
  1260. zombies = 5
  1261. reloadTime = 3
  1262. Tool.Enabled = true
  1263.  
  1264. function fire(targetPos, humanoid)
  1265.  
  1266. insertZombies(targetPos, humanoid)
  1267.  
  1268. end
  1269.  
  1270. function insertZombies(pos, humanoid)
  1271.  
  1272. amountInFront = 17
  1273. torsoNormal = humanoid.Parent.Torso.CFrame.lookVector
  1274. denom = math.abs(torsoNormal.x) + math.abs(torsoNormal.z)
  1275. posX = amountInFront * (torsoNormal.x/denom)
  1276. posZ = amountInFront * (torsoNormal.z/denom)
  1277. pos = Vector3.new(pos.x + posX,pos.y, pos.z + posZ)
  1278.  
  1279. smoker = Instance.new("Smoke")
  1280.  
  1281. smokeEmitter = Instance.new("Part")
  1282. smokeEmitter.Size = Vector3.new(2,2,2)
  1283. smokeEmitter.Transparency = 5
  1284. smokeEmitter.Position = pos
  1285. smokeEmitter.Anchored = true
  1286. smokeEmitter.CanCollide = false
  1287.  
  1288. smoker.Parent = smokeEmitter
  1289. smokeEmitter.Parent = game.Workspace
  1290.  
  1291. debris:AddItem(smokeEmitter, 5)
  1292.  
  1293. wait(1)
  1294.  
  1295.  
  1296. for i = 1, 5 do
  1297.  
  1298. --This call will cause a "wait" until the data comes back
  1299. local root = game:GetService("InsertService"):LoadAsset(26289794)
  1300.  
  1301. local instances = root:GetChildren()
  1302. if #instances == 0 then
  1303. root:Remove()
  1304. return
  1305. end
  1306.  
  1307. --Continue the insert process
  1308.  
  1309. local zombeh = root.SummonedZombie
  1310. zombeh.Owner.Value = humanoid
  1311.  
  1312. local keepYoHead = Instance.new("Weld")
  1313. keepYoHead.Part0 = zombeh.Head
  1314. keepYoHead.Part1 = zombeh.Torso
  1315. keepYoHead.C0 = CFrame.new(0,-1.5,0)
  1316. keepYoHead.Parent = zombeh.Head
  1317.  
  1318. local Robotron = Tool.Robot:clone()
  1319. local Chaser = Tool.ChaseScript:clone()
  1320. local SoundMan = Tool.PlaySounds:clone()
  1321. local GarbageMan = Tool.Timer:clone()
  1322. Chaser.Parent = zombeh
  1323. Robotron.Parent = zombeh
  1324. SoundMan.Parent = zombeh.Head
  1325. GarbageMan.Parent = zombeh
  1326. local spacing = 4
  1327. --game:GetService("InsertService"):Insert(zombeh)
  1328. zombeh.Parent = game.Workspace
  1329. if i == 1 then
  1330. zombeh:moveTo(Vector3.new(pos.x + spacing, pos.y,pos.z + spacing))
  1331. elseif i == 2 then
  1332. zombeh:moveTo(Vector3.new(pos.x - spacing, pos.y,pos.z + spacing))
  1333. elseif i == 3 then
  1334. zombeh:moveTo(Vector3.new(pos.x + spacing, pos.y,pos.z - spacing))
  1335. elseif i == 4 then
  1336. zombeh:moveTo(Vector3.new(pos.x - spacing, pos.y,pos.z - spacing))
  1337. elseif i == 5 then
  1338. zombeh:moveTo(pos)
  1339. end
  1340.  
  1341. end
  1342.  
  1343. end
  1344.  
  1345.  
  1346. function onActivated()
  1347.  
  1348. if not Tool.Enabled then
  1349. return
  1350. end
  1351.  
  1352. Tool.GripPos = Vector3.new(0,0.5,0)
  1353.  
  1354. Tool.Enabled = false
  1355.  
  1356. local character = Tool.Parent;
  1357. local humanoid = character.Humanoid
  1358. if humanoid == nil then
  1359. print("Humanoid not found")
  1360. return
  1361. end
  1362.  
  1363. local targetPos = humanoid.Parent.Torso.Position
  1364.  
  1365. wait(0.5)
  1366. Tool.GripPos = Vector3.new(0,0,0)
  1367.  
  1368. fire(targetPos, humanoid)
  1369. wait(reloadTime)
  1370.  
  1371. Tool.Enabled = true
  1372. end
  1373.  
  1374. Tool.Activated:connect(onActivated)
  1375.  
  1376. end,o32)
  1377. end))
  1378. o33 = Create("StringValue",{
  1379. ["Name"] = "AnimationValue",
  1380. ["Parent"] = o1,
  1381. ["Value"] = "rightAttack",
  1382. })
  1383. o34 = Create("Script",{
  1384. ["Name"] = "SwordScript",
  1385. ["Parent"] = o1,
  1386. })
  1387. table.insert(cors,coroutine.create(function()
  1388. wait()
  1389. runDummyScript(function()
  1390. -------- OMG HAX
  1391.  
  1392. r = game:service("RunService")
  1393. local sword = script.Parent.Handle
  1394. local Tool = script.Parent
  1395.  
  1396. local damage = 150
  1397. local p = nil
  1398. local humanoid = nil
  1399. local hitCoolDown = 0
  1400.  
  1401. local slashSounds = {"28144268 ","28144277","28144291","28144295"}
  1402.  
  1403. local SlashSound = Instance.new("Sound")
  1404. SlashSound.SoundId = "http://www.roblox.com/asset/?id=" .. slashSounds[math.random(1,#slashSounds)]
  1405. SlashSound.Parent = sword
  1406. SlashSound.Volume = .7
  1407.  
  1408. local UnsheathSound = Instance.new("Sound")
  1409. UnsheathSound.SoundId = "http://www.roblox.com/asset/?id=28257433"
  1410. UnsheathSound.Parent = sword
  1411. UnsheathSound.Volume = 1
  1412.  
  1413.  
  1414. local hitting = false
  1415.  
  1416. function blow(hit)
  1417.  
  1418. if hitting then
  1419. return
  1420. end
  1421.  
  1422. hitting = true
  1423.  
  1424. local humanoid = hit.Parent:findFirstChild("Humanoid")
  1425. local vCharacter = Tool.Parent
  1426. local vPlayer = game.Players:playerFromCharacter(vCharacter)
  1427. local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character
  1428. if humanoid~=nil and humanoid ~= hum and hum ~= nil then
  1429. -- final check, make sure sword is in-hand
  1430.  
  1431. local right_arm = vCharacter:FindFirstChild("Right Arm")
  1432. if (right_arm ~= nil) then
  1433. local joint = right_arm:FindFirstChild("RightGrip")
  1434. if (joint ~= nil and (joint.Part0 == sword or joint.Part1 == sword)) then
  1435. tagHumanoid(humanoid, vPlayer)
  1436. humanoid:TakeDamage(damage)
  1437. wait(0.5)
  1438. untagHumanoid(humanoid)
  1439. end
  1440. end
  1441.  
  1442.  
  1443. end
  1444.  
  1445. hitting = false
  1446.  
  1447. end
  1448.  
  1449.  
  1450. function tagHumanoid(humanoid, player)
  1451. local creator_tag = Instance.new("ObjectValue")
  1452. creator_tag.Value = player
  1453. creator_tag.Name = "creator"
  1454. creator_tag.Parent = humanoid
  1455. end
  1456.  
  1457. function untagHumanoid(humanoid)
  1458. if humanoid ~= nil then
  1459. local tag = humanoid:findFirstChild("creator")
  1460. if tag ~= nil then
  1461. tag.Parent = nil
  1462. end
  1463. end
  1464. end
  1465.  
  1466.  
  1467. function attack(humanoid)
  1468. SlashSound.SoundId = "http://www.roblox.com/asset/?id=" .. slashSounds[math.random(1,#slashSounds)]
  1469. SlashSound:play()
  1470. Tool.AnimationValue.Value = "changed"
  1471. Tool.AnimationValue.Value = "standardAttack"
  1472. end
  1473.  
  1474. function lunge(humanoid)
  1475. SlashSound.SoundId = "http://www.roblox.com/asset/?id=" .. slashSounds[math.random(1,#slashSounds)]
  1476. SlashSound:play()
  1477. Tool.AnimationValue.Value = "changed"
  1478. Tool.AnimationValue.Value = "doubleAttack"
  1479. wait(0.5)
  1480. SlashSound:play()
  1481. end
  1482.  
  1483. function spin(humanoid)
  1484.  
  1485. Tool.AnimationValue.Value = "changed"
  1486. Tool.AnimationValue.Value = "spinAttack"
  1487.  
  1488. end
  1489.  
  1490. Tool.Enabled = true
  1491. local last_attack = 0
  1492.  
  1493. function onActivated()
  1494.  
  1495. if not Tool.Enabled then
  1496. return
  1497. end
  1498.  
  1499. Tool.Enabled = false
  1500.  
  1501. local character = Tool.Parent;
  1502. local humanoid = character.Humanoid
  1503. if humanoid == nil then
  1504. print("Humanoid not found")
  1505. return
  1506. end
  1507.  
  1508. t = r.Stepped:wait()
  1509.  
  1510.  
  1511. if (t - last_attack < .2) then
  1512. lunge(humanoid)
  1513. else
  1514. attack(humanoid)
  1515. end
  1516.  
  1517. first_attack = last_attack
  1518. last_attack = t
  1519.  
  1520. Tool.Enabled = true
  1521. end
  1522.  
  1523. function onEquipped()
  1524.  
  1525. UnsheathSound:play()
  1526. local humanoid = Tool.Parent:FindFirstChild("Humanoid",false)
  1527. p = game.Players:GetPlayerFromCharacter(Tool.Parent)
  1528.  
  1529. end
  1530.  
  1531. script.Parent.Activated:connect(onActivated)
  1532. script.Parent.Equipped:connect(onEquipped)
  1533.  
  1534. connection = sword.Touched:connect(blow)
  1535.  
  1536.  
  1537. end,o34)
  1538. end))
  1539. o37 = Create("Animation",{
  1540. ["Name"] = "holdstaff",
  1541. ["Parent"] = o1,
  1542. ["AnimationId"] = "http://www.roblox.com/Asset?ID=27758613",
  1543. })
  1544. o38 = Create("Animation",{
  1545. ["Name"] = "staffdoublehit",
  1546. ["Parent"] = o1,
  1547. ["AnimationId"] = "http://www.roblox.com/Asset?ID=27763344",
  1548. })
  1549. o39 = Create("Animation",{
  1550. ["Name"] = "staffspin",
  1551. ["Parent"] = o1,
  1552. ["AnimationId"] = "http://www.roblox.com/Asset?ID=27763939",
  1553. })
  1554. o40 = Create("Animation",{
  1555. ["Name"] = "staffstandardswing",
  1556. ["Parent"] = o1,
  1557. ["AnimationId"] = "http://www.roblox.com/Asset?ID=27741468",
  1558. })
  1559. o41 = Create("Animation",{
  1560. ["Name"] = "staffstrike",
  1561. ["Parent"] = o1,
  1562. ["AnimationId"] = "http://www.roblox.com/Asset?ID=27761123",
  1563. })
  1564. o42 = Create("Animation",{
  1565. ["Name"] = "staffswingleft",
  1566. ["Parent"] = o1,
  1567. ["AnimationId"] = "http://www.roblox.com/Asset?ID=27762691",
  1568. })
  1569. o43 = Create("Animation",{
  1570. ["Name"] = "staffswingright",
  1571. ["Parent"] = o1,
  1572. ["AnimationId"] = "http://www.roblox.com/Asset?ID=27761962",
  1573. })
  1574. o44 = Create("Animation",{
  1575. ["Name"] = "walkstaff",
  1576. ["Parent"] = o1,
  1577. ["AnimationId"] = "http://www.roblox.com/Asset?ID=27759788",
  1578. })
  1579. mas.Parent = workspace
  1580. mas:MakeJoints()
  1581. local mas1 = mas:GetChildren()
  1582. for i=1,#mas1 do
  1583. mas1[i].Parent = workspace
  1584. ypcall(function() mas1[i]:MakeJoints() end)
  1585. end
  1586. mas:Destroy()
  1587. for i=1,#cors do
  1588. coroutine.resume(cors[i])
  1589. end
Advertisement
Add Comment
Please, Sign In to add comment