Advertisement
Guest User

Tank ROBLOX SCRIPT

a guest
Feb 7th, 2017
8,037
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.13 KB | None | 0 0
  1. g = game.Players.LocalPlayer.Name
  2. j = game.Players[g].Character
  3.  
  4. acc = 2
  5. modes = {"Automatic", "Sniper", "ShotGun", "Burst", "Flame", "Electric"}
  6. modnum = 1
  7. mode = modes[modnum]
  8.  
  9. local la, ra = j.Torso:findFirstChild("Left Shoulder"),j.Torso:findFirstChild("Right Shoulder")
  10. function weld(par, p1, p2, c1, c2)
  11. local w = Instance.new("Weld")
  12. w.Parent = par
  13. w.Part0 = p1
  14. w.Part1 = p2
  15. pcall(function()
  16. w.C0 = c1
  17. w.C1 = c2
  18. end)
  19. return w
  20. end
  21.  
  22. mod = Instance.new("Model", j)
  23. mod.Name = "Mod"
  24.  
  25. local lw;
  26. local rw;
  27. local flw;
  28. local frw;
  29. moof = 0
  30.  
  31. fcolor = "Really black"
  32. scolor = "Grey"
  33. dcolor = "Royal blue"
  34.  
  35. left = j["Left Arm"]
  36.  
  37. pcall(function()
  38. la.Parent, ra.Parent = nil, nil
  39.  
  40. end)
  41.  
  42. fl = Instance.new("Part")
  43. fl.Parent = j
  44. fl.Size = Vector3.new(1, 1, 1)
  45. fl.CanCollide = false
  46. fl.Transparency = 1
  47. fl:BreakJoints()
  48. flw = weld(j.Torso, j.Torso, fl, CFrame.new(-1.1, .5, 0.15))
  49.  
  50. local lw = weld(j.Torso,fl,j["Left Arm"], CFrame.new(0, 0, 0)*CFrame.Angles(math.rad(90), 0,
  51.  
  52. math.rad(10)))
  53.  
  54.  
  55. fr = Instance.new("Part")
  56. fr.Parent = j
  57. fr.Size = Vector3.new(1, 1, 1)
  58. fr.CanCollide = false
  59. fr.Transparency = 1
  60. fr:BreakJoints()
  61. frw = weld(j.Torso, j.Torso, fr, CFrame.new(.2, .5, -1))
  62.  
  63. local rw = weld(j.Torso,fr,j["Right Arm"], CFrame.new(0, 0, 0)*CFrame.Angles(math.rad(90), 0,
  64.  
  65. math.rad(-35)))
  66.  
  67. function cyl(p)
  68. local c = Instance.new("CylinderMesh", p)
  69. return c
  70. end
  71.  
  72. function sph(p)
  73. local c = Instance.new("SpecialMesh", p)
  74. c.MeshType = "Sphere"
  75. return c
  76. end
  77.  
  78. function block(p)
  79. local c = Instance.new("BlockMesh", p)
  80. return c
  81. end
  82.  
  83.  
  84. local base = Instance.new("Part")
  85. base.Parent = mod
  86. base.Size = Vector3.new(1, 1, 1)
  87. base:BreakJoints()
  88. base.BrickColor = BrickColor.new(fcolor)
  89. local c = block(base)
  90. c.Scale = Vector3.new(.35, 3, .6)
  91. weld(base, base, left, CFrame.new(-.4, 2, .5)*CFrame.Angles(math.rad(0), math.rad(0),
  92.  
  93. math.rad(10)))
  94.  
  95. local a = Instance.new("Part")
  96. a.Parent = mod
  97. a.Size = Vector3.new(1, 1, 1)
  98. a:BreakJoints()
  99. a.BrickColor = BrickColor.new(scolor)
  100. local c = block(a)
  101. c.Scale = Vector3.new(.2, .2, .8)
  102. handle = weld(a, a, base, CFrame.new(0, -.7, -.4)*CFrame.Angles(math.rad(10), math.rad(0), 0))
  103.  
  104. local a2 = Instance.new("Part")
  105. a2.Parent = mod
  106. a2.Size = Vector3.new(1, 1, 1)
  107. a2:BreakJoints()
  108. a2.BrickColor = BrickColor.new(scolor)
  109. local c = block(a2)
  110. c.Scale = Vector3.new(.1, .3, .9)
  111. a2.Name = "Effect"
  112. weld(a2, a2, a, CFrame.new(0, 0, 0))
  113.  
  114. local a = Instance.new("Part")
  115. a.Parent = mod
  116. a.Size = Vector3.new(1, 1, 1)
  117. a:BreakJoints()
  118. a.BrickColor = BrickColor.new(scolor)
  119. local c = block(a)
  120. c.Scale = Vector3.new(.2, .2, .8)
  121. handle2 = weld(a, a, base, CFrame.new(0, .25, -.4)*CFrame.Angles(math.rad(10), math.rad(0), 0))
  122.  
  123. local a2 = Instance.new("Part")
  124. a2.Parent = mod
  125. a2.Size = Vector3.new(1, 1, 1)
  126. a2:BreakJoints()
  127. a2.BrickColor = BrickColor.new(scolor)
  128. local c = block(a2)
  129. c.Scale = Vector3.new(.1, .3, .9)
  130. a2.Name = "Effect"
  131. weld(a2, a2, a, CFrame.new(0, 0, 0))
  132.  
  133.  
  134. local s = Instance.new("Part")
  135. s.Parent = mod
  136. s.Size = Vector3.new(1, 1, 1)
  137. s:BreakJoints()
  138. s.BrickColor = BrickColor.new(fcolor)
  139. local c = cyl(s)
  140. c.Scale = Vector3.new(.2, 1.4, .2)
  141. weld(s, s, base, CFrame.new(0, 1.5, 0.2)*CFrame.Angles(0, 0, 0))
  142.  
  143. local s2 = Instance.new("Part")
  144. s2.Parent = mod
  145. s2.Size = Vector3.new(1, 1, 1)
  146. s2:BreakJoints()
  147. s2.BrickColor = BrickColor.new(scolor)
  148. local c = cyl(s2)
  149. c.Scale = Vector3.new(.3, 1.2, .3)
  150. weld(s2, s2, base, CFrame.new(0, 1.5, 0.2)*CFrame.Angles(0, 0, 0))
  151.  
  152.  
  153.  
  154. local s22 = Instance.new("Part")
  155. s22.Parent = mod
  156. s22.Size = Vector3.new(1, 1, 1)
  157. s22.BrickColor = BrickColor.new(dcolor)
  158. local c = cyl(s22)
  159. c.Scale = Vector3.new(.15, .95, .15)
  160. s22:BreakJoints()
  161. weld(s, s22, s, CFrame.new(0, -.1, .1)*CFrame.Angles(0, 0, 0))
  162. s22.Name = "Effect"
  163.  
  164. local st = Instance.new("Part")
  165. st.Parent = mod
  166. st.Size = Vector3.new(1, 1, 1)
  167. st.BrickColor = BrickColor.new(dcolor)
  168. st:BreakJoints()
  169. weld(st, st, s2, CFrame.new(0, .5, 0)*CFrame.Angles(0, 0, 0))
  170. st.Name = "Tip"
  171. st.Transparency = 1
  172.  
  173. local st2 = Instance.new("Part")
  174. st2.Parent = mod
  175. st2.Size = Vector3.new(1, 1, 1)
  176. st2.BrickColor = BrickColor.new(dcolor)
  177. st2:BreakJoints()
  178. st2.Name = "Tipl"
  179. st2.Transparency = 1
  180. weld(st2, st2, s, CFrame.new(0, .5, -.3)*CFrame.Angles(0, 0, 0))
  181.  
  182.  
  183.  
  184.  
  185.  
  186. local s = Instance.new("Part")
  187. s.Parent = mod
  188. s.Size = Vector3.new(1, 1, 1)
  189. s:BreakJoints()
  190. s.BrickColor = BrickColor.new(fcolor)
  191. local c = cyl(s)
  192. c.Scale = Vector3.new(.2, 1, .2)
  193. weld(s, s, base, CFrame.new(0, 1.5, -0.1)*CFrame.Angles(0, 0, 0))
  194.  
  195. local s2 = Instance.new("Part")
  196. s2.Parent = mod
  197. s2.Size = Vector3.new(1, 1, 1)
  198. s2:BreakJoints()
  199. s2.BrickColor = BrickColor.new(scolor)
  200. local c = cyl(s2)
  201. c.Scale = Vector3.new(.3, .8, .3)
  202. weld(s2, s2, base, CFrame.new(0, 1.5, -0.1)*CFrame.Angles(0, 0, 0))
  203.  
  204.  
  205.  
  206.  
  207.  
  208. for i=1,6 do
  209. local s = Instance.new("Part")
  210. s.Parent = mod
  211. s.Size = Vector3.new(1, 1, 1)
  212. s.BrickColor = BrickColor.new(scolor)
  213. local c = block(s)
  214. c.Scale = Vector3.new(.45, .2, .7)
  215. s:BreakJoints()
  216. weld(s, s, base, CFrame.new(0, -1 + (i*.4), 0.1)*CFrame.Angles(0, 0, 0))
  217.  
  218. local s2 = Instance.new("Part")
  219. s2.Parent = mod
  220. s2.Size = Vector3.new(1, 1, 1)
  221. s2.BrickColor = BrickColor.new(dcolor)
  222. local c = block(s2)
  223. c.Scale = Vector3.new(.5, .1, .75)
  224. s2:BreakJoints()
  225. weld(s, s2, s, CFrame.new(0, 0, 0)*CFrame.Angles(0, 0, 0))
  226. s2.Name = "Effect"
  227.  
  228. end
  229.  
  230.  
  231.  
  232.  
  233.  
  234. local l = Instance.new("Part")
  235. l.Parent = mod
  236. l.Size = Vector3.new(1, 1, 1)
  237. l:BreakJoints()
  238. l.BrickColor = BrickColor.new(scolor)
  239. l.CanCollide = false
  240. l.formFactor = 0
  241. l.BrickColor = BrickColor.new("Really red")
  242. l.Transparency = .3
  243. local c = cyl(l)
  244. c.Scale = Vector3.new(.3, .8, .3)
  245. c.Name = "c"
  246. l.Name = "Laser"
  247. local w = weld(l, l, st2, CFrame.new(0, 0, 0)*CFrame.Angles(0, 0, 0))
  248. w.Name = "w"
  249. w.Parent = l
  250.  
  251.  
  252.  
  253.  
  254.  
  255. for i, v in pairs(mod:GetChildren()) do
  256. v.CanCollide = false
  257. if v.Name == "Effect" then
  258. coroutine.resume(coroutine.create(function()
  259. while true do
  260. for i=1, 25 do
  261. wait()
  262. v.Reflectance = i*4/100
  263. v.Transparency = i*4/100
  264. end
  265. wait()
  266. for i=1,25 do
  267. v.Transparency = i*4/100
  268. v.Reflectance = i*4/100
  269. wait()
  270. end
  271. end
  272. end))
  273. end
  274. end
  275.  
  276. function ChangeColor(color)
  277. for i, v in pairs(mod:GetChildren()) do
  278. if v.Name == "Effect" then
  279. v.BrickColor = BrickColor.new(color)
  280. end
  281. end
  282. end
  283.  
  284.  
  285.  
  286. if script.Parent.className ~= "HopperBin" then
  287. h = Instance.new("HopperBin")
  288. h.Parent = game.Players[g].Backpack
  289. script.Parent = h
  290.  
  291.  
  292.  
  293. end
  294.  
  295. rsel = false
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303. las = mod.Laser
  304.  
  305. lasw = las.w
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313. function snipe(pos, m)
  314. local l = Instance.new("Part")
  315. l.Parent = j
  316. l.BrickColor = BrickColor.new("Dark green")
  317. l.Anchored = true
  318. l.Size = Vector3.new(1, 1, 1)
  319. l.formFactor = 0
  320.  
  321. local c = Instance.new("CylinderMesh")
  322. c.Parent = l
  323. local rand = Vector3.new(math.random(-.1, .1), math.random(-.1, .1), math.random(-.1, .1))
  324. local looky = (mod.Tip.CFrame-mod.Tip.CFrame.p)*Vector3.new(0, -999, 0)
  325. local a, b = Workspace:FindPartOnRay(Ray.new(mod.Tip.Position+rand, (looky), 999), j)
  326. if a then
  327. a:BreakJoints()
  328. local rot = (a.Position-mod.Tip.Position).magnitude/acc
  329. a.RotVelocity = Vector3.new(math.random(-rot, rot), math.random(-rot, rot), math.random(-rot,
  330.  
  331. rot))
  332.  
  333. if a.Name == "Torso" or a.Name == "Head" then --For perfect shot...
  334. l.CFrame = CFrame.new((a.Position+mod.Tip.Position)/2, mod.Tip.Position)*CFrame.Angles(math.pi/2, 0, 0)
  335.  
  336. c.Scale = Vector3.new(.1, (a.Position-mod.Tip.Position).magnitude, 0.1)
  337. Instance.new("Fire").Parent = a
  338. else
  339. c.Scale = Vector3.new(.1, (b-mod.Tip.Position).magnitude, 0.1)
  340. l.CFrame = CFrame.new((b+mod.Tip.Position+rand)/2,
  341.  
  342. mod.Tip.Position)*CFrame.Angles(math.pi/2, 0, 0)
  343. local chance = math.random(1, 20)
  344.  
  345. if chance == 5 then
  346. for i=1,10 do
  347. local e = Instance.new("Explosion", Workspace)
  348. e.BlastRadius = 30
  349. e.BlastPressure = 8000
  350. e.Position = b+Vector3.new(math.random(-4, 4), math.random(-4, 4), math.random(-4, 4))
  351. e.Hit:connect(function(z)
  352. Instance.new("Fire").Parent = z
  353. if z.Name ~= "Base" then
  354. z.Anchored = false
  355. end
  356. z:BreakJoints()
  357. end)
  358. end
  359. end
  360.  
  361. end
  362. else
  363. c.Scale = Vector3.new(.1, (looky-mod.Tip.Position).magnitude, 0.1)
  364. l.CFrame = CFrame.new((looky+mod.Tip.Position+rand)/2, mod.Tip.Position)*CFrame.Angles(math.pi/2,
  365.  
  366. 0, 0)
  367.  
  368. end
  369.  
  370. coroutine.resume(coroutine.create(function()
  371. for i=0,1,.075 do
  372. l.Transparency = i
  373. wait()
  374. end
  375. l:Remove()
  376. end))
  377. end
  378.  
  379.  
  380.  
  381.  
  382. function scatter(pos, m)
  383. for i=1,10 do
  384. local l = Instance.new("Part")
  385. l.Parent = j
  386. l.BrickColor = BrickColor.new("Bright yellow")
  387. l.Anchored = true
  388. l.Size = Vector3.new(1, 1, 1)
  389. l.formFactor = 0
  390.  
  391. local c = Instance.new("CylinderMesh")
  392. c.Parent = l
  393. local tempacc = acc*3.2
  394. local rand = Vector3.new(math.random(-tempacc, tempacc), math.random(-tempacc, tempacc),
  395.  
  396. math.random(-tempacc, tempacc))
  397. local looky = (mod.Tip.CFrame-mod.Tip.CFrame.p)*Vector3.new(0, -999, 0)
  398. local a, b = Workspace:FindPartOnRay(Ray.new(mod.Tip.Position+rand, (looky), 999), j)
  399. if a then
  400. a:BreakJoints()
  401. if a.Name ~= "Base" then
  402. a.Anchored = false
  403.  
  404. if a.Name == "Torso" or a.Name == "Head" or a.Parent:findFirstChild("Humanoid") ~= nil then
  405.  
  406. l.CFrame = CFrame.new((a.Position+mod.Tip.Position)/2, mod.Tip.Position)*CFrame.Angles(math.pi/2,
  407.  
  408. 0, 0)
  409. c.Scale = Vector3.new(.1, (a.Position-mod.Tip.Position).magnitude, 0.1)
  410.  
  411. Instance.new("Fire").Parent = a
  412. local bf = Instance.new("BodyForce")
  413. bf.Parent = a
  414. bf.force = (a.Position - mod.Tip.Position).unit*math.random(2300, 4300)
  415.  
  416. else
  417. c.Scale = Vector3.new(.1, (b-mod.Tip.Position).magnitude, 0.1)
  418. l.CFrame = CFrame.new((b+mod.Tip.Position+rand)/2,
  419.  
  420. mod.Tip.Position)*CFrame.Angles(math.pi/2, 0, 0)
  421. --[[a.RotVelocity = Vector3.new(math.random(-300, 300), math.random(-300, 300), math.random(-300,
  422.  
  423. 300))]]
  424.  
  425. end
  426. end
  427. else
  428. c.Scale = Vector3.new(.1, (looky-mod.Tip.Position).magnitude, 0.1)
  429. l.CFrame = CFrame.new((looky+mod.Tip.Position+rand)/2, mod.Tip.Position)*CFrame.Angles(math.pi/2,
  430.  
  431. 0, 0)
  432.  
  433. end
  434. coroutine.resume(coroutine.create(function()
  435. for i=0,1,.075 do
  436. l.Transparency = i
  437. wait()
  438. end
  439. l:Remove()
  440. end))
  441.  
  442. end
  443.  
  444.  
  445. end
  446.  
  447.  
  448.  
  449.  
  450.  
  451. function burst(pos, m)
  452. local l = Instance.new("Part")
  453. l.Parent = j
  454. l.BrickColor = BrickColor.new("Bright blue")
  455. l.Anchored = true
  456. l.Size = Vector3.new(1, 1, 1)
  457. l.formFactor = 0
  458.  
  459. local c = Instance.new("CylinderMesh")
  460. c.Parent = l
  461. local tempacc = acc*1.2
  462. local rand = Vector3.new(math.random(-tempacc, tempacc), math.random(-tempacc, tempacc),
  463.  
  464. math.random(-tempacc, tempacc))
  465. local looky = (mod.Tipl.CFrame-mod.Tipl.CFrame.p)*Vector3.new(0, -999, 0)
  466. local a, b = Workspace:FindPartOnRay(Ray.new(mod.Tip.Position+rand, (looky), 999), j)
  467. if a then
  468. a:BreakJoints()
  469. a.Reflectance = 1
  470. a.Anchored = true
  471.  
  472. if a.Name == "Torso" or a.Name == "Head" or a.Parent:findFirstChild("Humanoid") ~= nil then
  473.  
  474. --[[For perfect shot...]]
  475.  
  476. l.CFrame = CFrame.new((a.Position+mod.Tip.Position)/2, mod.Tip.Position)*CFrame.Angles(math.pi/2,
  477.  
  478. 0, 0)
  479. c.Scale = Vector3.new(.1, (a.Position-mod.Tip.Position).magnitude, 0.1)
  480.  
  481. else
  482. c.Scale = Vector3.new(.1, (b-mod.Tip.Position).magnitude, 0.1)
  483. l.CFrame = CFrame.new((b+mod.Tip.Position+rand)/2,
  484.  
  485. mod.Tip.Position)*CFrame.Angles(math.pi/2, 0, 0)
  486. --[[a.RotVelocity = Vector3.new(math.random(-300, 300), math.random(-300, 300), math.random(-300,
  487.  
  488. 300))]]
  489.  
  490. end
  491. else
  492. c.Scale = Vector3.new(.1, (looky-mod.Tip.Position).magnitude, 0.1)
  493. l.CFrame = CFrame.new((looky+mod.Tip.Position+rand)/2, mod.Tip.Position)*CFrame.Angles(math.pi/2,
  494.  
  495. 0, 0)
  496.  
  497. end
  498. coroutine.resume(coroutine.create(function()
  499. for i=0,1,.075 do
  500. l.Transparency = i
  501. wait()
  502. end
  503. l:Remove()
  504. end))
  505.  
  506.  
  507.  
  508. end
  509.  
  510.  
  511.  
  512. time = 0.001
  513.  
  514. function dop(m)
  515. sele = true
  516.  
  517. while sele == true do
  518. if mode == "Automatic" then
  519. fire(m.Hit.p, m)
  520. shootanim()
  521. ChangeColor("Really red")
  522. time = 0.001
  523. elseif mode == "Sniper" then
  524. snipe(m.Hit.p, m)
  525. shootanim()
  526. ChangeColor("Dark green")
  527. time = 1
  528. elseif mode == "ShotGun" then
  529. scatter(m.Hit.p, m)
  530. shootanim()
  531. ChangeColor("Bright yellow")
  532. time = .4
  533. elseif mode == "Burst" then
  534. ChangeColor("Bright blue")
  535. for i=1,4 do
  536. burst(m.Hit.p, m)
  537. time = .7
  538. shootanim()
  539. wait()
  540. end
  541. elseif mode == "Flame" then
  542. flame(m.Hit.p, m)
  543. ChangeColor("Dark orange")
  544. time = .01
  545.  
  546. elseif mode == "Electric" then
  547. electic(m.Hit.p, m)
  548. ChangeColor("Institutional white")
  549. time = .1
  550.  
  551. end
  552.  
  553. wait(time)
  554. end
  555. end
  556.  
  557.  
  558.  
  559. function shootanim()
  560. for i=1,2 do
  561. flw.C0 = flw.C0*CFrame.new(0, 0, 0.3)
  562. frw.C0 = frw.C0*CFrame.new(0, 0, 0.3)
  563. wait()
  564. end
  565.  
  566. for i=1,2 do
  567. flw.C0 = flw.C0*CFrame.new(0, 0, -0.3)
  568. frw.C0 = frw.C0*CFrame.new(0, 0, -0.3)
  569. wait()
  570. end
  571. end
  572.  
  573.  
  574. function electic(pos, m)
  575. local rand = Vector3.new(math.random(-acc, acc), math.random(-acc, acc), math.random(-acc, acc))
  576. local looky = (mod.Tip.CFrame-mod.Tip.CFrame.p)*Vector3.new(0, -999, 0)
  577. local a, b = Workspace:FindPartOnRay(Ray.new(mod.Tip.Position+rand, (looky), 999), j)
  578. if a then
  579. if a.Name == "Ele" then
  580. return
  581. end
  582. elect(b)
  583. coroutine.resume(coroutine.create(function()
  584. wait((mod.Tip.Position-a.Position).magnitude/100)
  585. local last = a.Position
  586. for i=1,25 do
  587. wait()
  588. if a.Name ~= "Base" then
  589. a:BreakJoints()
  590. a.Anchored = false
  591. end
  592. local siz = a.Size + Vector3.new(3, 3, 3)
  593. local new = a.Position+Vector3.new(math.random(-siz.X/2, siz.X/2), math.random(-siz.Y/2, siz.Y/2), math.random(-siz.Z/2, siz.Z/2))
  594. Eff(last, new)
  595. wait()
  596. last = new
  597. end
  598. end))
  599.  
  600. else
  601. elect(mod.Tip.Position + ((mod.Tip.CFrame-mod.Tip.CFrame.p)*Vector3.new(0, -20, 0)))
  602. end
  603. end
  604.  
  605. function unp(m)
  606. sele = false
  607. ChangeColor("Royal blue")
  608. end
  609.  
  610. function key(k)
  611. if k == "q" then
  612. for i=1, 20 do
  613. p = Instance.new("Part", workspace)
  614. p.CFrame = CFrame.new(0, 10+i, 0)
  615. end
  616. end
  617. if k == "e" then
  618. for i=1, 1 do
  619. p = Instance.new("Part", workspace)
  620. p.CFrame = CFrame.new(0, 0, 0)
  621. p.Anchored = true
  622. p.Size = Vector3.new(5, 5, 5)
  623. end
  624. end
  625. if k == "z" then
  626. if modnum > 1 then
  627. modnum = modnum - 1
  628. mode = modes[modnum]
  629. end
  630. end
  631.  
  632. if k == "x" then
  633. if modnum < #modes then
  634. modnum = modnum + 1
  635. mode = modes[modnum]
  636. end
  637. end
  638. end
  639.  
  640. function fire(pos, m)
  641. local l = Instance.new("Part")
  642. l.Parent = j
  643. l.BrickColor = BrickColor.new("Really red")
  644. l.Anchored = true
  645. l.Size = Vector3.new(1, 1, 1)
  646. l.formFactor = 0
  647.  
  648. local c = Instance.new("CylinderMesh")
  649. c.Parent = l
  650. local rand = Vector3.new(math.random(-acc, acc), math.random(-acc, acc), math.random(-acc, acc))
  651. local looky = (mod.Tip.CFrame-mod.Tip.CFrame.p)*Vector3.new(0, -999, 0)
  652. local a, b = Workspace:FindPartOnRay(Ray.new(mod.Tip.Position+rand, (looky), 999), j)
  653. if a then
  654. a:BreakJoints()
  655. if a.Name ~= "Base" then
  656. a.Anchored = false
  657. end
  658.  
  659. if a.Name == "Torso" or a.Name == "Head" then --For perfect shot...
  660. l.CFrame = CFrame.new((a.Position+mod.Tip.Position)/2, mod.Tip.Position)*CFrame.Angles(math.pi/2,
  661.  
  662. 0, 0)
  663. c.Scale = Vector3.new(.1, (a.Position-mod.Tip.Position).magnitude, 0.1)
  664. else
  665. c.Scale = Vector3.new(.1, (b-mod.Tip.Position).magnitude, 0.1)
  666. l.CFrame = CFrame.new((b+mod.Tip.Position+rand)/2,
  667.  
  668. mod.Tip.Position)*CFrame.Angles(math.pi/2, 0, 0)
  669. end
  670. else
  671. c.Scale = Vector3.new(.1, (looky-mod.Tip.Position).magnitude, 0.1)
  672. l.CFrame = CFrame.new((looky+mod.Tip.Position+rand)/2, mod.Tip.Position)*CFrame.Angles(math.pi/2,
  673.  
  674. 0, 0)
  675.  
  676. end
  677.  
  678. coroutine.resume(coroutine.create(function()
  679. for i=0,1,.075 do
  680. l.Transparency = i
  681. wait()
  682. end
  683. l:Remove()
  684. end))
  685.  
  686. end
  687.  
  688. Colors = {"Dark orange", "Bright yellow", "Really red", "Really black"}
  689.  
  690. function flame(pos, m)
  691. local l = Instance.new("Part")
  692. l.Parent = j
  693. l.BrickColor = BrickColor.new(Colors[math.random(1, #Colors)])
  694. l.Anchored = true
  695. l.Size = Vector3.new(1, 1, 1)
  696. block(l)
  697. local f = Instance.new("Fire", l)
  698. f.Color = Color3.new(0, 0, 1)
  699.  
  700. local st = (mod.Tip.CFrame-mod.Tip.CFrame.p)*Vector3.new(math.random(-1, 1), -2, math.random(-1, 1))
  701. l.CFrame = (mod.Tip.CFrame + Vector3.new(CFrame.new(st)))
  702. --[[*CFrame.Angles(math.rad(math.random(-20, 20)), math.rad(math.random(-20, 20)), math.rad(math.random(-20, 20))) ))]]
  703.  
  704. l.CFrame = l.CFrame*CFrame.Angles(math.rad(math.random(-180, 180)), math.rad(math.random(-180, 180)), math.rad(math.random(-180, 180)))
  705.  
  706. coroutine.resume(coroutine.create(function()
  707. for i=1,math.random(6, 9) do
  708. wait()
  709. l.CFrame = l.CFrame+Vector3.new(st.X, st.Y/4, st.Z)
  710. l.CFrame = l.CFrame + Vector3.new(0, i*0.2, 0)
  711. l.CFrame = l.CFrame*CFrame.Angles(math.rad(i), math.rad(i), math.rad(i))
  712. l.Transparency = l.Transparency + 0.1
  713. local a, b = Workspace:FindPartOnRay(Ray.new(l.Position, l.CFrame.lookVector*5, 994), j)
  714. if a then
  715. if a.Name ~= "Base" then
  716. local p = Instance.new("Part")
  717. p.Parent = a
  718. p.CanCollide = false
  719. p:BreakJoints()
  720. p.Transparency = 1
  721. p.Size = Vector3.new(1, 1, 1)
  722. p.CFrame = CFrame.new(b.X, b.Y, b.Z)
  723. p.Anchored = true
  724. local f = Instance.new("Fire", p)
  725. Instance.new("Fire").Parent = a
  726. f.Color = Color3.new(0, 0, 1)
  727. a.BrickColor = BrickColor.new("Really black")
  728. a.Anchored = false
  729. a:BreakJoints()
  730. l:Remove()
  731. --weld(p, p, a, CFrame.new(b.X, b.Y, b.Z))
  732. break
  733. end
  734. end
  735. end
  736. pcall(function()
  737. l:Remove()
  738. end)
  739.  
  740. end))
  741.  
  742.  
  743. end
  744.  
  745.  
  746.  
  747. coroutine.resume(coroutine.create(function()
  748. while true do
  749. wait()
  750. local looky = (mod.Tipl.CFrame-mod.Tipl.CFrame.p)*Vector3.new(0, -999, 0)
  751.  
  752. local a, b = Workspace:FindPartOnRay(Ray.new(mod.Tipl.Position, (looky), 999), j)
  753. if a then
  754. if a.Name ~= "Ele" then
  755. las.c.Scale = Vector3.new(.1,(mod.Tipl.Position-b).magnitude, .1)
  756. las.c.Offset = Vector3.new(0, -(b - mod.Tipl.Position).magnitude/2, 0)
  757. --lasw.C0 = CFrame.new(0, (b - mod.Tipl.Position).magnitude/2, 0)
  758. lasw.C0 = CFrame.new(0, 0, 0)
  759. end
  760. else
  761. las.c.Scale = Vector3.new(.1, 1000, .1)
  762. --lasw.C0 = CFrame.new(0, 500, 0)
  763. lasw.C0 = CFrame.new(0, 0, 0)
  764. las.c.Offset = Vector3.new(0, -500, 0)
  765. end
  766.  
  767. end
  768. end))
  769.  
  770.  
  771.  
  772.  
  773. function Eff(last, rand)
  774. local p = Instance.new("Part")
  775. p.Parent = Workspace
  776. p.Name = "Ele"
  777. p.Size = Vector3.new(1, 1, 1)
  778. p.Anchored = true
  779. p.formFactor = 0
  780. p.BrickColor = BrickColor.new("Bright yellow")
  781. p.CanCollide = false
  782. local c = Instance.new("CylinderMesh")
  783. c.Parent = p
  784. c.Scale = Vector3.new(.1, (last-rand).magnitude, .1)
  785. p.CFrame = CFrame.new((last+rand)/2, last)*CFrame.Angles(math.pi/2, 0, 0)
  786. coroutine.resume(coroutine.create(function()
  787. for i=0, 1, .075 do
  788. p.Transparency = i
  789. wait()
  790. end
  791. p:Remove()
  792. end))
  793.  
  794. end
  795.  
  796.  
  797.  
  798. function elect(pos)
  799. local targ = pos
  800.  
  801. part = mod.Tip
  802. local change = 2
  803.  
  804.  
  805. local last = part.Position
  806. coroutine.resume(coroutine.create(function()
  807. while true do
  808. local fast = math.random(1, 4)
  809. if fast == 3 then
  810. wait()
  811. end
  812. local un = (targ-last).unit
  813. if (last-targ).magnitude < 10 then
  814. new = targ
  815. Eff(last, new)
  816. break
  817. else
  818. local new = last+((un*5)+Vector3.new(math.random(-change, change), math.random(-change, change), math.random(-change, change)))
  819. Eff(last, new)
  820. last = new
  821. end
  822. end
  823. end))
  824.  
  825. end
  826.  
  827.  
  828. function sel(m)
  829. rsel = true
  830.  
  831. coroutine.resume(coroutine.create(function()
  832. while true do
  833. wait()
  834.  
  835. if m.Target ~= nil then
  836. moof = m.Hit
  837.  
  838. if rsel == true then
  839. lw.C0 = CFrame.new(0, 0, 0)*CFrame.Angles(math.rad(90+moof.Y), math.rad(0), math.rad(10))
  840. rw.C0 = CFrame.new(0, 0, 0)*CFrame.Angles(math.rad(90+moof.Y), math.rad(0), math.rad(-35))
  841. end
  842. end
  843. end
  844. end))
  845.  
  846. m.Button1Down:connect(function() dop(m) end)
  847. m.Button1Up:connect(function() unp(m) end)
  848. m.KeyDown:connect(function(k) key(k) end)
  849.  
  850. end
  851. script.Parent.Selected:connect(sel) --lego
  852.  
  853. function dsel(m)
  854. rsel = false
  855.  
  856. end
  857. script.Parent.Deselected:connect(dsel) --lego
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement