Advertisement
SeamedCargo

Untitled

Jul 18th, 2015
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.21 KB | None | 0 0
  1. ------------------
  2. --SPAWNING--
  3. ------------------
  4.  
  5. miked=script.Parent
  6.  
  7. itlh=miked.Torso:findFirstChild("Left Hip")
  8. itlh.Part0=miked.Torso
  9. itlh.Part1=miked:findFirstChild("Left Leg")
  10. itlh.C0=CFrame.new(-1, -1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  11.  
  12. itrh=miked.Torso:findFirstChild("Right Hip")
  13. itrh.Part0=miked.Torso
  14. itrh.Part1=miked:findFirstChild("Right Leg")
  15. itrh.C0=CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
  16.  
  17. itls=miked.Torso:findFirstChild("Left Shoulder")
  18. itls.Part1=miked.Torso
  19. itls.C0=CFrame.new(2, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  20. itls.Part0=miked:findFirstChild("Left Arm")
  21.  
  22. itrs=miked.Torso:findFirstChild("Right Shoulder")
  23. itrs.Part1=miked.Torso
  24. itrs.C0=CFrame.new(-2, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
  25. itrs.Part0=miked:findFirstChild("Right Arm")
  26.  
  27. miked.Head:makeJoints()
  28. ------------------
  29. ------------------
  30.  
  31.  
  32. function waitForChild(parent, childName)
  33. while true do
  34. local child = parent:findFirstChild(childName)
  35. if child then
  36. return child
  37. end
  38. parent.ChildAdded:wait()
  39. end
  40. end
  41.  
  42. local Figure = script.Parent
  43. local Torso = waitForChild(Figure, "Torso")
  44. local RightShoulder = waitForChild(Torso, "Right Shoulder")
  45. local LeftShoulder = waitForChild(Torso, "Left Shoulder")
  46. local RightHip = waitForChild(Torso, "Right Hip")
  47. local LeftHip = waitForChild(Torso, "Left Hip")
  48. local Neck = waitForChild(Torso, "Neck")
  49. local Humanoid = waitForChild(Figure, "Humanoid")
  50. local pose = "Standing"
  51.  
  52. local toolAnim = "None"
  53. local toolAnimTime = 0
  54.  
  55. local isSeated = false
  56.  
  57.  
  58. function onRunning(speed)
  59. if isSeated then return end
  60.  
  61. if speed>0 then
  62. pose = "Running"
  63. else
  64. pose = "Standing"
  65. end
  66. end
  67.  
  68. function onDied()
  69. pose = "Dead"
  70. end
  71.  
  72. function onJumping()
  73. isSeated = false
  74. pose = "Jumping"
  75. end
  76.  
  77. function onClimbing()
  78. pose = "Climbing"
  79. end
  80.  
  81. function onGettingUp()
  82. pose = "GettingUp"
  83. end
  84.  
  85. function onFreeFall()
  86. pose = "FreeFall"
  87. end
  88.  
  89. function onDancing()
  90. pose = "Dancing"
  91. end
  92.  
  93. function onFallingDown()
  94. pose = "FallingDown"
  95. end
  96.  
  97. function onSeated()
  98. isSeated = true
  99. pose = "Seated"
  100. end
  101.  
  102.  
  103.  
  104. function moveJump()
  105. RightShoulder.MaxVelocity = 0.5
  106. LeftShoulder.MaxVelocity = 0.5
  107. RightShoulder.DesiredAngle = -3.14
  108. LeftShoulder.DesiredAngle = -3.14
  109. RightHip.DesiredAngle = 0
  110. LeftHip.DesiredAngle = 0
  111. end
  112.  
  113. function moveFreeFall()
  114. RightShoulder.MaxVelocity = 0.5
  115. LeftShoulder.MaxVelocity = 0.5
  116. RightShoulder.DesiredAngle = -1
  117. LeftShoulder.DesiredAngle = -1
  118. RightHip.DesiredAngle = 0
  119. LeftHip.DesiredAngle = 0
  120. end
  121.  
  122. function moveFloat()
  123. RightShoulder.MaxVelocity = 0.5
  124. LeftShoulder.MaxVelocity = 0.5
  125. RightShoulder.DesiredAngle = -1.57
  126. LeftShoulder.DesiredAngle = 1.57
  127. RightHip.DesiredAngle = 1.57
  128. LeftHip.DesiredAngle = -1.57
  129. end
  130.  
  131. function moveBoogy()
  132. while pose=="Boogy" do
  133. wait(.5)
  134. RightShoulder.MaxVelocity = 1
  135. LeftShoulder.MaxVelocity = 1
  136. RightShoulder.DesiredAngle = -3.14
  137. LeftShoulder.DesiredAngle = 0
  138. RightHip.DesiredAngle = 1.57
  139. LeftHip.DesiredAngle = 0
  140. wait(.5)
  141. RightShoulder.MaxVelocity = 1
  142. LeftShoulder.MaxVelocity = 1
  143. RightShoulder.DesiredAngle = 0
  144. LeftShoulder.DesiredAngle = -3.14
  145. RightHip.DesiredAngle = 0
  146. LeftHip.DesiredAngle = 1.57
  147. end
  148. end
  149.  
  150. function moveZombie()
  151. RightShoulder.MaxVelocity = 0.5
  152. LeftShoulder.MaxVelocity = 0.5
  153. RightShoulder.DesiredAngle = -1.57
  154. LeftShoulder.DesiredAngle = 1.57
  155. RightHip.DesiredAngle = 0
  156. LeftHip.DesiredAngle = 0
  157. end
  158.  
  159. function movePunch()
  160. script.Parent.Torso.Anchored=true
  161. RightShoulder.MaxVelocity = 60
  162. LeftShoulder.MaxVelocity = 0.5
  163. RightShoulder.DesiredAngle = -1.57
  164. LeftShoulder.DesiredAngle = 0
  165. RightHip.DesiredAngle = 0
  166. LeftHip.DesiredAngle = 0
  167. wait(1)
  168. script.Parent.Torso.Anchored=false
  169. pose="Standing"
  170.  
  171. end
  172.  
  173. function moveKick()
  174. RightShoulder.MaxVelocity = 0.5
  175. LeftShoulder.MaxVelocity = 0.5
  176. RightShoulder.DesiredAngle = 0
  177. LeftShoulder.DesiredAngle = 0
  178. RightHip.MaxVelocity = 40
  179. RightHip.DesiredAngle = 1.57
  180. LeftHip.DesiredAngle = 0
  181. wait(1)
  182. pose="Standing"
  183.  
  184. end
  185.  
  186. function moveFly()
  187. RightShoulder.MaxVelocity = 0.5
  188. LeftShoulder.MaxVelocity = 0.5
  189. RightShoulder.DesiredAngle = 0
  190. LeftShoulder.DesiredAngle = 0
  191. RightHip.MaxVelocity = 40
  192. RightHip.DesiredAngle = 1.57
  193. LeftHip.DesiredAngle = 0
  194. wait(1)
  195. pose="Standing"
  196.  
  197. end
  198.  
  199.  
  200. function moveClimb()
  201. RightShoulder.MaxVelocity = 0.5
  202. LeftShoulder.MaxVelocity = 0.5
  203. RightShoulder.DesiredAngle = -3.14
  204. LeftShoulder.DesiredAngle = 3.14
  205. RightHip.DesiredAngle = 0
  206. LeftHip.DesiredAngle = 0
  207. end
  208.  
  209. function moveSit()
  210. RightShoulder.MaxVelocity = 0.15
  211. LeftShoulder.MaxVelocity = 0.15
  212. RightShoulder.DesiredAngle = -3.14 /2
  213. LeftShoulder.DesiredAngle = -3.14 /2
  214. RightHip.DesiredAngle = 3.14 /2
  215. LeftHip.DesiredAngle = -3.14 /2
  216. end
  217.  
  218. function getTool()
  219.  
  220. kidTable = Figure:children()
  221. if (kidTable ~= nil) then
  222. numKids = #kidTable
  223. for i=1,numKids do
  224. if (kidTable[i].className == "Tool") then return kidTable[i] end
  225. end
  226. end
  227.  
  228. return nil
  229. end
  230.  
  231. function getToolAnim(tool)
  232.  
  233. c = tool:children()
  234. for i=1,#c do
  235. if (c[i].Name == "toolanim" and c[i].className == "StringValue") then
  236. return c[i]
  237. end
  238. end
  239. return nil
  240. end
  241.  
  242. function animateTool()
  243.  
  244. if (toolAnim == "None") then
  245. RightShoulder.DesiredAngle = -1.57
  246. return
  247. end
  248.  
  249. if (toolAnim == "Slash") then
  250. RightShoulder.MaxVelocity = 0.5
  251. RightShoulder.DesiredAngle = 0
  252. return
  253. end
  254.  
  255. if (toolAnim == "Lunge") then
  256. RightShoulder.MaxVelocity = 0.5
  257. LeftShoulder.MaxVelocity = 0.5
  258. RightHip.MaxVelocity = 0.5
  259. LeftHip.MaxVelocity = 0.5
  260. RightShoulder.DesiredAngle = -1.57
  261. LeftShoulder.DesiredAngle = 1.0
  262. RightHip.DesiredAngle = 1.57
  263. LeftHip.DesiredAngle = 1.0
  264. return
  265. end
  266. end
  267.  
  268. function move(time)
  269. local amplitude
  270. local frequency
  271.  
  272. if (pose == "Jumping") then
  273. moveJump()
  274. return
  275. end
  276.  
  277. if (pose == "Zombie") then
  278. moveZombie()
  279. return
  280. end
  281.  
  282. if (pose == "Boogy") then
  283. moveBoogy()
  284. return
  285. end
  286.  
  287. if (pose == "Float") then
  288. moveFloat()
  289. return
  290. end
  291.  
  292. if (pose == "Punch") then
  293. movePunch()
  294. return
  295. end
  296.  
  297. if (pose == "Kick") then
  298. moveKick()
  299. return
  300. end
  301.  
  302. if (pose == "Fly") then
  303. moveFly()
  304. return
  305. end
  306.  
  307. if (pose == "FreeFall") then
  308. moveFreeFall()
  309. return
  310. end
  311.  
  312. if (pose == "Climbing") then
  313. moveClimb()
  314. return
  315. end
  316.  
  317. if (pose == "Seated") then
  318. moveSit()
  319. return
  320. end
  321.  
  322. amplitude = 0.1
  323. frequency = 1
  324.  
  325. RightShoulder.MaxVelocity = 0.15
  326. LeftShoulder.MaxVelocity = 0.15
  327. if (pose == "Running") then
  328. amplitude = 1
  329. frequency = 9
  330. elseif (pose == "Dancing") then
  331. amplitude = 2
  332. frequency = 16
  333. end
  334.  
  335.  
  336. desiredAngle = amplitude * math.sin(time*frequency)
  337. if pose~="Dancing" then
  338. RightShoulder.DesiredAngle = -desiredAngle
  339. LeftShoulder.DesiredAngle = desiredAngle
  340. RightHip.DesiredAngle = -desiredAngle
  341. LeftHip.DesiredAngle = -desiredAngle
  342. else
  343. RightShoulder.DesiredAngle = desiredAngle
  344. LeftShoulder.DesiredAngle = desiredAngle
  345. RightHip.DesiredAngle = -desiredAngle
  346. LeftHip.DesiredAngle = -desiredAngle
  347. end
  348.  
  349.  
  350.  
  351. local tool = getTool()
  352.  
  353. if tool ~= nil then
  354.  
  355. animStringValueObject = getToolAnim(tool)
  356.  
  357. if animStringValueObject ~= nil then
  358. toolAnim = animStringValueObject.Value
  359. -- message recieved, delete StringValue
  360. animStringValueObject.Parent = nil
  361. toolAnimTime = time + .3
  362. end
  363.  
  364. if time > toolAnimTime then
  365. toolAnimTime = 0
  366. toolAnim = "None"
  367. end
  368.  
  369. animateTool()
  370.  
  371.  
  372. else
  373. toolAnim = "None"
  374. toolAnimTime = 0
  375. end
  376. end
  377.  
  378.  
  379. -- connect events
  380. -----------------------------------------------------------------------------------------------------------------------
  381.  
  382. function unequip()
  383. local items=script.Parent:children()
  384. for i=1, #items do
  385. if items[i].className=="Tool" then items[i]:remove() end
  386. end
  387. end
  388.  
  389. function onChatted(msg, recipient)
  390. msg = string.lower(msg)
  391.  
  392. if string.match(msg, string.lower(script.Parent.Name))~=nil or string.match(msg, "everyone") then
  393. if string.match(msg, "equip") then
  394. if game.Workspace:findFirstChild("Hub") then
  395. if string.match(msg, "rocket") then unequip()
  396. game.Workspace.Hub.Rocket:clone().Parent=script.Parent
  397. elseif string.match(msg, "slingshot") then unequip()
  398. game.Workspace.Hub.Slingshot:clone().Parent=script.Parent
  399. elseif string.match(msg, "sword") then unequip()
  400. game.Workspace.Hub.Sword:clone().Parent=script.Parent
  401. elseif string.match(msg, "pbg") then unequip()
  402. game.Workspace.Hub.PBG:clone().Parent=script.Parent
  403. elseif string.match(msg, "superball") then unequip()
  404. game.Workspace.Hub.Superball:clone().Parent=script.Parent
  405. elseif string.match(msg, "trowel") then unequip()
  406. game.Workspace.Hub.Trowel:clone().Parent=script.Parent
  407. elseif string.match(msg, "bomb") then unequip()
  408. game.Workspace.Hub.Bomb:clone().Parent=script.Parent
  409. end
  410. end
  411. end
  412. if string.match(msg, "unequip") then unequip() end
  413. if string.match(msg, "run") then onRunning(1) end
  414. if string.match(msg, "climb") then onClimbing() end
  415. if string.match(msg, "jump") then onJumping() end
  416. if string.match(msg, "zombie") then pose="Zombie" end
  417. if string.match(msg, "disco") then pose="Boogy" end
  418. if string.match(msg, "float") then pose="Float" end
  419. if string.match(msg, "punch") then pose="Punch" end
  420. if string.match(msg, "kick") then pose="Kick" end
  421. if string.match(msg, "fly") then pose="Fly" end
  422. if string.match(msg, "heal") then script.Parent.Humanoid.Health=script.Parent.Humanoid.MaxHealth end
  423. if string.match(msg, "defend") then defence() end
  424. if string.match(msg, "stop") then pose="Standing"; proxkill=false; following=false; stopmoving() end
  425. if string.match(msg, "go home") then following=false; gohome() end
  426. if string.match(msg, "follow") then
  427. if string.match(msg, "all") then
  428. followany()
  429. else
  430. local egg=game.Players:children()
  431. for i=1, #egg do
  432. if string.match(msg, string.lower(egg[i].Name)) then
  433. follow(egg[i].Name)
  434. return
  435. end
  436. end
  437. end
  438. end
  439. if string.match(msg, "kill") then
  440. if string.match(msg, "all") then
  441. attackany()
  442. else
  443. local egg=game.Players:children()
  444. for i=1, #egg do
  445. if string.match(msg, string.lower(egg[i].Name)) then
  446. attack(egg[i].Name)
  447. return
  448. end
  449. end
  450. end
  451. end
  452.  
  453. end
  454. end
  455.  
  456. if game.Players.NumPlayers>1 then
  457. x=game.Players:children()
  458.  
  459. for i=1, #x do
  460. if script.Parent:findFirstChild("Commander")~=nil then
  461. if script.Parent.Commander:children()~=nil or script.Parent.Commander:children()>0 then
  462. local ch=script.Parent.Commander:children()
  463. for i=1, #ch do
  464. if string.lower(ch[i].Name)==string.lower(x[i].Name) then
  465. x[i].Chatted:connect(function(msg, recipient) onChatted(msg, recipient) end)
  466. end
  467. end
  468. elseif string.lower(script.Parent.Commander.Value)==string.lower(x[i].Name) then
  469. x[i].Chatted:connect(function(msg, recipient) onChatted(msg, recipient) end)
  470. end
  471. else
  472. x[i].Chatted:connect(function(msg, recipient) onChatted(msg, recipient) end)
  473. end
  474. end
  475. end
  476.  
  477.  
  478. function onPlayerEntered(Player)
  479. while Player.Name==nil do
  480. wait(2)
  481. end
  482. if script.Parent:findFirstChild("Commander")~=nil then
  483. if script.Parent.Commander:children()~=nil or script.Parent.Commander:children()>0 then
  484. local ch=script.Parent.Commander:children()
  485. for i=1, #ch do
  486. if string.lower(ch[i].Name)==string.lower(Player.Name) then
  487. Player.Chatted:connect(function(msg, recipient) onChatted(msg, recipient) end)
  488. end
  489. end
  490. elseif string.lower(script.Parent.Commander.Value)==string.lower(Player.Name) then
  491. Player.Chatted:connect(function(msg, recipient) onChatted(msg, recipient) end)
  492. end
  493. else
  494. Player.Chatted:connect(function(msg, recipient) onChatted(msg, recipient) end)
  495. end
  496. end
  497.  
  498. game.Players.ChildAdded:connect(onPlayerEntered)
  499.  
  500.  
  501.  
  502. -----------------------------------------------------------------------------------------------------------------------
  503. -----------------------------------------------------------------------------------------------------------------------
  504. -----------------------------------------------------------------------------------------------------------------------
  505. -----------------------------------------------------------------------------------------------------------------------
  506. -----------------------------------------------------------------------------------------------------------------------
  507. -----------------------------------------------------------------------------------------------------------------------
  508. -----------------------------------------------------------------------------------------------------------------------
  509. -----------------------------------------------------------------------------------------------------------------------
  510. -----------------------------------------------------------------------------------------------------------------------
  511. -----------------------------------------------------------------------------------------------------------------------
  512. -----------------------------------------------------------------------------------------------------------------------
  513. -----------------------------------------------------------------------------------------------------------------------
  514. dist=20
  515.  
  516. function followany()
  517. following=true
  518. while following==true do
  519.  
  520. local ch=game.Players:children()
  521. for i=1, #ch do
  522. local l=game.Workspace:findFirstChild(ch[i].Name)
  523. if l~=nil then
  524. local s=l.Torso
  525. local p=l.Torso.Position
  526. local q=script.Parent.Torso.Position
  527. local d=math.sqrt( ((p.x-q.x)^2)+((p.y-q.y)^2)+((p.z-q.z)^2) )
  528. if smallest==nil then
  529. smallest=d
  530. target=s
  531. elseif d<smallest then
  532. smallest=d
  533. target=s
  534. end
  535. end
  536. end
  537.  
  538. if smallest==nil then stopmoving() return end
  539.  
  540. if smallest>6*dist then return end
  541.  
  542. script.Parent.Humanoid:MoveTo(target.Position, target)
  543.  
  544. wait(0.5)
  545. for i=1, 6 do
  546. if target.Parent.Humanoid.Health<1 then stopmoving() else wait(0.5) end
  547. end
  548. end
  549. end
  550.  
  551.  
  552.  
  553. function gohome()
  554. script.Parent.Humanoid:MoveTo(Vector3.new(0,0,0), game.Workspace.Bases.Base)
  555. end
  556. function stopmoving()
  557. script.Parent.Humanoid:MoveTo(script.Parent.Torso.Position, script.Parent.Torso)
  558. end
  559.  
  560. function follow(name)
  561. following=true
  562.  
  563. local p=game.Workspace:findFirstChild(name)
  564. if p==nil then return end
  565. while following==true do
  566. script.Parent.Humanoid:MoveTo(p.Torso.Position, p.Torso)
  567. wait(0.5)
  568. for i=1, 3 do
  569. if p.Humanoid.Health<1 then following=false; stopmoving() return end
  570. wait(0.5)
  571. end
  572. end
  573. end
  574.  
  575. function attack(name)
  576. if script.Parent:findFirstChild("Sword")~=nil then
  577. following=true
  578. local p=game.Workspace:findFirstChild(name)
  579. if p==nil then return end
  580. while following==true do
  581. script.Parent.Humanoid:MoveTo(p.Torso.Position, p.Torso)
  582. wait(0.5)
  583. for i=1, 3 do
  584. if p.Humanoid.Health<1 then following=false; stopmoving() return end
  585. local l=p.Torso.Position
  586. local q=script.Parent.Torso.Position
  587. local d=math.sqrt( ((l.x-q.x)^2)+((l.y-q.y)^2)+((l.z-q.z)^2) )
  588. if d<10 then
  589. script.Parent.Humanoid:MoveTo(p.Torso.Position, p.Torso); slash()
  590. if (q.y-l.y)>3 and (q.y-l.y)<7 then
  591. script.Parent.Humanoid:MoveTo(p.Torso.Position+Vector3.new(math.random(-4,4),0,math.random(-4,4)), p.Torso);
  592. end
  593. end
  594. wait(1)
  595. end
  596. end
  597. end
  598. end
  599.  
  600. function attackany()
  601. if script.Parent:findFirstChild("Sword")~=nil then
  602.  
  603. following=true
  604. while following==true do
  605.  
  606. local ch=game.Players:children()
  607. for i=1, #ch do
  608. local l=game.Workspace:findFirstChild(ch[i].Name)
  609. if l~=nil then
  610. local s=l.Torso
  611. local p=l.Torso.Position
  612. local q=script.Parent.Torso.Position
  613. local d=math.sqrt( ((p.x-q.x)^2)+((p.y-q.y)^2)+((p.z-q.z)^2) )
  614. if smallest==nil then
  615. smallest=d
  616. target=s
  617. elseif d<smallest then
  618. smallest=d
  619. target=s
  620. end
  621. end
  622. end
  623.  
  624. if smallest==nil then stopmoving() return end
  625.  
  626. if smallest>6*dist then return end
  627.  
  628. script.Parent.Humanoid:MoveTo(target.Position, target)
  629.  
  630. if smallest<10 then
  631. slash()
  632. end
  633. if target.Parent==nil then stopmoving() return end
  634. wait(0.5)
  635. for i=1, 3 do
  636. if target.Parent.Humanoid.Health<1 then
  637. stopmoving()
  638. else
  639. local p=target.Position
  640. local q=script.Parent.Torso.Position
  641. local d=math.sqrt( ((p.x-q.x)^2)+((p.y-q.y)^2)+((p.z-q.z)^2) )
  642. if d<10 then
  643. script.Parent.Humanoid:MoveTo(target.Position, target); slash()
  644. if (q.y-p.y)>3 and (q.y-p.y)<7 then
  645. script.Parent.Humanoid:MoveTo(p.Torso.Position+Vector3.new(math.random(-4,4),0,math.random(-4,4)), p.Torso);
  646. end
  647. end
  648. wait(1)
  649. end
  650. end
  651. end
  652. end
  653. end
  654.  
  655.  
  656. function patrol()
  657. if points==nil then
  658. points=0
  659. if game.Workspace:findFirstChild("pp1")~=nil then
  660. pp1=game.Workspace:findFirstChild("pp1")
  661. local points=points+1
  662. if game.Workspace:findFirstChild("pp2")~=nil then
  663. pp2=game.Workspace:findFirstChild("pp2")
  664. local points=points+1
  665. if game.Workspace:findFirstChild("pp3")~=nil then
  666. pp3=game.Workspace:findFirstChild("pp3")
  667. local points=points+1
  668. if game.Workspace:findFirstChild("pp4")~=nil then
  669. pp4=game.Workspace:findFirstChild("pp4")
  670. local points=points+1
  671. if game.Workspace:findFirstChild("pp5")~=nil then
  672. pp5=game.Workspace:findFirstChild("pp5")
  673. local points=points+1
  674. if game.Workspace:findFirstChild("pp6")~=nil then
  675. pp6=game.Workspace:findFirstChild("pp6")
  676. local points=points+1
  677. if game.Workspace:findFirstChild("pp7")~=nil then
  678. pp7=game.Workspace:findFirstChild("pp7")
  679. local points=points+1
  680. if game.Workspace:findFirstChild("pp8")~=nil then
  681. pp8=game.Workspace:findFirstChild("pp8")
  682. local points=points+1
  683. if game.Workspace:findFirstChild("pp9")~=nil then
  684. pp9=game.Workspace:findFirstChild("pp9")
  685. local points=points+1
  686. end
  687. end
  688. end
  689. end
  690. end
  691. end
  692. end
  693. end
  694. end
  695. end
  696.  
  697. if points<1 then return end
  698. patrolling=true
  699. local time=2
  700. if points==1 then return end
  701. if points>1 then
  702. while patrolling==true do
  703. script.Parent.Humanoid:MoveTo(pp1.Position, pp1)
  704. wait(time)
  705. script.Parent.Humanoid:MoveTo(pp2.Position, pp2)
  706. wait(time)
  707. if points>2 then
  708. script.Parent.Humanoid:MoveTo(pp3.Position, pp3)
  709. wait(time)
  710. if points>3 then
  711. script.Parent.Humanoid:MoveTo(pp4.Position, pp4)
  712. wait(time)
  713. if points>4 then
  714. script.Parent.Humanoid:MoveTo(pp5.Position, pp5)
  715. wait(time)
  716. if points>5 then
  717. script.Parent.Humanoid:MoveTo(pp6.Position, pp6)
  718. wait(time)
  719. if points>6 then
  720. script.Parent.Humanoid:MoveTo(pp7.Position, pp7)
  721. wait(time)
  722. if points>7 then
  723. script.Parent.Humanoid:MoveTo(pp8.Position, pp8)
  724. wait(time)
  725. if points>8 then
  726. script.Parent.Humanoid:MoveTo(pp9.Position, pp9)
  727. wait(time)
  728. end
  729. end
  730. end
  731. end
  732. end
  733. end
  734. end
  735. end
  736. end
  737. end
  738.  
  739.  
  740. function goto(pos,part)
  741. while true do
  742. end
  743. end
  744.  
  745.  
  746. function slash()
  747. for i=1, 3 do
  748. wait(.3)
  749. RightShoulder.MaxVelocity = 2
  750. LeftShoulder.MaxVelocity = 1
  751. RightShoulder.DesiredAngle = -2.14
  752. LeftShoulder.DesiredAngle = 0
  753. RightHip.DesiredAngle = 0
  754. LeftHip.DesiredAngle = 0
  755. wait(.2)
  756. RightShoulder.MaxVelocity = 2
  757. LeftShoulder.MaxVelocity = 1
  758. RightShoulder.DesiredAngle = 0
  759. LeftShoulder.DesiredAngle = 0
  760. RightHip.DesiredAngle = 0
  761. LeftHip.DesiredAngle = 0
  762. end
  763. end
  764.  
  765. function defence()
  766. proxkill=true
  767. while proxkill==true do
  768. local ch=game.Players:children()
  769. for i=1, #ch do
  770. local p=game.Workspace:findFirstChild(ch[i].Name)
  771. if p~=nil then
  772. local p=p.Torso.Position
  773. local q=script.Parent.Torso.Position
  774. local d=math.sqrt( ((p.x-q.x)^2)+((p.y-q.y)^2)+((p.z-q.z)^2) )
  775. if d<dist and d>8 then
  776. local ex=Instance.new("Explosion")
  777. ex.Position=p
  778. ex.Parent=game.Workspace
  779. end
  780. end
  781. end
  782. wait(1)
  783. end
  784. end
  785.  
  786.  
  787.  
  788.  
  789. -----------------------------------------------------------------------------------------------------------------------
  790. -----------------------------------------------------------------------------------------------------------------------
  791. -----------------------------------------------------------------------------------------------------------------------
  792. -----------------------------------------------------------------------------------------------------------------------
  793. -----------------------------------------------------------------------------------------------------------------------
  794. -----------------------------------------------------------------------------------------------------------------------
  795. -----------------------------------------------------------------------------------------------------------------------
  796. -----------------------------------------------------------------------------------------------------------------------
  797. -----------------------------------------------------------------------------------------------------------------------
  798. -----------------------------------------------------------------------------------------------------------------------
  799. -----------------------------------------------------------------------------------------------------------------------
  800. -----------------------------------------------------------------------------------------------------------------------
  801.  
  802.  
  803. Humanoid.Died:connect(onDied)
  804. Humanoid.Running:connect(onRunning)
  805. Humanoid.Jumping:connect(onJumping)
  806. Humanoid.Climbing:connect(onClimbing)
  807. Humanoid.GettingUp:connect(onGettingUp)
  808. Humanoid.FreeFalling:connect(onFreeFall)
  809. Humanoid.FallingDown:connect(onFallingDown)
  810. Humanoid.Seated:connect(onSeated)
  811.  
  812.  
  813. --[[
  814.  
  815. function newSound(id)
  816. local sound = Instance.new("Sound")
  817. sound.SoundId = id
  818. sound.Parent = script.Parent.Head
  819. return sound
  820. end
  821.  
  822.  
  823. local sDied = newSound("rbxasset://sounds/uuhhh.wav")
  824. local sFallingDown = newSound("rbxasset://sounds/splat.wav")
  825. local sFreeFalling = newSound("rbxasset://sounds/swoosh.wav")
  826. local sGettingUp = newSound("rbxasset://sounds/hit.wav")
  827. local sJumping = newSound("rbxasset://sounds/button.wav")
  828. local sRunning = newSound("rbxasset://sounds/bfsl-minifigfoots1.mp3")
  829. sRunning.Looped = true
  830.  
  831. local Figure = script.Parent
  832. local Head = waitForChild(Figure, "Head")
  833. local Humanoid = waitForChild(Figure, "Humanoid")
  834.  
  835.  
  836. function onDied()
  837. sDied:play()
  838. end
  839.  
  840. function onState(state, sound)
  841. if state then
  842. sound:play()
  843. else
  844. sound:pause()
  845. end
  846. end
  847.  
  848. function onRunning(speed)
  849. if speed>0 then
  850. sRunning:play()
  851. else
  852. sRunning:pause()
  853. end
  854. end
  855.  
  856.  
  857. Humanoid.Died:connect(onDied)
  858. Humanoid.Running:connect(onRunning)
  859. Humanoid.Jumping:connect(function(state) onState(state, sJumping) end)
  860. Humanoid.GettingUp:connect(function(state) onState(state, sGettingUp) end)
  861. Humanoid.FreeFalling:connect(function(state) onState(state, sFreeFalling) end)
  862. Humanoid.FallingDown:connect(function(state) onState(state, sFallingDown) end)
  863. --]]
  864.  
  865. local nextTime = 0
  866. local runService = game:service("RunService");
  867.  
  868. while Figure.Parent~=nil do
  869. time = runService.Stepped:wait()
  870. if time > nextTime then
  871. move(time)
  872. nextTime = time + 0.1
  873. end
  874. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement