Advertisement
memberhero

Cannon Script Test 1

Nov 24th, 2020 (edited)
373
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.70 KB | None | 0 0
  1. if (game:GetService('RunService'):IsServer()) then return error('This script cannot be ran server-sided, please use hl/',0); end;
  2.  
  3. local remote = NS ([=[
  4.  
  5.  
  6.  
  7. Players = game:GetService("Players")
  8. Me = owner
  9. Char = Me.Character
  10. necko = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
  11. ShootColors = {"Bright yellow", "New Yeller", "Bright orange", "Neon orange", "Really red", "Bright red"}
  12. PlaceId = game.PlaceId
  13.  
  14. Selected = false
  15. Attacking = false
  16. Accuracy = 5
  17. Debounce = true
  18. Hurt = false
  19. Damage = {100,1337}
  20.  
  21. ContentProvider = game:GetService("ContentProvider")
  22.  
  23. V3 = Vector3.new
  24. C3 = Color3.new
  25. BN = BrickColor.new
  26. CN = CFrame.new
  27. CA = CFrame.Angles
  28. MR = math.rad
  29. MRA = math.random
  30. MP = math.pi
  31. MH = math.huge
  32. UD = UDim2.new
  33.  
  34. function RC(Pos, Dir, Max, Ignore)
  35. return workspace:FindPartOnRay(Ray.new(Pos, Dir.unit * (Max or 999)), Ignore)
  36. end
  37.  
  38. function RayC(Start, En, MaxDist, Ignore)
  39. return RC(Start, (En - Start), MaxDist, Ignore)
  40. end
  41.  
  42. function ComputePos(pos1, pos2)
  43.  
  44. end
  45.  
  46. function DetectSurface(pos, part)
  47. local surface = nil
  48. local pospos = part.CFrame
  49. local pos2 = pospos:pointToObjectSpace(pos)
  50. local siz = part.Size
  51. local shaep = part.Shape
  52. if shaep == Enum.PartType.Ball or shaep == Enum.PartType.Cylinder then
  53. surface = {"Anything", CN(pospos.p, pos)*CN(0, 0, -(pospos.p - pos).magnitude)*CA(MR(-90), 0, 0)}
  54. else
  55. if pos2.Y > ((siz.Y/2)-0.04) then
  56. surface = {"Top", CA(0, 0, 0)}
  57. elseif pos2.Y < -((siz.Y/2)-0.04) then
  58. surface = {"Bottom", CA(-MP, 0, 0)}
  59. elseif pos2.X > ((siz.X/2)-0.04) then
  60. surface = {"Right", CA(0, 0, MR(-90))}
  61. elseif pos2.X < -((siz.X/2)-0.04) then
  62. surface = {"Left", CA(0, 0, MR(90))}
  63. elseif pos2.Z > ((siz.Z/2)-0.04) then
  64. surface = {"Back", CA(MR(90), 0, 0)}
  65. elseif pos2.Z < -((siz.Z/2)-0.04) then
  66. surface = {"Front", CA(MR(-90), 0, 0)}
  67. end
  68. end
  69. return surface
  70. end
  71.  
  72. function Compute(pos1, pos2)
  73. local pos3 = Vector3.new(pos2.x, pos1.y, pos2.z)
  74. return CN(pos1, pos3)
  75. end
  76.  
  77. function waitChild(n, p)
  78. local c = p:findFirstChild(n)
  79. if c then return c end
  80. while true do
  81. c = p.ChildAdded:wait()
  82. if c.Name == n then return c end
  83. end
  84. end
  85.  
  86. function Notime(func)
  87. coroutine.resume(coroutine.create(function()
  88. func()
  89. end))
  90. end
  91.  
  92. Torso = waitChild("Torso", Char)
  93. Head = waitChild("Head", Char)
  94. Rarm = waitChild("Right Arm", Char)
  95. Larm = waitChild("Left Arm", Char)
  96. Rleg = waitChild("Right Leg", Char)
  97. Lleg = waitChild("Left Leg", Char)
  98. Neck = waitChild("Neck", Torso)
  99. Hum = waitChild("Humanoid", Char)
  100.  
  101. RSH = waitChild("Right Shoulder", Torso)
  102. LSH = waitChild("Left Shoulder", Torso)
  103. RH = waitChild("Right Hip", Torso)
  104. LH = waitChild("Left Hip", Torso)
  105.  
  106. RSH.Part0 = Torso
  107. LSH.Part0 = Torso
  108. RH.Part0 = Torso
  109. LH.Part0 = Torso
  110.  
  111. Add = {
  112. Mesh = function(P, ID, Scale, Tex)
  113. local m = Instance.new("SpecialMesh")
  114. m.MeshType = "FileMesh"
  115. m.MeshId = ID or ""
  116. m.Scale = Scale or V3(1, 1, 1)
  117. m.TextureId = Tex or ""
  118. m.Parent = P
  119. return m
  120. end,
  121. Sphere = function(P, Scale)
  122. local m = Instance.new("SpecialMesh")
  123. m.MeshType = "Sphere"
  124. m.Scale = Scale or V3(1, 1, 1)
  125. m.Parent = P
  126. return m
  127. end
  128. }
  129.  
  130. Sounds = {
  131. Shoot = {Id = "http://www.roblox.com/asset/?id=2697431", Pitch = 0.3, Volume = 0.5},
  132. Boom = {Id = "http://www.roblox.com/asset/?id=2692806", Pitch = 0.55, Volume = 0.4},
  133. Slash = {Id = "rbxasset://sounds//swordslash.wav", Pitch = 0.5, Volume = 0.5},
  134. Hit = {Id = "http://www.roblox.com/asset/?id=2801263", Pitch = 0.85, Volume = 0.35},
  135. Reload = {Id = "rbxasset://sounds\\metal.ogg", Pitch = 1, Volume = 0.45},
  136. }
  137.  
  138. for _,v in pairs(Sounds) do
  139. ContentProvider:Preload(v.Id)
  140. end
  141.  
  142. function PlaySound(Sound, bool)
  143. local s = Instance.new("Sound")
  144. s.Looped = false
  145. s.Volume = Sound.Volume
  146. s.SoundId = Sound.Id
  147. if bool then
  148. s.Pitch = MRA((Sound.Pitch*0.75)*1000, (Sound.Pitch*1.15)*1000)/1000
  149. else
  150. s.Pitch = Sound.Pitch
  151. end
  152. s.PlayOnRemove = true
  153. s.Parent = Torso
  154. Notime(function()
  155. wait()
  156. s.Parent = nil
  157. end)
  158. end
  159.  
  160. function GetParts(pos, dist)
  161. local parts = {}
  162. local function o(p)
  163. for _,v in pairs(p:children()) do
  164. if v:IsA("BasePart") then
  165. if (pos - v.Position).magnitude <= dist then
  166. table.insert(parts, {v, (pos - v.Position).magnitude, v.Anchored})
  167. end
  168. end
  169. o(v)
  170. end
  171. end
  172. o(workspace)
  173. return parts
  174. end
  175.  
  176. function GetHum(P)
  177. for _,v in pairs(P:children()) do
  178. if v:IsA("Humanoid") then
  179. if v.Health > 0 then
  180. return v
  181. end
  182. end
  183. end
  184. end
  185.  
  186. function GetGroup(Pos, Distance, Hit)
  187. local tab = {}
  188. for _,v in pairs(workspace:children()) do
  189. local h = GetHum(v)
  190. local t = v:findFirstChild("Torso")
  191. if h and t and v ~= Hit.Parent then
  192. if (t.Position - Pos).magnitude <= Distance then
  193. table.insert(tab, {h, v, (t.Position - Pos).magnitude})
  194. end
  195. end
  196. end
  197. if Hit then
  198. local h = GetHum(Hit.Parent)
  199. if h then
  200. table.insert(tab, {h, Hit.Parent, 0})
  201. end
  202. end
  203. return tab
  204. end
  205.  
  206. function Tag(hum)
  207. if PlaceId == 48513881 then
  208. local tag = Instance.new("ObjectValue")
  209. tag.Name = "creator"
  210. tag.Value = Me
  211. tag.Parent = hum
  212. end
  213. end
  214.  
  215. function Part(Par, Anc, Colli, Tran, Ref, Col, Siz)
  216. local p = Instance.new("Part")
  217. p.formFactor = "Custom"
  218. p.TopSurface = 0
  219. p.BottomSurface = 0
  220. p.Transparency = Tran
  221. p.Reflectance = Ref
  222. p.Anchored = Anc
  223. p.CanCollide = Colli
  224. p.BrickColor = Col
  225. p.Size = Siz
  226. p.Locked = true
  227. p.Parent = Par
  228. p:BreakJoints()
  229. return p
  230. end
  231.  
  232. function Weld(P0, P1, C0, C1)
  233. local w = Instance.new("Weld")
  234. w.Part0 = P0
  235. w.Part1 = P1
  236. if C0 then
  237. w.C0 = C0
  238. end
  239. if C1 then
  240. w.C1 = C1
  241. end
  242. w.Parent = P0
  243. return w
  244. end
  245.  
  246. for _,v in pairs(Char:children()) do
  247. if v.Name == "Hand Cannon" then
  248. v:remove()
  249. end
  250. end
  251.  
  252. Model = Instance.new("Model")
  253. Model.Name = "Hand Cannon"
  254.  
  255. FTorso = Part(Model, false, false, 1, 0, Torso.BrickColor, V3(2, 2, 1))
  256. FW = Weld(Torso, FTorso)
  257.  
  258. RAB = Part(Model, false, false, 1, 0, BN("White"), V3(0.2, 0.2, 0.2))
  259. LAB = Part(Model, false, false, 1, 0, BN("White"), V3(0.2, 0.2, 0.2))
  260. RLB = Part(Model, false, false, 1, 0, BN("White"), V3(0.2, 0.2, 0.2))
  261. LLB = Part(Model, false, false, 1, 0, BN("White"), V3(0.2, 0.2, 0.2))
  262.  
  263. RABW = Weld(Torso, RAB, CN(), CN(-1.5, -0.5, 0))
  264. LABW = Weld(Torso, LAB, CN(), CN(1.5, -0.5, 0))
  265. RLBW = Weld(Torso, RLB, CN(), CN(-0.5, 1, 0))
  266. LLBW = Weld(Torso, LLB, CN(), CN(0.5, 1, 0))
  267.  
  268. RAW = Weld(RAB, nil, CN(), CN(0, 0.5, 0))
  269. LAW = Weld(LAB, nil, CN(), CN(0, 0.5, 0))
  270. RLW = Weld(RLB, nil, CN(), CN(0, 1, 0))
  271. LLW = Weld(LLB, nil, CN(), CN(0, 1, 0))
  272.  
  273. TW = Weld(Torso, nil, CN(0.7, 0.8, 1.2), CA(0, MR(180), MR(55)))
  274.  
  275. Weapon = Instance.new("Model")
  276. Weapon.Name = "Cannon"
  277.  
  278. HB = Part(Weapon, false, false, 1, 0, BN("White"), V3(0.2, 0.2, 0.2))
  279. HBW = Weld(Rarm, HB, CN(0, -0.7, 0), CA(0, MR(90), MR(90)))
  280. HW = Weld(HB, nil)
  281.  
  282. Handle = Part(Weapon, false, false, 0, 0, BN("Dark grey"), V3(0.5, 0.5, 0.3))
  283. Add.Mesh(Handle, "http://www.roblox.com/asset/?id=3270017", V3(1, 0.7, 2.2), "")
  284. TW.Part1 = Handle
  285.  
  286. Main = Part(Weapon, false, false, 0, 0, BN("Dark grey"), V3(1.5, 1.5, 2.5))
  287. Add.Mesh(Main, "http://www.roblox.com/asset/?id=3270017", V3(1.6, 1.6, 15), "")
  288. Weld(Handle, Main, CA(0, MR(90), MR(90)), CN(1, 0, 0.2))
  289.  
  290. Main2 = Part(Weapon, false, false, 0, 0, BN("Gun metallic"), V3(1, 1, 1.5))
  291. Add.Mesh(Main2, "http://www.roblox.com/asset/?id=3270017", V3(1.2, 1.2, 8), "")
  292. Weld(Main, Main2, CN(), CN(0, 0, 1.7))
  293.  
  294. Handle2 = Part(Weapon, false, false, 0, 0, BN("Dark grey"), V3(0.5, 0.5, 0.3))
  295. Add.Mesh(Handle2, "http://www.roblox.com/asset/?id=3270017", V3(0.7, 0.8, 2.2), "")
  296. Weld(Main2, Handle2, CA(0, MR(90), MR(90)), CN(-0.65, 0, 0))
  297.  
  298. Tip = Part(Weapon, false, false, 0, 0, BN("Earth yellow"), V3(1.6, 1.6, 0.6))
  299. Add.Sphere(Tip, V3(1.05, 1.05, 1))
  300. Weld(Main, Tip, CN(), CN(0, 0, -1.15))
  301.  
  302. Tip4 = Part(Weapon, false, false, 0, 0, BN("Black"), V3(1.2, 1.2, 0.3))
  303. Add.Mesh(Tip4, "http://www.roblox.com/asset/?id=3270017", V3(1.7, 1.7, 10), "")
  304. Weld(Main, Tip4, CN(), CN(0, 0, -0.15))
  305.  
  306. for i = 1.3, 1.45, 0.1 do
  307. local Tip3 = Part(Weapon, false, false, 0, 0, BN("Dark grey"), V3(1.2, 1.2, 0.3))
  308. Add.Mesh(Tip3, "http://www.roblox.com/asset/?id=3270017", V3(i, i, 2), "")
  309. Weld(Main2, Tip3, CN(), CN(0, 0, 0.6))
  310. end
  311.  
  312. for i = -0.95, 0.66, 1.55 do
  313. local Tip3 = Part(Weapon, false, false, 0, 0, BN("Dark Curry"), V3(1.2, 1.2, 0.3))
  314. Add.Mesh(Tip3, "http://www.roblox.com/asset/?id=3270017", V3(1.65, 1.65, 3), "")
  315. Weld(Main, Tip3, CN(), CN(0, 0, i))
  316. end
  317.  
  318. for i = 1.3, 1.5, 0.1 do
  319. local Tip2 = Part(Weapon, false, false, 0, 0, BN("Earth yellow"), V3(1.6, 1.6, 0.6))
  320. Add.Mesh(Tip2, "http://www.roblox.com/asset/?id=3270017", V3(i, i, 2), "")
  321. Weld(Main, Tip2, CN(), CN(0, 0, 1.1))
  322. end
  323.  
  324. for i = -0.3, 1, 0.15 do
  325. local p = Part(Weapon, false, false, 0.7, 0, BN("Black"), V3(0.2, 0.2, 0.2))
  326. Add.Sphere(p, V3(6, 6, 2))
  327. Weld(Main2, p, CN(0, 0, i))
  328. end
  329.  
  330. function Show_Damage(P, D)
  331. local mo = Instance.new("Model")
  332. mo.Name = "- "..D
  333. local p = Part(mo, false, false, 0, 0, BN("Bright red"), V3(0.2, 0.2, 0.2))
  334. p.Name = "Head"
  335. local m = Instance.new("SpecialMesh")
  336. m.MeshType = "Brick"
  337. m.Scale = Vector3.new(4.5, 2.3, 4.5)
  338. m.Parent = p
  339. local bp = Instance.new("BodyPosition", p)
  340. bp.maxForce = V3(MH, MH, MH)
  341. bp.P = 9001
  342. bp.position = CN(P) * CN(0, 1.5, 0).p
  343. local h = Instance.new("Humanoid")
  344. h.Health = 0
  345. h.MaxHealth = 0
  346. h.Name = "asd"
  347. h.Parent = mo
  348. local nah = true
  349. mo.Parent = workspace
  350. p.CFrame = CN(P)
  351. Notime(function()
  352. wait(1.5)
  353. for i = 0, 1, 0.05 do
  354. p.Transparency = i
  355. if nah then mo.Name = "" nah = false else mo.Name = "- "..D nah = true end
  356. wait()
  357. end
  358. mo:remove()
  359. end)
  360. end
  361.  
  362. function Kill(hit)
  363. if Debounce and Hurt then
  364. local Hu = GetHum(hit.Parent)
  365. if Hu then
  366. Debounce = false
  367. local Dmg = MRA(Damage[1], Damage[2])
  368. Hu.Health = Hu.Health - Dmg
  369. Show_Damage(Tip.Position, Dmg)
  370. PlaySound(Sounds.Hit, true)
  371. Tag(Hu)
  372. local chance = MRA(1, 10)
  373. if chance >=5 then
  374. Hu.PlatformStand = true
  375. wait(0.15)
  376. hit.Velocity = (CN(Torso.CFrame * CN(0, 0.5, 0).p, hit.Position).lookVector * 45)
  377. hit.RotVelocity = V3(MRA(-10, 10), MRA(-10, 10), MRA(-10, 10))
  378. wait(0.3)
  379. Hu.PlatformStand = false
  380. end
  381. end
  382. end
  383. end
  384.  
  385. Main.Touched:connect(Kill)
  386.  
  387. Weapon.Parent = Model
  388. Model.Parent = Char
  389.  
  390.  
  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 = 16
  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()
  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) * 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()
  637. RLW.Part1 = Rleg
  638. LLW.Part1 = Lleg
  639. local cf = Torso.CFrame.lookVector * 5
  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.  
  858.  
  859.  
  860.  
  861.  
  862.  
  863. remote = Instance.new 'RemoteFunction';
  864. remote.Parent = script;
  865. remote.OnServerInvoke = function (player, request, ...)
  866. if (player ~= owner) then
  867. return error ('You cannot invoke this remote', 0);
  868. end;
  869. if (request == 1) then
  870. local mouse = ...;
  871. if Attacking == false then
  872. Attacking = true
  873. game:GetService("RunService").Heartbeat:wait()
  874. Shoot()
  875. ShootAnim()
  876. Attacking = false
  877. end
  878. end
  879. if (request == 2) then
  880. local k = ...;
  881.  
  882. if k == "q" then
  883. if Attacking == false then
  884. Attacking = true
  885. Melee()
  886. Attacking = false
  887. end
  888. elseif k == "f" then
  889.  
  890. end
  891.  
  892. end;
  893. if (request == 3) then
  894. Selected = true
  895. SelectAnim()
  896. end
  897. if (request == 4) then
  898. Selected = false
  899. DeselAnim()
  900. end;
  901. end;
  902.  
  903.  
  904. remote.Name = 'ServerRemote';
  905. ]=], owner.Character):WaitForChild 'ServerRemote';
  906.  
  907. local plr = game.Players.LocalPlayer
  908. local chr = plr.Character
  909. local fakemouse = plr:GetMouse()
  910.  
  911. q = Instance.new('HopperBin', plr.Backpack)
  912. q.Name = 'Cannon'
  913. Bin=q
  914.  
  915. Bin.Selected:connect(function(mouse)
  916. remote:InvokeServer(3);
  917. mouse.Button1Down:connect(function()
  918. remote:InvokeServer(1,mouse);
  919. end)
  920. mouse.KeyDown:connect(function(k)
  921. k = k:lower()
  922.  
  923. remote:InvokeServer (2, k);
  924. end)
  925. end)
  926. Bin.Deselected:Connect(function(mouse)
  927. remote:InvokeServer(4);
  928. end)
  929.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement