Advertisement
iiWolfie

Hand Cannon (edited)

Apr 20th, 2016
311
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.19 KB | None | 0 0
  1. Players = game:GetService("Players")
  2. Me = Players.LocalPlayer
  3. Char = Me.Character
  4. necko = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
  5. ShootColors = {"Bright yellow", "New Yeller", "Bright orange", "Neon orange", "Really red", "Bright red"}
  6. PlaceId = game.PlaceId
  7.  
  8. Selected = false
  9. Attacking = false
  10. Accuracy = 5
  11. Debounce = false
  12. Hurt = false
  13. DMG = 123452323
  14.  
  15. ContentProvider = game:GetService("ContentProvider")
  16.  
  17. V3 = Vector3.new
  18. C3 = Color3.new
  19. BN = BrickColor.new
  20. CN = CFrame.new
  21. CA = CFrame.Angles
  22. MR = math.rad
  23. MRA = math.random
  24. MP = math.pi
  25. MH = math.huge
  26. UD = UDim2.new
  27.  
  28. function RC(Pos, Dir, Max, Ignore)
  29. return workspace:FindPartOnRay(Ray.new(Pos, Dir.unit * (Max or 999)), Ignore)
  30. end
  31.  
  32. function RayC(Start, En, MaxDist, Ignore)
  33. return RC(Start, (En - Start), MaxDist, Ignore)
  34. end
  35.  
  36. function ComputePos(pos1, pos2)
  37. return CN(pos1, V3(pos2.x, pos1.y, pos2.z))
  38. end
  39.  
  40. function DetectSurface(pos, part)
  41. local surface = nil
  42. local pospos = part.CFrame
  43. local pos2 = pospos:pointToObjectSpace(pos)
  44. local siz = part.Size
  45. local shaep = part.Shape
  46. if shaep == Enum.PartType.Ball or shaep == Enum.PartType.Cylinder then
  47. surface = {"Anything", CN(pospos.p, pos)*CN(0, 0, -(pospos.p - pos).magnitude)*CA(MR(-90), 0, 0)}
  48. else
  49. if pos2.Y > ((siz.Y/2)-0.04) then
  50. surface = {"Top", CA(0, 0, 0)}
  51. elseif pos2.Y < -((siz.Y/2)-0.04) then
  52. surface = {"Bottom", CA(-MP, 0, 0)}
  53. elseif pos2.X > ((siz.X/2)-0.04) then
  54. surface = {"Right", CA(0, 0, MR(-90))}
  55. elseif pos2.X < -((siz.X/2)-0.04) then
  56. surface = {"Left", CA(0, 0, MR(90))}
  57. elseif pos2.Z > ((siz.Z/2)-0.04) then
  58. surface = {"Back", CA(MR(90), 0, 0)}
  59. elseif pos2.Z < -((siz.Z/2)-0.04) then
  60. surface = {"Front", CA(MR(-90), 0, 0)}
  61. end
  62. end
  63. return surface
  64. end
  65.  
  66. function Compute(pos1, pos2)
  67. local pos3 = Vector3.new(pos2.x, pos1.y, pos2.z)
  68. return CN(pos1, pos3)
  69. end
  70.  
  71. function waitChild(n, p)
  72. local c = p:findFirstChild(n)
  73. if c then return c end
  74. while true do
  75. c = p.ChildAdded:wait()
  76. if c.Name == n then return c end
  77. end
  78. end
  79.  
  80. function Notime(func)
  81. coroutine.resume(coroutine.create(function()
  82. func()
  83. end))
  84. end
  85.  
  86. Torso = waitChild("Torso", Char)
  87. Head = waitChild("Head", Char)
  88. Rarm = waitChild("Right Arm", Char)
  89. Larm = waitChild("Left Arm", Char)
  90. Rleg = waitChild("Right Leg", Char)
  91. Lleg = waitChild("Left Leg", Char)
  92. Neck = waitChild("Neck", Torso)
  93. Hum = waitChild("Humanoid", Char)
  94.  
  95. RSH = waitChild("Right Shoulder", Torso)
  96. LSH = waitChild("Left Shoulder", Torso)
  97. RH = waitChild("Right Hip", Torso)
  98. LH = waitChild("Left Hip", Torso)
  99.  
  100. RSH.Part0 = Torso
  101. LSH.Part0 = Torso
  102. RH.Part0 = Torso
  103. LH.Part0 = Torso
  104.  
  105. Add = {
  106. Mesh = function(P, ID, Scale, Tex)
  107. local m = Instance.new("SpecialMesh")
  108. m.MeshType = "FileMesh"
  109. m.MeshId = ID or ""
  110. m.Scale = Scale or V3(1, 1, 1)
  111. m.TextureId = Tex or ""
  112. m.Parent = P
  113. return m
  114. end,
  115. Sphere = function(P, Scale)
  116. local m = Instance.new("SpecialMesh")
  117. m.MeshType = "Sphere"
  118. m.Scale = Scale or V3(1, 1, 1)
  119. m.Parent = P
  120. return m
  121. end
  122. }
  123.  
  124. Sounds = {
  125. Shoot = {Id = "http://www.roblox.com/asset/?id=2697431", Pitch = 0.3, Volume = 0.5},
  126. Boom = {Id = "http://www.roblox.com/asset/?id=2692806", Pitch = 0.55, Volume = 0.4},
  127. Slash = {Id = "rbxasset://sounds//swordslash.wav", Pitch = 0.5, Volume = 0.5},
  128. Hit = {Id = "http://www.roblox.com/asset/?id=2801263", Pitch = 0.85, Volume = 0.35},
  129. Reload = {Id = "rbxasset://sounds\\metal.ogg", Pitch = 1, Volume = 0.45},
  130. }
  131.  
  132. for _,v in pairs(Sounds) do
  133. ContentProvider:Preload(v.Id)
  134. end
  135.  
  136. function PlaySound(Sound, bool)
  137. local s = Instance.new("Sound")
  138. s.Looped = false
  139. s.Volume = Sound.Volume
  140. s.SoundId = Sound.Id
  141. if bool then
  142. s.Pitch = MRA((Sound.Pitch*0.75)*1000, (Sound.Pitch*1.15)*1000)/1000
  143. else
  144. s.Pitch = Sound.Pitch
  145. end
  146. s.PlayOnRemove = true
  147. s.Parent = Torso
  148. Notime(function()
  149. wait()
  150. s.Parent = nil
  151. end)
  152. end
  153.  
  154. function GetParts(pos, dist)
  155. local parts = {}
  156. local function o(p)
  157. for _,v in pairs(p:children()) do
  158. if v:IsA("BasePart") then
  159. if (pos - v.Position).magnitude <= dist then
  160. table.insert(parts, {v, (pos - v.Position).magnitude, v.Anchored})
  161. end
  162. end
  163. o(v)
  164. end
  165. end
  166. o(workspace)
  167. return parts
  168. end
  169.  
  170. function GetHum(P)
  171. for _,v in pairs(P:children()) do
  172. if v:IsA("Humanoid") then
  173. if v.Health > 0 then
  174. return v
  175. end
  176. end
  177. end
  178. end
  179.  
  180. function GetGroup(Pos, Distance, Hit)
  181. local tab = {}
  182. for _,v in pairs(workspace:children()) do
  183. local h = GetHum(v)
  184. local t = v:findFirstChild("Torso")
  185. if h and t and v ~= Hit.Parent then
  186. if (t.Position - Pos).magnitude <= Distance then
  187. table.insert(tab, {h, v, (t.Position - Pos).magnitude})
  188. end
  189. end
  190. end
  191. if Hit then
  192. local h = GetHum(Hit.Parent)
  193. if h then
  194. table.insert(tab, {h, Hit.Parent, 0})
  195. end
  196. end
  197. return tab
  198. end
  199.  
  200. function Tag(hum)
  201. if PlaceId == 48513881 then
  202. local tag = Instance.new("ObjectValue")
  203. tag.Name = "creator"
  204. tag.Value = Me
  205. tag.Parent = hum
  206. end
  207. end
  208.  
  209. function Part(Par, Anc, Colli, Tran, Ref, Col, Siz)
  210. local p = Instance.new("Part")
  211. p.formFactor = "Custom"
  212. p.TopSurface = 0
  213. p.BottomSurface = 0
  214. p.Transparency = Tran
  215. p.Reflectance = Ref
  216. p.Anchored = Anc
  217. p.CanCollide = Colli
  218. p.BrickColor = Col
  219. p.Size = Siz
  220. p.Locked = true
  221. p.Parent = Par
  222. p:BreakJoints()
  223. return p
  224. end
  225.  
  226. function Weld(P0, P1, C0, C1)
  227. local w = Instance.new("Weld")
  228. w.Part0 = P0
  229. w.Part1 = P1
  230. if C0 then
  231. w.C0 = C0
  232. end
  233. if C1 then
  234. w.C1 = C1
  235. end
  236. w.Parent = P0
  237. return w
  238. end
  239.  
  240. for _,v in pairs(Char:children()) do
  241. if v.Name == "Hand Cannon" then
  242. v:remove()
  243. end
  244. end
  245.  
  246. Model = Instance.new("Model")
  247. Model.Name = "Hand Cannon"
  248.  
  249. FTorso = Part(Model, false, false, 1, 0, Torso.BrickColor, V3(2, 2, 1))
  250. FW = Weld(Torso, FTorso)
  251.  
  252. RAB = Part(Model, false, false, 1, 0, BN("White"), V3(0.2, 0.2, 0.2))
  253. LAB = Part(Model, false, false, 1, 0, BN("White"), V3(0.2, 0.2, 0.2))
  254. RLB = Part(Model, false, false, 1, 0, BN("White"), V3(0.2, 0.2, 0.2))
  255. LLB = Part(Model, false, false, 1, 0, BN("White"), V3(0.2, 0.2, 0.2))
  256.  
  257. RABW = Weld(Torso, RAB, CN(), CN(-1.5, -0.5, 0))
  258. LABW = Weld(Torso, LAB, CN(), CN(1.5, -0.5, 0))
  259. RLBW = Weld(Torso, RLB, CN(), CN(-0.5, 1, 0))
  260. LLBW = Weld(Torso, LLB, CN(), CN(0.5, 1, 0))
  261.  
  262. RAW = Weld(RAB, nil, CN(), CN(0, 0.5, 0))
  263. LAW = Weld(LAB, nil, CN(), CN(0, 0.5, 0))
  264. RLW = Weld(RLB, nil, CN(), CN(0, 1, 0))
  265. LLW = Weld(LLB, nil, CN(), CN(0, 1, 0))
  266.  
  267. TW = Weld(Torso, nil, CN(0.7, 0.8, 1.2), CA(0, MR(180), MR(55)))
  268.  
  269. Weapon = Instance.new("Model")
  270. Weapon.Name = "Cannon"
  271.  
  272. HB = Part(Weapon, false, false, 1, 0, BN("White"), V3(0.2, 0.2, 0.2))
  273. HBW = Weld(Rarm, HB, CN(0, -0.7, 0), CA(0, MR(90), MR(90)))
  274. HW = Weld(HB, nil)
  275.  
  276. Handle = Part(Weapon, false, false, 0, 0, BN("Dark grey"), V3(0.5, 0.5, 0.3))
  277. Add.Mesh(Handle, "http://www.roblox.com/asset/?id=3270017", V3(1, 0.7, 2.2), "")
  278. TW.Part1 = Handle
  279.  
  280. Main = Part(Weapon, false, false, 0, 0, BN("Dark grey"), V3(1.5, 1.5, 2.5))
  281. Add.Mesh(Main, "http://www.roblox.com/asset/?id=3270017", V3(1.6, 1.6, 15), "")
  282. Weld(Handle, Main, CA(0, MR(90), MR(90)), CN(1, 0, 0.2))
  283.  
  284. Main2 = Part(Weapon, false, false, 0, 0, BN("Gun metallic"), V3(1, 1, 1.5))
  285. Add.Mesh(Main2, "http://www.roblox.com/asset/?id=3270017", V3(1.2, 1.2, 8), "")
  286. Weld(Main, Main2, CN(), CN(0, 0, 1.7))
  287.  
  288. Handle2 = Part(Weapon, false, false, 0, 0, BN("Dark grey"), V3(0.5, 0.5, 0.3))
  289. Add.Mesh(Handle2, "http://www.roblox.com/asset/?id=3270017", V3(0.7, 0.8, 2.2), "")
  290. Weld(Main2, Handle2, CA(0, MR(90), MR(90)), CN(-0.65, 0, 0))
  291.  
  292. Tip = Part(Weapon, false, false, 0, 0, BN("Earth yellow"), V3(1.6, 1.6, 0.6))
  293. Add.Sphere(Tip, V3(1.05, 1.05, 1))
  294. Weld(Main, Tip, CN(), CN(0, 0, -1.15))
  295.  
  296. Tip4 = Part(Weapon, false, false, 0, 0, BN("Black"), V3(1.2, 1.2, 0.3))
  297. Add.Mesh(Tip4, "http://www.roblox.com/asset/?id=3270017", V3(1.7, 1.7, 10), "")
  298. Weld(Main, Tip4, CN(), CN(0, 0, -0.15))
  299.  
  300. for i = 1.3, 1.45, 0.1 do
  301. local Tip3 = Part(Weapon, false, false, 0, 0, BN("Dark grey"), V3(1.2, 1.2, 0.3))
  302. Add.Mesh(Tip3, "http://www.roblox.com/asset/?id=3270017", V3(i, i, 2), "")
  303. Weld(Main2, Tip3, CN(), CN(0, 0, 0.6))
  304. end
  305.  
  306. for i = -0.95, 0.66, 1.55 do
  307. local Tip3 = Part(Weapon, false, false, 0, 0, BN("Dark Curry"), V3(1.2, 1.2, 0.3))
  308. Add.Mesh(Tip3, "http://www.roblox.com/asset/?id=3270017", V3(1.65, 1.65, 3), "")
  309. Weld(Main, Tip3, CN(), CN(0, 0, i))
  310. end
  311.  
  312. for i = 1.3, 1.5, 0.1 do
  313. local Tip2 = Part(Weapon, false, false, 0, 0, BN("Earth yellow"), V3(1.6, 1.6, 0.6))
  314. Add.Mesh(Tip2, "http://www.roblox.com/asset/?id=3270017", V3(i, i, 2), "")
  315. Weld(Main, Tip2, CN(), CN(0, 0, 1.1))
  316. end
  317.  
  318. for i = -0.3, 1, 0.15 do
  319. local p = Part(Weapon, false, false, 0.7, 0, BN("Black"), V3(0.2, 0.2, 0.2))
  320. Add.Sphere(p, V3(6, 6, 2))
  321. Weld(Main2, p, CN(0, 0, i))
  322. end
  323.  
  324. function Show_Damage(P, D)
  325. local mo = Instance.new("Model")
  326. mo.Name = "- "..D
  327. local p = Part(mo, false, false, 0, 0, BN("Bright red"), V3(0.2, 0.2, 0.2))
  328. p.Name = "Head"
  329. local m = Instance.new("SpecialMesh")
  330. m.MeshType = "Brick"
  331. m.Scale = Vector3.new(4.5, 2.3, 4.5)
  332. m.Parent = p
  333. local bp = Instance.new("BodyPosition", p)
  334. bp.maxForce = V3(MH, MH, MH)
  335. bp.P = 9001
  336. bp.position = CN(P) * CN(0, 1.5, 0).p
  337. local h = Instance.new("Humanoid")
  338. h.Health = 0
  339. h.MaxHealth = 0
  340. h.Name = "asd"
  341. h.Parent = mo
  342. local nah = true
  343. mo.Parent = workspace
  344. p.CFrame = CN(P)
  345. Notime(function()
  346. wait(1.5)
  347. for i = 0, 1, 0.05 do
  348. p.Transparency = i
  349. if nah then mo.Name = "" nah = false else mo.Name = "- "..D nah = true end
  350. wait()
  351. end
  352. mo:remove()
  353. end)
  354. end
  355.  
  356. function Kill(hit)
  357. if Debounce and Hurt then
  358. local Hu = GetHum(hit.Parent)
  359. if Hu then
  360. Debounce = false
  361. local Dmg = MRA(Damage[1], Damage[2])
  362. Hu.Health = Hu.Health - Dmg
  363. Show_Damage(Tip.Position, Dmg)
  364. PlaySound(Sounds.Hit, true)
  365. Tag(Hu)
  366. local chance = MRA(1, 10)
  367. if chance >=5 then
  368. Hu.PlatformStand = true
  369. wait(0.15)
  370. hit.Velocity = (CN(Torso.CFrame * CN(0, 0.5, 0).p, hit.Position).lookVector * 45)
  371. hit.RotVelocity = V3(MRA(-10, 10), MRA(-10, 10), MRA(-10, 10))
  372. wait(0.3)
  373. Hu.PlatformStand = false
  374. end
  375. end
  376. end
  377. end
  378.  
  379. Main.Touched:connect(Kill)
  380.  
  381. Weapon.Parent = Model
  382. Model.Parent = Char
  383.  
  384. if script.Parent.className ~= "HopperBin" then
  385. h = Instance.new("HopperBin", Me.Backpack)
  386. h.Name = "Hand Cannon"
  387. script.Parent = h
  388. end
  389.  
  390. bin = script.Parent
  391.  
  392. function Attach(t)
  393. RSH.Part0 = t
  394. LSH.Part0 = t
  395. RH.Part0 = t
  396. LH.Part0 = t
  397. RABW.Part0 = t
  398. LABW.Part0 = t
  399. LLBW.Part0 = t
  400. RLBW.Part0 = t
  401. if t == Torso then
  402. FTorso.Transparency = 1
  403. else
  404. Torso.Transparency = 1
  405. end
  406. t.Transparency = 0
  407. end
  408.  
  409. function SelectAnim()
  410. RAW.Part1 = Rarm
  411. for i = 0.25, 1, 0.25 do
  412. RAW.C0 = CA(MR(-10*i), 0, MR(-5*i))
  413. wait()
  414. end
  415. for i = 0.1, 1, 0.1 do
  416. RAW.C0 = CA(MR(-10-90*i), 0, MR(-5-30*i))
  417. wait()
  418. end
  419. for i = 0.5, 1, 0.5 do
  420. RAW.C0 = CA(MR(-100-5*i), 0, MR(-35))
  421. wait()
  422. end
  423. HW.Part1 = Handle
  424. HW.C0 = CA(MR(50), 0, MR(-37))
  425. TW.Part1 = nil
  426. Attach(FTorso)
  427. LAW.Part1 = Larm
  428. for i = 0.25, 1, 0.25 do
  429. RAW.C0 = CA(MR(-105+10*i), 0, MR(-35+5*i))
  430. LAW.C0 = CA(MR(15*i), 0, MR(5*i))
  431. FW.C0 = CA(0, MR(-5*i), 0)
  432. HW.C0 = CA(MR(50-5*i), 0, MR(-37))
  433. wait()
  434. end
  435. for i = 0.06, 1, 0.06 do
  436. RAW.C0 = CA(MR(-95+95*i), MR(35*i), MR(-30+50*i))
  437. LAW.C0 = CA(MR(15+25*i), 0, MR(5+15*i)) * CN(0, -0.4*i, 0)
  438. FW.C0 = CA(0, MR(-5-30*i), 0)
  439. HW.C0 = CA(MR(45), 0, MR(-37+15*i))
  440. wait()
  441. end
  442. Hum.WalkSpeed = 10
  443. for i = 0.1, 1, 0.1 do
  444. RAW.C0 = CA(MR(15*i), MR(35+10*i), MR(20+8*i))
  445. LAW.C0 = CA(MR(40+7*i), 0, MR(20+6*i)) * CN(0, -0.4-0.2*i, 0)
  446. FW.C0 = CA(0, MR(-35-10*i), 0)
  447. HW.C0 = CA(MR(45-11*i), 0, MR(-22+15*i))
  448. wait()
  449. end
  450. for i = 0.25, 1, 0.25 do
  451. RAW.C0 = CA(MR(15+5*i), MR(45+5*i), MR(28+2*i))
  452. LAW.C0 = CA(MR(47+3*i), 0, MR(26+4*i)) * CN(0, -0.6, 0)
  453. FW.C0 = CA(0, MR(-45-5*i), 0)
  454. HW.C0 = CA(MR(34-4*i), 0, MR(-7+7*i))
  455. wait()
  456. end
  457. end
  458.  
  459. function DeselAnim()
  460. for i = 0.25, 1, 0.25 do
  461. RAW.C0 = CA(MR(20-5*i), MR(50-5*i), MR(30-5*i))
  462. LAW.C0 = CA(MR(50-5*i), 0, MR(30-5*i)) * CN(0, -0.6+0.1*i, 0)
  463. FW.C0 = CA(0, MR(-50+5*i), 0)
  464. HW.C0 = CA(MR(30+5*i), 0, MR(-10*i))
  465. wait()
  466. end
  467. for i = 0.15, 1, 0.15 do
  468. RAW.C0 = CA(MR(15-30*i), MR(45-10*i), MR(25-5*i))
  469. LAW.C0 = CA(MR(45-20*i), 0, MR(25-15*i)) * CN(0, -0.5+0.2*i, 0)
  470. FW.C0 = CA(0, MR(-45+10*i), 0)
  471. HW.C0 = CA(MR(35+10*i), 0, MR(-10-15*i))
  472. wait()
  473. end
  474. for i = 0.12, 1, 0.12 do
  475. RAW.C0 = CA(MR(-15-70*i), MR(35-30*i), MR(20-30*i))
  476. LAW.C0 = CA(MR(25-25*i), 0, MR(10-10*i)) * CN(0, -0.3+0.3*i, 0)
  477. FW.C0 = CA(0, MR(-35+20*i), 0)
  478. HW.C0 = CA(MR(45+5*i), 0, MR(-25-12*i))
  479. wait()
  480. end
  481. LAW.Part1 = nil
  482. HW.C0 = CA(MR(50), 0, MR(-37))
  483. for i = 0.25, 1, 0.25 do
  484. RAW.C0 = CA(MR(-85-20*i), MR(5-5*i), MR(-10-25*i))
  485. FW.C0 = CA(0, MR(-15+15*i), 0)
  486. wait()
  487. end
  488. Attach(Torso)
  489. HW.Part1 = nil
  490. TW.Part1 = Handle
  491. Hum.WalkSpeed = 50
  492. for i = 0.15, 1, 0.15 do
  493. RAW.C0 = CA(MR(-105+95*i), 0, MR(-35+30*i))
  494. wait()
  495. end
  496. for i = 0.33, 1, 0.33 do
  497. RAW.C0 = CA(MR(-10+10*i), 0, MR(-5+5*i))
  498. wait()
  499. end
  500. RAW.Part1 = nil
  501. end
  502.  
  503. --Norms:
  504. --RAW.C0 = CA(MR(20), MR(50), MR(30))
  505. --LAW.C0 = CA(MR(50), 0, MR(30)) * CN(0, -0.6, 0)
  506. --FW.C0 = CA(0, MR(-50), 0)
  507. --HW.C0 = CA(MR(30), 0, 0)
  508. --
  509. --
  510.  
  511. function Explode(Par, Pos, surface)
  512. Notime(function()
  513. local cf = CN(Pos) * CA(Par.CFrame:toEulerAnglesXYZ()) * surface[2] * CN(0, 1, 0)
  514. if surface[1] == "Anything" then
  515. cf = surface[2]
  516. end
  517. local col = Par.BrickColor.Color
  518. local r, g, b = col.r, col.g, col.b
  519. local col1, col2, col3 = C3(MRA(r*60, r*100)/100, MRA(g*60, g*100)/100, MRA(b*60, b*100)/100), C3(MRA(r*60, r*100)/100, MRA(g*60, g*100)/100, MRA(b*60, b*100)/100), C3(MRA(r*60, r*100)/100, MRA(g*60, g*100)/100, MRA(b*60, b*100)/100)
  520. local p = Part(workspace, true, false, 0, 0, BN(col1.r, col1.g, col1.b), V3(0.2, 0.2, 0.2))
  521. local p2 = Part(workspace, true, false, 0, 0, BN(col2.r, col2.g, col2.b), V3(0.2, 0.2, 0.2))
  522. local p3 = Part(workspace, true, false, 0, 0, BN(col3.r, col3.g, col3.b), V3(0.2, 0.2, 0.2))
  523. p.CFrame = cf
  524. p2.CFrame = cf
  525. p3.CFrame = cf
  526. local m = Add.Mesh(p, "http://www.roblox.com/asset/?id=20329976", V3(1, 1, 1))
  527. local m2 = Add.Mesh(p2, "http://www.roblox.com/asset/?id=20329976", V3(1, 1, 1))
  528. local m3 = Add.Mesh(p3, "http://www.roblox.com/asset/?id=20329976", V3(1, 1, 1))
  529. for i = -0.2, 1, 0.12 do
  530. p2.Transparency = i+0.1
  531. p.Transparency = i
  532. p3.Transparency = i+0.2
  533. m.Scale = V3(1+2.5*i, 1.4+1*i, 1+2.5*i)
  534. m2.Scale = V3(0.8+2*i, 1.2+1*i, 0.8+2*i)
  535. m3.Scale = V3(0.5+1*i, 1+1*i, 0.5+1*i)
  536. wait()
  537. end
  538. p2:remove()
  539. p3:remove()
  540. p:remove()
  541. end)
  542. end
  543.  
  544. function Shoot(Pos)
  545. coroutine.resume(coroutine.create(function()
  546. local acc = Accuracy*100
  547. local Start = Main2.CFrame * CN(0, 0, -0.5).p
  548. local Face = CN(Start, Pos) * CA(MR(MRA(-acc, acc))/100, MR(MRA(-acc, acc))/100, MR(MRA(-acc, acc))/100)
  549. local Cannonball = Part(Model, true, false, 0, 0, BN("Black"), V3(1.3, 1.3, 1.3))
  550. Add.Sphere(Cannonball)
  551. Cannonball.CFrame = Face
  552. local Go = 3
  553. local Drop = 0.55/(Go*3)
  554. local Dist = 500
  555. local lastP = Start
  556. local omg = 0
  557. for i = Go, Dist, Go do
  558. Drop = Drop + 1/(Go*3)
  559. omg = omg + Drop
  560. local dropping = CA(MR(-Drop), 0, 0)
  561. if omg > 130 then
  562. dropping = CN()
  563. end
  564. Face = Face * dropping * CN(0, 0, -Go)
  565. Cannonball.CFrame = Face
  566. local Magn = (Face.p - lastP).magnitude
  567. local T = Part(Model, true, false, 0.1, 0, BN("Mid gray"), V3(0.2, 1, 0.2))
  568. local M = Instance.new("SpecialMesh",T)
  569. M.MeshType = "Head"
  570. M.Scale = V3(5, Magn, 5)
  571. T.CFrame = CN(lastP, Face.p) * CA(MR(-90), 0, 0) * CN(0, Magn/2, 0)
  572. Notime(function()
  573. wait(0.1)
  574. for i = 0.1, 1, 0.1 do
  575. T.Transparency = i+0.1
  576. M.Scale = V3(5-5*i, Magn+0.5, 5-5*i)
  577. wait()
  578. end
  579. T:remove()
  580. end)
  581. local Hit, Hitpos = RayC(lastP, Face.p, Go*2, Char)
  582. lastP = Face.p
  583. if Hit then
  584. PlaySound(Sounds.Boom, true)
  585. local s = DetectSurface(Hitpos, Hit)
  586. Explode(Hit, Hitpos, s)
  587. Cannonball.CFrame = CN(Hitpos)
  588. local hu = GetHum(Hit.Parent)
  589. if hu == nil and Hit.Parent.className ~= "Hat" and Hit.Anchored then
  590. coroutine.resume(coroutine.create(function()
  591. wait(10)
  592. for i = 0, 1, 0.04 do
  593. Cannonball.Transparency = i
  594. wait()
  595. end
  596. Cannonball:remove()
  597. end))
  598. else
  599. Cannonball:remove()
  600. end
  601. local Noobs = GetGroup(Hitpos, 5, Hit)
  602. for _,v in pairs(Noobs) do
  603. local dm = 60/((v[3]+3)/3)
  604. dm = MRA(dm*0.9, dm*1.04)
  605. v[1].Health = v[1].Health - dm
  606. local t = v[2]:findFirstChild("Head")
  607. if t then
  608. Show_Damage(t.Position, dm)
  609. end
  610. pcall(function()
  611. Tag(v[1])
  612. end)
  613. end
  614. local Parts = GetParts(Hitpos, 7)
  615. for _,v in pairs(Parts) do
  616. if v[3] == false then
  617. Notime(function()
  618. if v[1].Name == "Brick wall" then
  619. v[1]:BreakJoints()
  620. v[1].Velocity = (CN(Hitpos, v[1].Position).lookVector * (110/((v[2]+2)/3)))
  621. wait(0.1)
  622. v[1].Velocity = (CN(Hitpos, v[1].Position).lookVector * (110/((v[2]+2)/3)))
  623. else
  624. v[1].Velocity = (CN(Hitpos, v[1].Position).lookVector * (80/((v[2]+2)/3)))
  625. end
  626. end)
  627. end
  628. end
  629. break
  630. end
  631. wait()
  632. end
  633. end))
  634. end
  635.  
  636. function ShootAnim(pos)
  637. RLW.Part1 = Rleg
  638. LLW.Part1 = Lleg
  639. local cf = ComputePos(Torso.Position, pos)
  640. local bp = Instance.new("BodyPosition",Torso)
  641. bp.maxForce = V3(MH, 0, MH)
  642. bp.P = 10000
  643. PlaySound(Sounds.Shoot, true)
  644. local effect = Part(Model, false, false, 0, 0, BN(ShootColors[MRA(1,#ShootColors)]), V3(0.2, 0.2, 0.2))
  645. local effect2 = Part(Model, false, false, 0, 0, BN(ShootColors[MRA(1,#ShootColors)]), V3(0.2, 0.2, 0.2))
  646. local m1 = Add.Mesh(effect, "http://www.roblox.com/asset/?id=20329976", V3(1,1,1))
  647. local m2 = Add.Mesh(effect2, "http://www.roblox.com/asset/?id=20329976", V3(1,1,1))
  648. local w1 = Weld(Main2, effect, CA(MR(-90), 0, 0), CN(0, -1, 0))
  649. local w2 = Weld(Main2, effect2, CA(MR(-90), 0, 0), CN(0, -1, 0))
  650. for i = 0, 1, 0.5 do
  651. RAW.C0 = CA(MR(20-50*i), MR(50-25*i), MR(30+45*i))
  652. LAW.C0 = CA(MR(50-10*i), 0, MR(30+20*i)) * CN(0, -0.6-0.3*i, 0)
  653. RLW.C0 = CA(MR(30*i), 0, MR(-15*i))
  654. LLW.C0 = CA(MR(10*i), 0, MR(-35*i))
  655. FW.C0 = CA(MR(5*i), MR(-50-15*i), 0)
  656. HW.C0 = CA(MR(30), MR(35*i), MR(-25*i))
  657. Neck.C0 = necko * CA(MR(10*i), 0, 0)
  658. bp.position = cf * CN(0, 0, 3*i).p
  659. m1.Scale = V3(0.5+0.6*i, 0.4+0.2*i, 0.5+0.6*i)
  660. m2.Scale = V3(0.3+0.5*i, 0.5+1*i, 0.3+0.5*i)
  661. w1.C1 = CN(0, -1-0.2*i, 0)
  662. w2.C1 = CN(0, -1-0.5*i, 0)
  663. effect.Transparency = 0.2*i
  664. effect2.Transparency = 0.2*i
  665. wait()
  666. end
  667. for i = 0.2, 1, 0.2 do
  668. RAW.C0 = CA(MR(-30-10*i), MR(25-5*i), MR(75+5*i))
  669. LAW.C0 = CA(MR(40-5*i), 0, MR(50+5*i)) * CN(0, -0.9-0.05*i, 0)
  670. RLW.C0 = CA(MR(30+5*i), 0, MR(-15))
  671. LLW.C0 = CA(MR(10+5*i), 0, MR(-35-5*i))
  672. FW.C0 = CA(MR(5+5*i), MR(-65-5*i), 0)
  673. HW.C0 = CA(MR(30), MR(35+5*i), MR(-25-5*i))
  674. Neck.C0 = necko * CA(MR(10+5*i), 0, 0)
  675. bp.position = cf * CN(0, 0, 3+1*i).p
  676. m1.Scale = V3(1+1*i, 0.7+0.9*i, 1+1*i)
  677. m2.Scale = V3(0.8+0.6*i, 1.5+1.6*i, 0.8+0.6*i)
  678. w1.C1 = CN(0, -1.2-0.6*i, 0)
  679. w2.C1 = CN(0, -1.5-1.8*i, 0)
  680. effect.Transparency = 0.2+0.9*i
  681. effect2.Transparency = 0.2+0.9*i
  682. wait()
  683. end
  684. effect:remove()
  685. effect2:remove()
  686. for i = 0.2, 1, 0.2 do
  687. bp.position = cf * CN(0, 0, 4+0.8*i).p
  688. wait()
  689. end
  690. for i = 0.08, 1, 0.06 do
  691. RAW.C0 = CA(MR(-40+50*i), MR(20+15*i), MR(80-35*i))
  692. LAW.C0 = CA(MR(35-30*i), 0, MR(55-45*i)) * CN(0, -0.95+0.5*i, 0)
  693. RLW.C0 = CA(MR(35-35*i), 0, MR(-15+25*i))
  694. LLW.C0 = CA(MR(15-15*i), 0, MR(-40+30*i))
  695. FW.C0 = CA(MR(10-7*i), MR(-70+40*i), 0)
  696. HW.C0 = CA(MR(30), MR(40-40*i), MR(-30-10*i))
  697. Neck.C0 = necko * CA(MR(15+5*i), 0, MR(20*i))
  698. bp.position = cf * CN(0, 0, 4.8+0.8*i).p
  699. wait()
  700. end
  701. bp:remove()
  702. for i = 0.33, 1, 0.33 do
  703. RAW.C0 = CA(MR(10+10*i), MR(35+5*i), MR(45-5*i))
  704. LAW.C0 = CA(MR(5), 0, MR(10)) * CN(0, -0.45+0.1*i, 0)
  705. FW.C0 = CA(MR(3-3*i), MR(-30+5*i), 0)
  706. HW.C0 = CA(MR(30), 0, MR(-40-10*i))
  707. wait()
  708. end
  709. for i = 0.12, 1, 0.12 do
  710. RAW.C0 = CA(MR(20+5*i), MR(40+5*i), MR(40+5*i))
  711. LAW.C0 = CA(MR(5), 0, MR(10)) * CN(0, -0.35-0.3*i, 0)
  712. FW.C0 = CA(0, MR(-25+5*i), 0)
  713. HW.C0 = CA(MR(30), 0, MR(-50-5*i))
  714. wait()
  715. end
  716. local b = Part(Model, false, false, 0, 0, BN("Black"), V3(1.1, 1.1, 1.1))
  717. local m = Add.Sphere(b)
  718. local w = Weld(Larm, b, CN(), CN(0, 1.4, 0))
  719. for i = 0.16, 1, 0.16 do
  720. LAW.C0 = CA(MR(5+30*i), 0, MR(10+10*i)) * CN(0, -0.65+0.65*i, 0)
  721. RAW.C0 = CA(MR(25), MR(45+3*i), MR(40))
  722. m.Scale = V3(0.5+0.5*i, 0.5+0.5*i, 0.5+0.5*i)
  723. Neck.C0 = necko * CA(MR(20-10*i), 0, MR(20-15*i))
  724. wait()
  725. end
  726. for i = 0.1, 1, 0.1 do
  727. LAW.C0 = CA(MR(35+105*i), 0, MR(20+20*i)) * CN(0, -0.9*i, 0)
  728. RAW.C0 = CA(MR(25), MR(48+6*i), MR(40))
  729. Neck.C0 = necko * CA(MR(10-10*i), 0, MR(5-35*i))
  730. wait()
  731. end
  732. for i = 0.16, 1, 0.16 do
  733. LAW.C0 = CA(MR(140-10*i), 0, MR(40-15*i)) * CN(0, -0.9-0.2*i, 0)
  734. RAW.C0 = CA(MR(25), MR(54), MR(40))
  735. Neck.C0 = necko * CA(MR(5*i), 0, MR(-30))
  736. w.C0 = CN(1.5*i, 0.55*i, 1.1*i)
  737. wait()
  738. end
  739. PlaySound(Sounds.Reload, true)
  740. b:remove()
  741. w:remove()
  742. for i = 0.2, 1, 0.2 do
  743. LAW.C0 = CA(MR(130-10*i), 0, MR(25-15*i)) * CN(0, -1.1+0.2*i, 0)
  744. RAW.C0 = CA(MR(25-10*i), MR(54), MR(40))
  745. Neck.C0 = necko * CA(MR(5-3*i), 0, MR(-30+5*i))
  746. HW.C0 = CA(MR(30), 0, MR(-55+10*i))
  747. FW.C0 = CA(0, MR(-20-5*i), 0)
  748. wait()
  749. end
  750. for i = 0.11, 1, 0.11 do
  751. LAW.C0 = CA(MR(120-60*i), 0, MR(10+15*i)) * CN(0, -0.9+0.3*i, 0)
  752. RAW.C0 = CA(MR(15+5*i), MR(54-4*i), MR(40-10*i))
  753. Neck.C0 = necko * CA(MR(2-2*i), 0, MR(-25+25*i))
  754. HW.C0 = CA(MR(30), 0, MR(-45+45*i))
  755. FW.C0 = CA(0, MR(-25-20*i), 0)
  756. RLW.C0 = CA(0, 0, MR(10-8*i))
  757. LLW.C0 = CA(0, 0, MR(-10+8*i))
  758. wait()
  759. end
  760. Neck.C0 = necko
  761. for i = 0.25, 1, 0.25 do
  762. LAW.C0 = CA(MR(60-10*i), 0, MR(25+5*i)) * CN(0, -0.6, 0)
  763. RAW.C0 = CA(MR(20), MR(50), MR(30))
  764. HW.C0 = CA(MR(30), 0, 0)
  765. FW.C0 = CA(0, MR(-45-5*i), 0)
  766. RLW.C0 = CA(0, 0, MR(2-2*i))
  767. LLW.C0 = CA(0, 0, MR(-2+2*i))
  768. wait()
  769. end
  770. RLW.Part1 = nil
  771. LLW.Part1 = nil
  772. RAW.C0 = CA(MR(20), MR(50), MR(30))
  773. LAW.C0 = CA(MR(50), 0, MR(30)) * CN(0, -0.6, 0)
  774. FW.C0 = CA(0, MR(-50), 0)
  775. HW.C0 = CA(MR(30), 0, 0)
  776. Neck.C0 = necko
  777. end
  778.  
  779. function Melee()
  780. PlaySound(Sounds.Slash, true)
  781. for i = 0.25, 1, 0.25 do
  782. RAW.C0 = CA(MR(20+5*i), MR(50-5*i), MR(30+3*i))
  783. LAW.C0 = CA(MR(50), 0, MR(30+4*i)) * CN(0, -0.6-0.05*i, 0)
  784. HW.C0 = CA(MR(30), MR(5*i), 0)
  785. FW.C0 = CA(0, MR(-50-5*i), 0)
  786. wait()
  787. end
  788. for i = 0.12, 1, 0.12 do
  789. RAW.C0 = CA(MR(25+25*i), MR(45-30*i), MR(33+7*i))
  790. LAW.C0 = CA(MR(50), 0, MR(34+11*i)) * CN(0, -0.65-0.25*i, 0)
  791. HW.C0 = CA(MR(30), MR(5+25*i), 0)
  792. FW.C0 = CA(0, MR(-55-25*i), 0)
  793. wait()
  794. end
  795. for i = 0.33, 1, 0.33 do
  796. RAW.C0 = CA(MR(50+15*i), MR(15-5*i), MR(40-10*i)) * CN(0, -0.2*i, 0)
  797. LAW.C0 = CA(MR(50+10*i), 0, MR(45-5*i)) * CN(0, -0.9+0.15*i, 0)
  798. HW.C0 = CA(MR(30+2*i), MR(30+5*i), 0)
  799. FW.C0 = CA(0, MR(-80+10*i), MR(-5*i))
  800. wait()
  801. end
  802. Hurt = true
  803. Debounce = true
  804. for i = 0.07, 1, 0.07 do
  805. RAW.C0 = CA(MR(65+55*i), MR(10), MR(30-70*i)) * CN(0, -0.2-1.1*i, 0)
  806. LAW.C0 = CA(MR(60+120*i), 0, MR(40-70*i)) * CN(0, -0.75+0.7*i, 0)
  807. HW.C0 = CA(MR(32+6*i), MR(35+20*i), MR(-4*i))
  808. FW.C0 = CA(0, MR(-70+110*i), 0)
  809. wait()
  810. end
  811. for i = 0.16, 1, 0.16 do
  812. RAW.C0 = CA(MR(120+10*i), MR(10), MR(-40-5*i)) * CN(0, -1.3-0.1*i, 0)
  813. LAW.C0 = CA(MR(180+15*i), 0, MR(-30-20*i)) * CN(0, -0.05+0.1*i, 0)
  814. HW.C0 = CA(MR(38+2*i), MR(55-6*i), MR(-4-1*i))
  815. FW.C0 = CA(0, MR(40+10*i), 0)
  816. wait()
  817. end
  818. Hurt = false
  819. for i = 0.2, 1, 0.2 do
  820. RAW.C0 = CA(MR(130+5*i), MR(10), MR(-45-2*i)) * CN(0, -1.4-0.05*i, 0)
  821. LAW.C0 = CA(MR(195+5*i), 0, MR(-50-8*i)) * CN(0, 0.05+0.05*i, 0)
  822. HW.C0 = CA(MR(40), MR(49-2*i), MR(-5))
  823. FW.C0 = CA(0, MR(50+3*i), 0)
  824. wait()
  825. end
  826. wait(0.2)
  827. for i = 0.2, 1, 0.2 do
  828. RAW.C0 = CA(MR(135-10*i), MR(10+5*i), MR(-47+10*i)) * CN(0, -1.45+0.25*i, 0)
  829. LAW.C0 = CA(MR(200-10*i), 0, MR(-58+10*i)) * CN(0, 0.1-0.1*i, 0)
  830. HW.C0 = CA(MR(40), MR(47-5*i), MR(-5+5*i))
  831. FW.C0 = CA(0, MR(53-10*i), 0)
  832. wait()
  833. end
  834. for i = 0.08, 1, 0.08 do
  835. RAW.C0 = CA(MR(125-90*i), MR(15+30*i), MR(-37+57*i)) * CN(0, -1.2+1.1*i, 0)
  836. LAW.C0 = CA(MR(190-125*i), 0, MR(-48+68*i)) * CN(0, -0.5*i, 0)
  837. HW.C0 = CA(MR(40-7*i), MR(42-37*i), 0)
  838. FW.C0 = CA(0, MR(43-82*i), 0)
  839. wait()
  840. end
  841. for i = 0.2, 1, 0.2 do
  842. RAW.C0 = CA(MR(35-15*i), MR(45+5*i), MR(20+10*i)) * CN(0, -0.1+0.1*i, 0)
  843. LAW.C0 = CA(MR(65-15*i), 0, MR(20+10*i)) * CN(0, -0.5-0.1*i, 0)
  844. HW.C0 = CA(MR(33-3*i), MR(5-5*i), 0)
  845. FW.C0 = CA(0, MR(-41-9*i), 0)
  846. wait()
  847. end
  848. RLW.Part1 = nil
  849. LLW.Part1 = nil
  850. RAW.C0 = CA(MR(20), MR(50), MR(30))
  851. LAW.C0 = CA(MR(50), 0, MR(30)) * CN(0, -0.6, 0)
  852. FW.C0 = CA(0, MR(-50), 0)
  853. HW.C0 = CA(MR(30), 0, 0)
  854. Neck.C0 = necko
  855. end
  856.  
  857. function onSelected(mouse)
  858. SelectAnim()
  859. Selected = true
  860. mouse.Button1Down:connect(function()
  861. if Attacking == false then
  862. Attacking = true
  863. mouse.Button1Up:wait()
  864. Shoot(mouse.Hit.p)
  865. ShootAnim(mouse.Hit.p)
  866. Attacking = false
  867. end
  868. end)
  869. mouse.KeyDown:connect(function(key)
  870. key = key:lower()
  871. if key == "q" then
  872. if Attacking == false then
  873. Attacking = true
  874. Melee()
  875. Attacking = false
  876. end
  877. end
  878. end)
  879. end
  880.  
  881. function onDeselected(mouse)
  882. Selected = true
  883. DeselAnim()
  884. end
  885.  
  886. bin.Selected:connect(onSelected)
  887. bin.Deselected:connect(onDeselected)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement