Advertisement
crabb

mmbn cannon v0.1

Jul 19th, 2018
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 30.67 KB | None | 0 0
  1. --// Ages_dreamcast's Megaman.Exe script v0.1 \\--
  2.  
  3. --Converted with ttyyuu12345's model to script plugin v4
  4. function sandbox(var,func)
  5.     local env = getfenv(func)
  6.     local newenv = setmetatable({},{
  7.         __index = function(self,k)
  8.             if k=="script" then
  9.                 return var
  10.             else
  11.                 return env[k]
  12.             end
  13.         end,
  14.     })
  15.     setfenv(func,newenv)
  16.     return func
  17. end
  18. cors = {}
  19. mas = Instance.new("Model",game:GetService("Lighting"))
  20. Model0 = Instance.new("Model")
  21. Part1 = Instance.new("Part")
  22. Motor6D2 = Instance.new("Motor6D")
  23. Motor6D3 = Instance.new("Motor6D")
  24. Motor6D4 = Instance.new("Motor6D")
  25. Motor6D5 = Instance.new("Motor6D")
  26. Motor6D6 = Instance.new("Motor6D")
  27. Motor6D7 = Instance.new("Motor6D")
  28. Motor6D8 = Instance.new("Motor6D")
  29. Part9 = Instance.new("Part")
  30. Motor6D10 = Instance.new("Motor6D")
  31. Part11 = Instance.new("Part")
  32. Motor6D12 = Instance.new("Motor6D")
  33. Part13 = Instance.new("Part")
  34. Part14 = Instance.new("Part")
  35. Part15 = Instance.new("Part")
  36. Part16 = Instance.new("Part")
  37. Part17 = Instance.new("Part")
  38. Part18 = Instance.new("Part")
  39. WedgePart19 = Instance.new("WedgePart")
  40. Model0.Name = "cannon3"
  41. Model0.Parent = mas
  42. Part1.Name = "mid"
  43. Part1.Parent = Model0
  44. Part1.CFrame = CFrame.new(-13.025012, 6.51455927, 31.326931, -1, 0, 0, 0, 1, 0, 0, 0, -1)
  45. Part1.Orientation = Vector3.new(0, 180, 0)
  46. Part1.Position = Vector3.new(-13.025012, 6.51455927, 31.326931)
  47. Part1.Rotation = Vector3.new(-180, 0, -180)
  48. Part1.Color = Color3.new(0.180392, 0.647059, 0.180392)
  49. Part1.Size = Vector3.new(1.04464507, 0.803574085, 2.08928943)
  50. Part1.BottomSurface = Enum.SurfaceType.Smooth
  51. Part1.BrickColor = BrickColor.new("Sea green")
  52. Part1.CanCollide = false
  53. Part1.TopSurface = Enum.SurfaceType.Smooth
  54. Part1.brickColor = BrickColor.new("Sea green")
  55. Motor6D2.Parent = Part1
  56. Motor6D2.C1 = CFrame.new(7.62939453e-06, 0.522288322, 0.562496185, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  57. Motor6D2.Part0 = Part1
  58. Motor6D2.Part1 = Part18
  59. Motor6D2.part1 = Part18
  60. Motor6D3.Parent = Part1
  61. Motor6D3.C1 = CFrame.new(3.81469727e-06, 0.763356209, 0.562496185, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  62. Motor6D3.Part0 = Part1
  63. Motor6D3.Part1 = Part13
  64. Motor6D3.part1 = Part13
  65. Motor6D4.Parent = Part1
  66. Motor6D4.C1 = CFrame.new(0, 0.682994366, 0.482135773, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  67. Motor6D4.Part0 = Part1
  68. Motor6D4.Part1 = Part14
  69. Motor6D4.part1 = Part14
  70. Motor6D5.Parent = Part1
  71. Motor6D5.C1 = CFrame.new(0, -0.683033466, 0.562507629, 1, 0, 0, 0, -1, 0, 0, 0, -1)
  72. Motor6D5.Part0 = Part1
  73. Motor6D5.Part1 = WedgePart19
  74. Motor6D5.part1 = WedgePart19
  75. Motor6D6.Parent = Part1
  76. Motor6D6.C1 = CFrame.new(0, -0.401806831, 0.241065979, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  77. Motor6D6.Part0 = Part1
  78. Motor6D6.Part1 = Part17
  79. Motor6D6.part1 = Part17
  80. Motor6D7.Parent = Part1
  81. Motor6D7.C1 = CFrame.new(0, -0.401813507, 0.241065979, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  82. Motor6D7.Part0 = Part1
  83. Motor6D7.Part1 = Part16
  84. Motor6D7.part1 = Part16
  85. Motor6D8.Parent = Part1
  86. Motor6D8.C1 = CFrame.new(0, -3.52859497e-05, -1.16518402, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  87. Motor6D8.Part0 = Part1
  88. Motor6D8.Part1 = Part11
  89. Motor6D8.part1 = Part11
  90. Part9.Name = "barrelout"
  91. Part9.Parent = Model0
  92. Part9.CFrame = CFrame.new(-13.025012, 6.51459646, 29.7599716, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  93. Part9.Orientation = Vector3.new(0, -90, 0)
  94. Part9.Position = Vector3.new(-13.025012, 6.51459646, 29.7599716)
  95. Part9.Rotation = Vector3.new(0, -90, 0)
  96. Part9.Color = Color3.new(0.180392, 0.647059, 0.180392)
  97. Part9.Size = Vector3.new(0.562501252, 0.803574085, 1.04464507)
  98. Part9.BottomSurface = Enum.SurfaceType.Smooth
  99. Part9.BrickColor = BrickColor.new("Sea green")
  100. Part9.CanCollide = false
  101. Part9.TopSurface = Enum.SurfaceType.Smooth
  102. Part9.brickColor = BrickColor.new("Sea green")
  103. Part9.Shape = Enum.PartType.Cylinder
  104. Motor6D10.Parent = Part9
  105. Motor6D10.C1 = CFrame.new(0.0602722168, -2.38418579e-05, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  106. Motor6D10.Part0 = Part9
  107. Motor6D10.Part1 = Part15
  108. Motor6D10.part1 = Part15
  109. Part11.Name = "frontmid"
  110. Part11.Parent = Model0
  111. Part11.CFrame = CFrame.new(-13.025012, 6.51459455, 30.161747, -1, 0, 0, 0, 1, 0, 0, 0, -1)
  112. Part11.Orientation = Vector3.new(0, 180, 0)
  113. Part11.Position = Vector3.new(-13.025012, 6.51459455, 30.161747)
  114. Part11.Rotation = Vector3.new(-180, 0, -180)
  115. Part11.Color = Color3.new(0.121569, 0.443137, 0.121569)
  116. Part11.Size = Vector3.new(1.04464507, 0.803574085, 0.241071463)
  117. Part11.BottomSurface = Enum.SurfaceType.Smooth
  118. Part11.BrickColor = BrickColor.new("Forest green")
  119. Part11.CanCollide = false
  120. Part11.TopSurface = Enum.SurfaceType.Smooth
  121. Part11.brickColor = BrickColor.new("Forest green")
  122. Motor6D12.Parent = Part11
  123. Motor6D12.C1 = CFrame.new(0.40177536, -1.90734863e-06, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  124. Motor6D12.Part0 = Part11
  125. Motor6D12.Part1 = Part9
  126. Motor6D12.part1 = Part9
  127. Part13.Name = "bottomy"
  128. Part13.Parent = Model0
  129. Part13.CFrame = CFrame.new(-13.0250082, 5.75120306, 31.8894272, -1, 0, 0, 0, 1, 0, 0, 0, -1)
  130. Part13.Orientation = Vector3.new(0, 180, 0)
  131. Part13.Position = Vector3.new(-13.0250082, 5.75120306, 31.8894272)
  132. Part13.Rotation = Vector3.new(-180, 0, -180)
  133. Part13.Color = Color3.new(0.647059, 0.568627, 0.121569)
  134. Part13.Size = Vector3.new(1.12500238, 0.0803573132, 0.803572655)
  135. Part13.BottomSurface = Enum.SurfaceType.Smooth
  136. Part13.BrickColor = BrickColor.new("Dark Curry")
  137. Part13.CanCollide = false
  138. Part13.TopSurface = Enum.SurfaceType.Smooth
  139. Part13.brickColor = BrickColor.new("Dark Curry")
  140. Part14.Name = "bottomp"
  141. Part14.Parent = Model0
  142. Part14.CFrame = CFrame.new(-13.025012, 5.8315649, 31.8090668, -1, 0, 0, 0, 1, 0, 0, 0, -1)
  143. Part14.Orientation = Vector3.new(0, 180, 0)
  144. Part14.Position = Vector3.new(-13.025012, 5.8315649, 31.8090668)
  145. Part14.Rotation = Vector3.new(-180, 0, -180)
  146. Part14.Color = Color3.new(0.180392, 0.647059, 0.180392)
  147. Part14.Size = Vector3.new(1.04464507, 0.562502086, 1.12500203)
  148. Part14.BottomSurface = Enum.SurfaceType.Smooth
  149. Part14.BrickColor = BrickColor.new("Sea green")
  150. Part14.CanCollide = false
  151. Part14.TopSurface = Enum.SurfaceType.Smooth
  152. Part14.brickColor = BrickColor.new("Sea green")
  153. Part15.Name = "barrelin"
  154. Part15.Parent = Model0
  155. Part15.CFrame = CFrame.new(-13.025012, 6.5146203, 29.6996994, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  156. Part15.Orientation = Vector3.new(0, -90, 0)
  157. Part15.Position = Vector3.new(-13.025012, 6.5146203, 29.6996994)
  158. Part15.Rotation = Vector3.new(0, -90, 0)
  159. Part15.Color = Color3.new(0.105882, 0.164706, 0.207843)
  160. Part15.Size = Vector3.new(0.522322536, 0.562501192, 0.562501192)
  161. Part15.BottomSurface = Enum.SurfaceType.Smooth
  162. Part15.BrickColor = BrickColor.new("Black")
  163. Part15.CanCollide = false
  164. Part15.TopSurface = Enum.SurfaceType.Smooth
  165. Part15.brickColor = BrickColor.new("Black")
  166. Part15.Shape = Enum.PartType.Cylinder
  167. Part16.Name = "incirc"
  168. Part16.Parent = Model0
  169. Part16.CFrame = CFrame.new(-13.025012, 6.91637278, 31.567997, -1, 0, 0, 0, 1, 0, 0, 0, -1)
  170. Part16.Orientation = Vector3.new(0, 180, 0)
  171. Part16.Position = Vector3.new(-13.025012, 6.91637278, 31.567997)
  172. Part16.Rotation = Vector3.new(-180, 0, -180)
  173. Part16.Color = Color3.new(0.647059, 0.568627, 0.121569)
  174. Part16.Size = Vector3.new(1.12500238, 1.28571701, 1.12500238)
  175. Part16.BottomSurface = Enum.SurfaceType.Smooth
  176. Part16.BrickColor = BrickColor.new("Dark Curry")
  177. Part16.CanCollide = false
  178. Part16.TopSurface = Enum.SurfaceType.Smooth
  179. Part16.brickColor = BrickColor.new("Dark Curry")
  180. Part16.Shape = Enum.PartType.Cylinder
  181. Part17.Name = "outcirc"
  182. Part17.Parent = Model0
  183. Part17.CFrame = CFrame.new(-13.025012, 6.9163661, 31.567997, -1, 0, 0, 0, 1, 0, 0, 0, -1)
  184. Part17.Orientation = Vector3.new(0, 180, 0)
  185. Part17.Position = Vector3.new(-13.025012, 6.9163661, 31.567997)
  186. Part17.Rotation = Vector3.new(-180, 0, -180)
  187. Part17.Color = Color3.new(0.180392, 0.647059, 0.180392)
  188. Part17.Size = Vector3.new(1.04464507, 1.76786184, 1.60714626)
  189. Part17.BottomSurface = Enum.SurfaceType.Smooth
  190. Part17.BrickColor = BrickColor.new("Sea green")
  191. Part17.CanCollide = false
  192. Part17.TopSurface = Enum.SurfaceType.Smooth
  193. Part17.brickColor = BrickColor.new("Sea green")
  194. Part17.Shape = Enum.PartType.Cylinder
  195. Part18.Name = "topy"
  196. Part18.Parent = Model0
  197. Part18.CFrame = CFrame.new(-13.0250044, 5.99227095, 31.8894272, -1, 0, 0, 0, 1, 0, 0, 0, -1)
  198. Part18.Orientation = Vector3.new(0, 180, 0)
  199. Part18.Position = Vector3.new(-13.0250044, 5.99227095, 31.8894272)
  200. Part18.Rotation = Vector3.new(-180, 0, -180)
  201. Part18.Color = Color3.new(0.647059, 0.568627, 0.121569)
  202. Part18.Size = Vector3.new(1.12500238, 0.0803573132, 0.803572655)
  203. Part18.BottomSurface = Enum.SurfaceType.Smooth
  204. Part18.BrickColor = BrickColor.new("Dark Curry")
  205. Part18.CanCollide = false
  206. Part18.TopSurface = Enum.SurfaceType.Smooth
  207. Part18.brickColor = BrickColor.new("Dark Curry")
  208. WedgePart19.Name = "bottomw"
  209. WedgePart19.Parent = Model0
  210. WedgePart19.CFrame = CFrame.new(-13.025012, 5.8315258, 30.7644234, -1, 0, 0, 0, -1, 0, 0, 0, 1)
  211. WedgePart19.Orientation = Vector3.new(0, 0, 180)
  212. WedgePart19.Position = Vector3.new(-13.025012, 5.8315258, 30.7644234)
  213. WedgePart19.Rotation = Vector3.new(0, 0, -180)
  214. WedgePart19.Color = Color3.new(0.180392, 0.647059, 0.180392)
  215. WedgePart19.Size = Vector3.new(1.04464507, 0.562501132, 0.964287579)
  216. WedgePart19.BottomSurface = Enum.SurfaceType.Smooth
  217. WedgePart19.BrickColor = BrickColor.new("Sea green")
  218. WedgePart19.CanCollide = false
  219. WedgePart19.brickColor = BrickColor.new("Sea green")
  220. for i,v in pairs(mas:GetChildren()) do
  221.     v.Parent = game:GetService("Players").LocalPlayer.Character
  222.     pcall(function() v:MakeJoints() end)
  223. end
  224. mas:Destroy()
  225. for i,v in pairs(cors) do
  226.     spawn(function()
  227.         pcall(v)
  228.     end)
  229. end
  230.  
  231. function sandbox(var,func)
  232.     local env = getfenv(func)
  233.     local newenv = setmetatable({},{
  234.         __index = function(self,k)
  235.             if k=="script" then
  236.                 return var
  237.             else
  238.                 return env[k]
  239.             end
  240.         end,
  241.     })
  242.     setfenv(func,newenv)
  243.     return func
  244. end
  245. cors = {}
  246. mas3 = Instance.new("Model",game:GetService("Lighting"))
  247. BillboardGui0 = Instance.new("BillboardGui")
  248. Frame1 = Instance.new("Frame")
  249. TextLabel2 = Instance.new("TextLabel")
  250. BillboardGui0.Parent = mas3
  251. BillboardGui0.Name = "damagegui"
  252. BillboardGui0.LightInfluence = 1
  253. BillboardGui0.Size = UDim2.new(0, 200, 0, 50)
  254. BillboardGui0.ClipsDescendants = true
  255. BillboardGui0.MaxDistance = 200
  256. BillboardGui0.StudsOffset = Vector3.new(0, 3.5, 0)
  257. Frame1.Parent = BillboardGui0
  258. Frame1.Size = UDim2.new(1, 0, 1, 0)
  259. Frame1.BackgroundColor = BrickColor.new("Institutional white")
  260. Frame1.BackgroundColor3 = Color3.new(1, 1, 1)
  261. Frame1.BackgroundTransparency = 1
  262. TextLabel2.Parent = Frame1
  263. TextLabel2.Size = UDim2.new(1, 0, 1, 0)
  264. TextLabel2.BackgroundColor = BrickColor.new("Institutional white")
  265. TextLabel2.BackgroundColor3 = Color3.new(1, 1, 1)
  266. TextLabel2.BackgroundTransparency = 1
  267. TextLabel2.Font = Enum.Font.SourceSans
  268. TextLabel2.FontSize = Enum.FontSize.Size14
  269. TextLabel2.TextColor = BrickColor.new("Really black")
  270. TextLabel2.TextColor3 = Color3.new(0, 0, 0)
  271. TextLabel2.TextScaled = true
  272. TextLabel2.TextSize = 14
  273. TextLabel2.TextWrap = true
  274. TextLabel2.TextWrapped = true
  275. for i,v in pairs(mas3:GetChildren()) do
  276.     v.Parent = game:GetService("Players").LocalPlayer.Character
  277.     pcall(function() v:MakeJoints() end)
  278. end
  279. mas3:Destroy()
  280. for i,v in pairs(cors) do
  281.     spawn(function()
  282.         pcall(v)
  283.     end)
  284. end
  285.  
  286. function sandbox(var,func)
  287.     local env = getfenv(func)
  288.     local newenv = setmetatable({},{
  289.         __index = function(self,k)
  290.             if k=="script" then
  291.                 return var
  292.             else
  293.                 return env[k]
  294.             end
  295.         end,
  296.     })
  297.     setfenv(func,newenv)
  298.     return func
  299. end
  300. cors = {}
  301. mas4 = Instance.new("Model",game:GetService("Lighting"))
  302. Model0 = Instance.new("Model")
  303. Part1 = Instance.new("Part")
  304. Weld2 = Instance.new("Weld")
  305. Part3 = Instance.new("Part")
  306. Model0.Name = "cannonshot"
  307. Model0.Parent = mas4
  308. Part1.Name = "mid"
  309. Part1.Parent = Model0
  310. Part1.CFrame = CFrame.new(-20.8750114, 4.79765224, 13.8997059, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  311. Part1.Orientation = Vector3.new(0, -90, 0)
  312. Part1.Position = Vector3.new(-20.8750114, 4.79765224, 13.8997059)
  313. Part1.Rotation = Vector3.new(0, -90, 0)
  314. Part1.Color = Color3.new(0.105882, 0.164706, 0.207843)
  315. Part1.Size = Vector3.new(0.522322536, 0.562501192, 0.562501192)
  316. Part1.BottomSurface = Enum.SurfaceType.Smooth
  317. Part1.BrickColor = BrickColor.new("Black")
  318. Part1.CanCollide = false
  319. Part1.TopSurface = Enum.SurfaceType.Smooth
  320. Part1.brickColor = BrickColor.new("Black")
  321. Part1.Shape = Enum.PartType.Cylinder
  322. Weld2.Name = "barrelin"
  323. Weld2.Parent = Part1
  324. Weld2.C1 = CFrame.new(-0.272199988, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  325. Weld2.Part0 = Part1
  326. Weld2.Part1 = Part3
  327. Weld2.part1 = Part3
  328. Part3.Name = "barrelin"
  329. Part3.Parent = Model0
  330. Part3.CFrame = CFrame.new(-20.8750114, 4.79765224, 14.1719055, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  331. Part3.Orientation = Vector3.new(0, -90, 0)
  332. Part3.Position = Vector3.new(-20.8750114, 4.79765224, 14.1719055)
  333. Part3.Rotation = Vector3.new(0, -90, 0)
  334. Part3.Color = Color3.new(0.105882, 0.164706, 0.207843)
  335. Part3.Size = Vector3.new(0.522322536, 0.522322536, 0.522322536)
  336. Part3.BottomSurface = Enum.SurfaceType.Smooth
  337. Part3.BrickColor = BrickColor.new("Black")
  338. Part3.CanCollide = false
  339. Part3.TopSurface = Enum.SurfaceType.Smooth
  340. Part3.brickColor = BrickColor.new("Black")
  341. Part3.Shape = Enum.PartType.Ball
  342. for i,v in pairs(mas4:GetChildren()) do
  343.     v.Parent = game:GetService("Players").LocalPlayer.Character
  344.     pcall(function() v:MakeJoints() end)
  345. end
  346. mas4:Destroy()
  347. for i,v in pairs(cors) do
  348.     spawn(function()
  349.         pcall(v)
  350.     end)
  351. end
  352.  
  353. --// Services & modules
  354. local run = game:GetService("RunService")
  355. local tweens = game:GetService("TweenService")
  356. local iservice = game:GetService("UserInputService")
  357. local contentp = game:GetService("ContentProvider")
  358. local debris = game:GetService("Debris")
  359. local chats = game:GetService("Chat")
  360.  
  361. --// Player
  362. local plr = game.Players.LocalPlayer
  363. local char = workspace:WaitForChild(plr.Name)
  364. local hum = char:WaitForChild("Humanoid")
  365. local root = char:WaitForChild("HumanoidRootPart")
  366. local torso = char:WaitForChild("Torso")
  367. local cannon = char:WaitForChild("cannon3")
  368. local mid = cannon:WaitForChild("mid")
  369. local cannonshot = char:WaitForChild("cannonshot"):Clone()
  370.  
  371. --// Loading
  372. local sounds = Instance.new("Folder", char.Head)
  373. sounds.Name = "sounds"
  374.  
  375. local firesound = Instance.new("Sound")
  376. firesound.Name = "firesound"
  377. firesound.SoundId = "https://www.roblox.com/asset/?id=260433450"
  378. firesound.Parent = sounds
  379.  
  380. local battlemusic = Instance.new("Sound")
  381. battlemusic.Name = "battlemusic"
  382. battlemusic.SoundId = "https://www.roblox.com/asset/?id=145047869"
  383. battlemusic.Looped = true
  384. battlemusic.Parent = sounds
  385.  
  386. contentp:PreloadAsync(sounds:GetDescendants())
  387. battlemusic:Play()
  388. chats:Chat(char.Head,"Battle routine, set! Execute!",'Blue')
  389.  
  390. --/ other
  391. local partbin = Instance.new("Folder")
  392. partbin.Name = "partbin"
  393. partbin.Parent = char
  394. CF = CFrame.new
  395.  
  396. --// Joints
  397. local cannonjoint = Instance.new("Motor6D")
  398. cannonjoint.Name = "cannonjoint"
  399. cannonjoint.Part0 = char:WaitForChild("Right Arm")
  400. cannonjoint.Part1 = cannon.mid
  401. cannonjoint.C0 = CFrame.new(0,0,0) * CFrame.Angles(math.rad(-0),math.rad(0),math.rad(-0))
  402. cannonjoint.C1 = CFrame.new(0,2.3841857910156e-07,-0.493) * CFrame.Angles(math.rad(90),math.rad(0),math.rad(-180))
  403. cannonjoint.Parent = root
  404.  
  405. local rooth = root:WaitForChild("RootJoint")
  406. local Neck = torso:WaitForChild("Neck")
  407. local LS = torso:WaitForChild("Left Shoulder")
  408. local RS = torso:WaitForChild("Right Shoulder")
  409. local LH = torso:WaitForChild("Left Hip")
  410. local RH = torso:WaitForChild("Right Hip")
  411.  
  412. local animate = char:WaitForChild('Animate')
  413. local animator = hum:WaitForChild('Animator')
  414.  
  415. print(rooth.C0)
  416.  
  417. plrparts = {
  418.     root = char:WaitForChild("HumanoidRootPart"),
  419.     torso = char:WaitForChild("Torso"),
  420.     LA = char:WaitForChild("Left Arm"),
  421.     RA = char:WaitForChild("Right Arm"),
  422.     LL = char:WaitForChild("Left Leg"),
  423.     RL = char:WaitForChild("Right Leg")
  424. }
  425.  
  426. local df = {
  427.     rooth.C0,
  428.     rooth.C1,
  429.     Neck.C0,
  430.     Neck.C1,
  431.     LS.C0,
  432.     LS.C1,
  433.     RS.C0,
  434.     RS.C1,
  435.     LH.C0,
  436.     LH.C1,
  437.     RH.C0,
  438.     RH.C1
  439. }
  440.  
  441. --// animation tables
  442. CannonShoot = {
  443.     [1] = {
  444.         CF(0,0,0) * CFrame.Angles(math.rad(-90),math.rad(0),math.rad(-180)),
  445.         CF(0,0,0) * CFrame.Angles(math.rad(-75.8),math.rad(-5.07),math.rad(160.6)),
  446.         CF(0,1,0) * CFrame.Angles(math.rad(-90),math.rad(0),math.rad(-180)),
  447.         CF(-5.5879354476929e-09,-0.49999997019768,0) * CFrame.Angles(math.rad(-105),math.rad(6.403302346887e-07),math.rad(-160)),
  448.         CF(-1,0.5,0) * CFrame.Angles(math.rad(-0),math.rad(-90),math.rad(0)),
  449.         CF(0.50000023841858,1.2969554662704,-0.069724768400192) * CFrame.Angles(math.rad(-95),math.rad(-30),math.rad(5)),
  450.         CF(1,0.5,0) * CFrame.Angles(math.rad(-0),math.rad(90),math.rad(0)),
  451.         CF(0.10000014305115,1.1000000238419,-4.7683715820313e-07) * CFrame.Angles(math.rad(76.5),math.rad(69.4),math.rad(180)),
  452.         CF(-1,-1,0) * CFrame.Angles(math.rad(-0),math.rad(-90),math.rad(0)),
  453.         CF(-0.38452365994453,1.0000004768372,-0.018738467246294) * CFrame.Angles(math.rad(180),math.rad(-85),math.rad(180)),
  454.         CF(1,-1,0) * CFrame.Angles(math.rad(-0),math.rad(90),math.rad(0)),
  455.         CF(0.65371870994568,0.98731589317322,0.17587691545486) * CFrame.Angles(math.rad(166.5),math.rad(69.4),math.rad(180)),
  456.     },
  457.     [2] = {
  458.         CF(0,0,0) * CFrame.Angles(math.rad(-90.000002504478),math.rad(0),math.rad(-180.00000500896)),
  459.         CF(0,0,0) * CFrame.Angles(math.rad(-100.17644478285),math.rad(6.7345456041782),math.rad(-153.85163663956)),
  460.         CF(0,1,0) * CFrame.Angles(math.rad(-90.000002504478),math.rad(0),math.rad(-180.00000500896)),
  461.         CF(0,-0.5,7.4505805969238e-09) * CFrame.Angles(math.rad(-83.205200544555),math.rad(-8.4141143074069),math.rad(151.24063290478)),
  462.         CF(-1,0.5,0) * CFrame.Angles(math.rad(-0),math.rad(-90.000002504478),math.rad(0)),
  463.         CF(0.49999997019768,0.95745557546616,-0.069725185632706) * CFrame.Angles(math.rad(-95.000001505251),math.rad(-30.000000834826),math.rad(4.9999972932255)),
  464.         CF(1,0.5,0) * CFrame.Angles(math.rad(-0),math.rad(90.000002504478),math.rad(0)),
  465.         CF(-0.45435512065887,0.66659039258957,0.22962585091591) * CFrame.Angles(math.rad(-109.59560349738),math.rad(62.814524551128),math.rad(28.400192946291)),
  466.         CF(-1,-1,0) * CFrame.Angles(math.rad(-0),math.rad(-90.000002504478),math.rad(0)),
  467.         CF(-0.38529708981514,0.92729723453522,-0.037512063980103) * CFrame.Angles(math.rad(157.47058505053),math.rad(-81.698843304244),math.rad(126.8433201329)),
  468.         CF(1,-1,0) * CFrame.Angles(math.rad(-0),math.rad(90.000002504478),math.rad(0)),
  469.         CF(0.24938356876373,1.1330413818359,0.2335514575243) * CFrame.Angles(math.rad(-35.317463613126),math.rad(65.174935475447),math.rad(26.407801152189)),
  470.     }
  471. }
  472.  
  473. --// useful functions
  474. local function inBack(t, b, c, d, s)
  475.     if not s then s = 1.70158 end
  476.     t = t / d
  477.     return c * t * t * ((s + 1) * t - s) + b
  478. end
  479.  
  480. local function outBack(t, b, c, d, s)
  481.     if not s then s = 1.70158 end
  482.     t = t / d - 1
  483.     return c * (t * t * ((s + 1) * t + s) + 1) + b
  484. end
  485.  
  486. local function inOutBack(t, b, c, d, s)
  487.     if not s then s = 1.70158 end
  488.     s = s * 1.525
  489.     t = t / d * 2
  490.     if t < 1 then
  491.         return c / 2 * (t * t * ((s + 1) * t - s)) + b
  492.     else
  493.         t = t - 2
  494.         return c / 2 * (t * t * ((s + 1) * t + s) + 2) + b
  495.     end
  496. end
  497.  
  498. local function outInBack(t, b, c, d, s)
  499.     if t < d / 2 then
  500.         return outBack(t * 2, b, c / 2, d, s)
  501.     else
  502.         return inBack((t * 2) - d, b + c / 2, c / 2, d, s)
  503.     end
  504. end
  505.  
  506. function checkintangible(hit)
  507.     if hit and hit~=nil then
  508.         if hit:IsDescendantOf(char) or hit.Name == "Laser" or string.lower(hit.Name )== "water" then
  509.             return true
  510.         end
  511.     end
  512.     return false
  513. end
  514.  
  515. function castray(startpos,vec,length,ignore,delayifhit)
  516.     local hit,endpos2=game.Workspace:FindPartOnRay(Ray.new(startpos,vec*length),ignore)
  517.     if hit~=nil then
  518.         if checkintangible(hit) then
  519.             if delayifhit then
  520.                 wait()
  521.             end
  522.             hit,endpos2=castray(endpos2+(vec*.01),vec,length-((startpos-endpos2).magnitude),ignore,delayifhit)
  523.         end
  524.     end
  525.     return hit,endpos2
  526. end
  527.  
  528. function drawbeam(beamstart,beamend,fadedelay)
  529.     local rate=1/30
  530.     local dist=(beamstart-beamend).magnitude
  531.     local laser=Instance.new("Part")
  532.     laser.Name="Laser"
  533.     laser.Anchored=true
  534.     laser.CanCollide=false
  535.     laser.Shape="Block"
  536.     laser.formFactor="Custom"
  537.     laser.Size=Vector3.new(.2,.2,.2)
  538.     laser.Transparency=0
  539.     laser.Material="Plastic"
  540.     laser.Locked=true
  541.     laser.TopSurface=0
  542.     laser.BottomSurface=0
  543.     laser.Color = Color3.fromRGB(239,207,79)
  544.     laser.CFrame=CFrame.new(beamend,beamstart)*CFrame.new(0,0,-dist/2)*CFrame.Angles(math.pi/2,0,0)
  545.     local m=Instance.new("SpecialMesh")
  546.     m.Scale=Vector3.new(1,dist*5,1)
  547.     m.Parent=laser
  548.     debris:AddItem(laser,fadedelay*3)
  549.     laser.Parent=game.Workspace
  550.     local frames=fadedelay/rate
  551.     for frame=1,frames do
  552.         wait(rate)
  553.         local percent=frame/frames
  554.         m.Scale=Vector3.new(1+(20*percent),dist*5,1+(20*percent))
  555.         laser.Transparency=.5+(percent*.5)
  556.     end
  557.     wait(2)
  558.     laser:remove()
  559. end
  560.  
  561.  
  562. function fulltransparent(obj,v)
  563.     local descendants = obj:GetDescendants()
  564.  
  565.     for index, descendant in pairs(descendants) do
  566.         if descendant:IsA("BasePart") == true and descendant.Name ~= 'HumanoidRootPart' and descendant.Name:sub(-4) ~= "hbox" then
  567.             descendant.Transparency = v
  568.         end
  569.     end
  570. end
  571.  
  572. function fullcollision(obj,v)
  573.     local descendants = obj:GetDescendants()
  574.  
  575.     for index, descendant in pairs(descendants) do
  576.         if descendant:IsA("BasePart") == true then
  577.             descendant.CanCollide = v  
  578.         end
  579.     end
  580. end
  581.  
  582. function fullremoval(obj,int)
  583.     local descendants = obj:GetDescendants()
  584.  
  585.     for index, descendant in pairs(descendants) do
  586.         if descendant:IsA("BasePart") == true then
  587.             if int == nil then
  588.                 debris:AddItem(descendant)
  589.             else
  590.                 debris:AddItem(descendant,int)
  591.             end
  592.         end
  593.     end
  594. end
  595.  
  596. ArtificialHB = Instance.new("BindableEvent", script)
  597. ArtificialHB.Name = "ArtificialHB"
  598.  
  599. script:WaitForChild("ArtificialHB")
  600.  
  601. framespeed = 1/60
  602. frame = framespeed
  603. tf = 0
  604. allowframeloss = false
  605. tossremainder = false
  606. lastframe = tick()
  607. script.ArtificialHB:Fire()
  608.  
  609. game:GetService("RunService").Heartbeat:connect(function(s, p)
  610.     tf = tf + s
  611.     if tf >= frame then
  612.         if allowframeloss then
  613.             script.ArtificialHB:Fire()
  614.             lastframe = tick()
  615.         else
  616.             for i = 1, math.floor(tf / frame) do
  617.                 script.ArtificialHB:Fire()
  618.             end
  619.         lastframe = tick()
  620.         end
  621.         if tossremainder then
  622.             tf = 0
  623.         else
  624.             tf = tf - frame * math.floor(tf / frame)
  625.         end
  626.     end
  627. end)
  628.  
  629. function swait(x)
  630.     if x == 0 or x == nil then
  631.         ArtificialHB.Event:wait()
  632.     else
  633.         for i = 1, x do
  634.             ArtificialHB.Event:wait()
  635.         end
  636.     end
  637. end
  638.  
  639. --/ cframe garbage
  640. function mlerp(x,g,a) --not necessarily only for cframes, but really useful in them
  641.     return x:lerp(g,a)
  642. end
  643.  
  644. function convert(matrix)
  645.    local PX,PY,PZ = matrix.X,matrix.Y,matrix.Z
  646.    local AX,AY,AZ = matrix:toEulerAnglesXYZ()
  647.    local function returnDeg(theta)
  648.       return "math.rad("..math.deg(theta)..")"
  649.    end
  650.    local sep = ","
  651.    local str1 = "CFrame.new("..PX..sep..PY..sep..PZ..")"
  652.    local str2 = "CFrame.Angles("..returnDeg(AX)..sep..returnDeg(AY)..sep..returnDeg(AZ)..")"
  653.    print(str1.." * "..str2)
  654. end
  655.  
  656. function tablelerp(table, speed)
  657.     rooth.C0 = mlerp(rooth.C0, table[1], speed)
  658.     rooth.C1 = mlerp(rooth.C1, table[2], speed)
  659.     Neck.C0 = mlerp(Neck.C0, table[3], speed)
  660.     Neck.C1 = mlerp(Neck.C1, table[4], speed)
  661.     LS.C0 = mlerp(LS.C0, table[5], speed)
  662.     LS.C1 = mlerp(LS.C1, table[6], speed)
  663.     RS.C0 = mlerp(RS.C0, table[7], speed)
  664.     RS.C1 = mlerp(RS.C1, table[8], speed)
  665.     LH.C0 = mlerp(LH.C0, table[9], speed)
  666.     LH.C1 = mlerp(LH.C1, table[10], speed)
  667.     RH.C0 = mlerp(RH.C0, table[11], speed)
  668.     RH.C1 = mlerp(RH.C1, table[12], speed)
  669. end
  670.  
  671. function randomang(p)
  672.     p.CFrame = p.CFrame * CFrame.Angles(math.rad(math.random(-180,180)),math.rad(math.random(-180,180)),math.rad(math.random(-180,180)))
  673. end
  674.  
  675. local OutEasingDirection = function(Alpha)
  676.     return math.sin((math.pi/2)*Alpha);
  677. end
  678.  
  679. local InEasingDirection = function(Alpha)
  680.     return math.sin((math.pi/2)-((math.pi/2)*Alpha));
  681. end
  682.  
  683. local InOutEasingDirection = function(Alpha)
  684.     return (1-math.cos(math.pi*Alpha))/2;
  685. end
  686.  
  687.  
  688. --/ extra
  689. function brickfx(mode,minsize,maxsize,int,cf,color,mat,par,rel)
  690.     if mode ==  0 then
  691.         local np = Instance.new("Part")
  692.         np.Anchored = true
  693.         np.CanCollide = false
  694.         np.CFrame = cf
  695.         if color ~= nil then
  696.             np.Color = color
  697.         end
  698.         if mat ~= nil then
  699.             np.Material = mat
  700.         end
  701.         np.Size = Vector3.new(1,1,1)
  702.         np.Parent = partbin
  703.         for i = minsize,maxsize,int do
  704.             np.Transparency = i/maxsize
  705.             if i ~= 0 then
  706.                 np.Size = Vector3.new(i*10,i*10,i*10)
  707.             end
  708.             randomang(np)
  709.             swait(1)
  710.         end
  711.         debris:AddItem(np)
  712.     elseif mode == 1 then
  713.         local np = Instance.new("Part")
  714.         np.Anchored = true
  715.         np.CanCollide = false
  716.         np.CFrame = root.CFrame:toWorldSpace(CFrame.new(0,0,0))
  717.         np.Size = Vector3.new(1,1,1)
  718.         np.Parent = partbin
  719.         for i = minsize,maxsize,int do
  720.             if i ~= 0 then
  721.                 np.Size = Vector3.new(i*10,i*10,i*10)
  722.             end
  723.             randomang(np)
  724.             swait(1)
  725.         end
  726.         debris:AddItem(np)
  727.     end
  728. end
  729.  
  730. function cfp(cf,goal,a,maxalpha)
  731.     local start,finish = cf,goal
  732.     local change = (finish.p - start.p)
  733.     local alpha = outBack(a,start.p,change,maxalpha)
  734.     return mlerp(start,finish,(alpha - start.p).magnitude/change.magnitude)
  735. end
  736.  
  737. function outbacktablelerp(table,speed,maxalpha)
  738.     cfp(rooth.C0, table[1], speed, maxalpha)
  739.     cfp(rooth.C1, table[2], speed, maxalpha)
  740.     cfp(Neck.C0, table[3], speed, maxalpha)
  741.     cfp(Neck.C1, table[4], speed, maxalpha)
  742.     cfp(LS.C0, table[5], speed, maxalpha)
  743.     cfp(LS.C1, table[6], speed, maxalpha)
  744.     cfp(RS.C0, table[7], speed, maxalpha)
  745.     cfp(RS.C1, table[8], speed, maxalpha)
  746.     cfp(LH.C0, table[9], speed, maxalpha)
  747.     cfp(LH.C1, table[10], speed, maxalpha)
  748.     cfp(RH.C0, table[11], speed, maxalpha)
  749.     cfp(RH.C1, table[12], speed, maxalpha)
  750. end
  751.  
  752. -- please don't sue me osama I only skim through the history of #scripting
  753. function DetectHitbox(cframe,size)
  754.     local CheckPoint = function(region3,poisition)
  755.         for i,plane in pairs(region3) do
  756.             local normal = plane[1]
  757.             local point = plane[2]
  758.            
  759.             local relative = poisition - point
  760.             if relative:Dot(normal)>0 then
  761.                 return false
  762.             end
  763.         end
  764.         return true
  765.     end
  766.     local planes = {}
  767.     local center = cframe
  768.    
  769.     local right = center:vectorToWorldSpace(Vector3.new(1,0,0))
  770.     local left = center:vectorToWorldSpace(Vector3.new(-1,0,0))
  771.     local front = center:vectorToWorldSpace(Vector3.new(0,0,-1))
  772.     local back = center:vectorToWorldSpace(Vector3.new(0,0,1))
  773.     local top = center:vectorToWorldSpace(Vector3.new(0,1,0))
  774.     local bottom = center:vectorToWorldSpace(Vector3.new(0,-1,0))
  775.    
  776.     local rightPoint = center.p + right * (Vector3.new(1,0,0) * size/2).magnitude
  777.     local leftPoint = center.p + left * (Vector3.new(-1,0,0) * size/2).magnitude
  778.     local frontPoint = center.p + front * (Vector3.new(0,0,-1) * size/2).magnitude
  779.     local backPoint = center.p + back * (Vector3.new(0,0,1) * size/2).magnitude
  780.     local topPoint = center.p + top * (Vector3.new(0,1,0) * size/2).magnitude
  781.     local bottomPoint = center.p + bottom * (Vector3.new(0,1,0) * size/2).magnitude
  782.  
  783.     planes={
  784.         {right,rightPoint};
  785.         {left,leftPoint};
  786.         {front,frontPoint};
  787.         {back,backPoint};
  788.         {top,topPoint};
  789.         {back,backPoint};
  790.     }    
  791.     local targets = {}
  792.  
  793.     for _,x in pairs(workspace:GetChildren()) do
  794.         local vhume = x:FindFirstChild("Humanoid")
  795.         if vhume and vhume:IsA("Humanoid") and vhume ~= hum then
  796.             for _,y in pairs(x:GetChildren()) do
  797.                 if y:IsA("BasePart") and not targets[x] and CheckPoint(planes,y.Position) then
  798.                     table.insert(targets, x)
  799.                     break
  800.                 end
  801.             end
  802.         end    
  803.     end
  804.    
  805.     return targets    
  806. end
  807.  
  808. local damagegui = char:WaitForChild("damagegui")
  809. damagegui.Enabled = false
  810.  
  811. local guibin = Instance.new("Folder", char)
  812. guibin.Name = "guibin"
  813.  
  814. function virusbust(h)
  815.     local char = h.Parent
  816.     char.Parent = partbin
  817.     char:BreakJoints()
  818.     for i,v in pairs(char:GetDescendants()) do
  819.         if v:IsA "BasePart" == true then
  820.             local bv = Instance.new("BodyVelocity")
  821.             bv.Velocity = root.CFrame.upVector * 30
  822.             bv.Parent = v
  823.             for i = 0,1.1,.1 do
  824.                 if v == nil then break end
  825.                 v.Transparency = i
  826.                 swait()
  827.             end
  828.         end
  829.     end
  830. end
  831.  
  832. function damagehum(h,amount)
  833.     local gui = damagegui:Clone()
  834.     local enemy = h.Parent
  835.     local root = h.Parent:FindFirstChild("HumanoidRootPart")
  836.     local head = h.Parent:FindFirstChild("Head")
  837.     if h.Health <= amount then
  838.         virusbust(h)
  839.     else
  840.         h:TakeDamage(amount)
  841.     end
  842.     gui.Parent = guibin
  843.     gui.Enabled = true
  844.     gui.Adornee = head
  845.     gui.Frame.TextLabel.Text = "-"..amount
  846.     for i = 0,1.01,.01 do
  847.         gui.Frame.TextLabel.TextTransparency = i
  848.         swait()
  849.     end
  850.     debris:AddItem(gui)
  851. end
  852.  
  853. function cannontrail(shot,rate)
  854.     while shot:FindFirstChild("mid") == true do
  855.         if shot:FindFirstChild("mid") ~= true then break end
  856.         brickfx(0,0.05,0.5,0.05,shot.PrimaryPart.CFrame,Color3.fromRGB(122,107,47),"Neon")
  857.         wait(rate)
  858.     end
  859. end
  860.  
  861. function cannonbullet(dmg,speed)
  862.     local cdb = false
  863.     local shot = cannonshot:Clone()
  864.     local rate = .15
  865.     local mid = shot.mid
  866.     shot.PrimaryPart = mid
  867.     shot:SetPrimaryPartCFrame(cannon.barrelin.CFrame * CFrame.Angles(math.rad(0),math.rad(180),math.rad(0)))
  868.     shot.Parent = partbin
  869.     local thrust = Instance.new("BodyVelocity")
  870.     thrust.Velocity = cannon.barrelin.CFrame.rightVector * speed * -1
  871.     thrust.Parent = shot.PrimaryPart
  872.     cannontrail(shot,rate)
  873.     mid.Touched:connect(function(h)
  874.         if h.Parent:FindFirstChild("Humanoid") and h.Parent:FindFirstChild("Humanoid") ~= hum then
  875.             if cdb == false then
  876.                 cdb = true
  877.                 brickfx(0,0.1,1,0.1,mid.CFrame,Color3.fromRGB(122,107,47),"Neon")
  878.                 damagehum(h.Parent:FindFirstChild("Humanoid"),dmg)
  879.                 print("Virus hit for "..dmg.." damage!")
  880.                 fulltransparent(shot,1)
  881.             end
  882.         end
  883.     end)
  884. end
  885.  
  886. --// garbage removal (might as well add the entire script to debris)
  887. -- debris:AddItem(script)
  888. partbin.DescendantAdded:connect(function(d)
  889.     wait(10)
  890.     if d ~= nil then
  891.         debris:AddItem(d)
  892.     end
  893. end)
  894.  
  895. guibin.DescendantAdded:connect(function(d)
  896.     wait(10)
  897.     if d ~= nil then
  898.         debris:AddItem(d)
  899.     end
  900. end)
  901.  
  902. fulltransparent(cannon,1)
  903.  
  904. --// the main event
  905. iservice.InputBegan:connect(function(io,gp)
  906.     if io.KeyCode == Enum.KeyCode.Q then
  907.         Cannon()
  908.     end
  909. end)
  910.  
  911. local cannondb = false
  912. function Cannon()
  913.     if cannondb == false then
  914.         cannondb = true
  915.         tablelerp(df,1)
  916.         local dmg = 40
  917.         animate.Parent = nil
  918.         animator.Parent = nil
  919.         local ws = hum.WalkSpeed
  920.         hum.WalkSpeed = 0
  921.         for i = 1,-0.1,-.1 do
  922.             fulltransparent(cannon,i)
  923.             swait()
  924.         end
  925.         for i = 0,1.05,.05 do
  926.             tablelerp(CannonShoot[1],i)
  927.             swait()
  928.         end
  929.         cannonbullet(dmg,100)
  930.         brickfx(0,0.05,0.5,0.05,cannon.barrelin.CFrame,Color3.fromRGB(122,107,47),"Neon")
  931.         for i = 0.5,1,.125 do
  932.             tablelerp(CannonShoot[2],i,1)
  933.             swait()
  934.         end
  935.         for i = 0,1.1,.1 do
  936.             tablelerp(df,i)
  937.             fulltransparent(cannon,i)
  938.             swait()
  939.         end
  940.         animator.Parent = hum
  941.         animate.Parent = char
  942.         hum.WalkSpeed = ws
  943.         cannondb = false
  944.     end
  945. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement