Advertisement
freddy1927563

Untitled

Mar 10th, 2018
466
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. local Players = game:GetService("Players")
  3. local Lighting = game:GetService("Lighting")
  4. local Debris = game:GetService("Debris")
  5. local Player = Players.LocalPlayer
  6. local Mouse = Player:GetMouse()
  7. local Char = Player.Character
  8. local RArm = Char["Right Arm"]
  9. local MainColor = "Really red"
  10. local Model = Instance.new("Model",Char)
  11. local Activated = false
  12. local LightningEffectOn = false
  13. Model.Name = "MasterBolt"
  14. for i,v in pairs(Char:GetChildren()) do
  15. if v:IsA("Shirt") or v:IsA("Pants") or v:IsA("Hat") or v:IsA("CharacterMesh") or v:IsA("BodyColors") then
  16. v:Destroy()
  17. elseif v:IsA("BasePart") then
  18. v.BrickColor = BrickColor.new("Really red")
  19. end
  20. end
  21. local BG = Instance.new("BodyGyro",Char.Torso)
  22. BG.maxTorque = Vector3.new(0,0,0)
  23. local BG2 = Instance.new("BodyGyro",Char.Head)
  24. BG2.maxTorque = Vector3.new(0,0,0)
  25. local RW = Instance.new("Weld",Char.Torso)
  26. RW.Part0 = Char.Torso
  27. local Bolt = Instance.new("Part",Model)
  28. Bolt.BrickColor = BrickColor.new("Really red")
  29. Bolt.CanCollide = false
  30. Bolt.FormFactor = "Custom"
  31. Bolt.TopSurface = "Smooth"
  32. Instance.new("CylinderMesh",Bolt)
  33. Bolt.BottomSurface = "Smooth"
  34. Bolt.Size = Vector3.new(0.5,2,0.5)
  35. Bolt:BreakJoints()
  36. local BW = Instance.new("Weld",Bolt)
  37. BW.Part0 = RArm
  38. BW.Part1 = Bolt
  39. BW.C1 = CFrame.new(0.2,0,1) * CFrame.Angles(math.rad(90),0,0)
  40. local Tip = Instance.new("Part",Model)
  41. Tip.BrickColor = BrickColor.new("Really red")
  42. Tip.CanCollide = false
  43. Tip.FormFactor = "Custom"
  44. Tip.TopSurface = "Smooth"
  45. Tip.BottomSurface = "Smooth"
  46. local Mesh = Instance.new("SpecialMesh",Tip)
  47. Mesh.MeshId = "http://www.roblox.com/asset/?id=1033714"
  48. Mesh.Scale = Vector3.new(0.25,0.5,0.25)
  49. Tip.Size = Vector3.new(0.48,0.5,0.48)
  50. Tip:BreakJoints()
  51. local TW = Instance.new("Weld",Tip)
  52. TW.Part0 = Bolt
  53. TW.Part1 = Tip
  54. TW.C1 = CFrame.new(0,-1.175,0)
  55. local Tip2 = Instance.new("Part",Model)
  56. Tip2.BrickColor = BrickColor.new("Really red")
  57. Tip2.CanCollide = false
  58. Tip2.FormFactor = "Custom"
  59. Tip2.TopSurface = "Smooth"
  60. Tip2.BottomSurface = "Smooth"
  61. local Mesh2 = Instance.new("SpecialMesh",Tip2)
  62. Mesh2.MeshId = "http://www.roblox.com/asset/?id=1033714"
  63. Mesh2.Scale = Vector3.new(0.25,0.5,0.25)
  64. Tip2.Size = Vector3.new(0.48,0.5,0.48)
  65. Tip2:BreakJoints()
  66. local TW2 = Instance.new("Weld",Tip2)
  67. TW2.Part0 = Bolt
  68. TW2.Part1 = Tip2
  69. TW2.C1 = CFrame.new(0,-1.175,0) * CFrame.Angles(0,0,math.rad(180))
  70. function ComputePos(pos1, pos2)
  71. return CFrame.new(pos1, Vector3.new(pos2.x, pos1.y, pos2.z))
  72. end
  73. function LightningEffect(Pos,Color,Size,Time)
  74. local Mod = Instance.new("Model",Char)
  75. Mod.Name = "Lightning"
  76. for i = 1,Size do
  77. local LastPos = Pos
  78. for i2 = 1,math.random(Size-1,Size+1) do
  79. local Targ = LastPos * CFrame.new(math.random(-Size,Size),math.random(-Size,Size),math.random(-Size,Size))
  80. local P = Instance.new("Part",Mod)
  81. P.BrickColor = Color
  82. P.FormFactor = "Custom"
  83. Instance.new("CylinderMesh",P)
  84. P.Size = Vector3.new(0,(Targ.p-LastPos.p).Magnitude,0)
  85. P.CFrame = CFrame.new(LastPos.p, Targ.p) * CFrame.Angles(math.pi/2,0,0) * CFrame.new(0,-(Targ.p-LastPos.p).Magnitude/2,0)
  86. P.Anchored = true
  87. P.CanCollide = false
  88. P.TopSurface = "Smooth"
  89. P.BottomSurface = "Smooth"
  90. P.Name = "LightningPart"
  91. P:BreakJoints()
  92. local P2 = Instance.new("Part",Mod)
  93. P2.BrickColor = Color
  94. P2.FormFactor = "Custom"
  95. Instance.new("CylinderMesh",P2)
  96. P2.Size = P.Size + Vector3.new(0.1,0.1,0.1)
  97. P2.CFrame = P.CFrame
  98. P2.Transparency = 0.7
  99. P2.Anchored = true
  100. P2.CanCollide = false
  101. P2.TopSurface = "Smooth"
  102. P2.BottomSurface = "Smooth"
  103. P2.Name = "LightningPart"
  104. P2:BreakJoints()
  105. LastPos = Targ
  106. end
  107. end
  108. Debris:AddItem(Mod,Time or 0.1)
  109. end
  110. function Break(Obj,Base,Dis)
  111. for i,v in pairs(Obj:GetChildren()) do
  112. if v:IsA("BasePart") and (v.Position-Base.Position).Magnitude <= Dis then
  113. if v.Name ~= "Base" and v.Parent ~= Char and v.Parent.Parent ~= Char and v ~= Base then
  114. v.BrickColor = BrickColor.new("Really Really red")
  115. v.Anchored = false
  116. v:BreakJoints()
  117. EXP = Instance.new("Explosion",workspace)
  118. EXP.Position = v.Position
  119. EXP.BlastRadius = 1
  120. end
  121. end
  122. Break(v,Base,Dis)
  123. end
  124. end
  125. function ExplosionEffect(Pos)
  126. coroutine.resume(coroutine.create(function()
  127. local Base = Instance.new("Part",Char)
  128. Base.Anchored = true
  129. Base.Shape = "Ball"
  130. Base.FormFactor = "Custom"
  131. Base.Size = Vector3.new(10,10,10)
  132. Base.CFrame = Pos
  133. Base.Transparency = 0.25
  134. Base.BrickColor = BrickColor.new(MainColor)
  135. Base.TopSurface = "Smooth"
  136. Base.BottomSurface = "Smooth"
  137. Base.Name = "Explosion"
  138. for i = 1,100,2 do
  139. Base.Size = Base.Size + Vector3.new(1,1,1)
  140. Base.CFrame = Pos
  141. Base.Transparency = i*0.01
  142. Break(Workspace,Base,Base.Size.Y/2)
  143. wait(0.0001)
  144. end
  145. Base:Destroy()
  146. end))
  147. end
  148. function LightningBeam(Pos1,Pos,Color,Size,Time)
  149. local Mod = Instance.new("Model",Char)
  150. Mod.Name = "Lightning"
  151. local LastPos = Pos1
  152. local End = math.floor((Pos.p-Pos1.p).Magnitude/3)
  153. local Targ = nil
  154. for i2 = 1,End do
  155. if i2 == End then
  156. Targ = Pos
  157. else
  158. for i = 1,100 do
  159. Targ = LastPos * CFrame.new(math.random(-6,6),math.random(-6,6),math.random(-6,6))
  160. if (Targ.p-Pos.p).Magnitude < (LastPos.p-Pos.p).Magnitude and (math.abs(Targ.Y-Pos.Y) - math.abs(LastPos.Y-Pos.Y)) < math.abs(Pos1.Y-Pos.Y) then
  161. break
  162. end
  163. end
  164. end
  165. local P = Instance.new("Part",Mod)
  166. P.BrickColor = Color
  167. P.FormFactor = "Custom"
  168. Instance.new("CylinderMesh",P)
  169. P.Size = Vector3.new(Size,(Targ.p-LastPos.p).Magnitude,Size)
  170. P.CFrame = CFrame.new(LastPos.p, Targ.p) * CFrame.Angles(math.pi/2,0,0) * CFrame.new(0,-(Targ.p-LastPos.p).Magnitude/2,0)
  171. P.Anchored = true
  172. P.CanCollide = false
  173. P.TopSurface = "Smooth"
  174. P.BottomSurface = "Smooth"
  175. P.Name = "Main"
  176. P:BreakJoints()
  177. local P2 = Instance.new("Part",Mod)
  178. P2.BrickColor = Color
  179. P2.FormFactor = "Custom"
  180. Instance.new("CylinderMesh",P2)
  181. P2.Size = P.Size + Vector3.new(Size/4,Size/4,Size/4)
  182. P2.CFrame = P.CFrame
  183. P2.Transparency = 0.7
  184. P2.Anchored = true
  185. P2.CanCollide = false
  186. P2.TopSurface = "Smooth"
  187. P2.BottomSurface = "Smooth"
  188. P2.Name = "LightningPart"
  189. P2:BreakJoints()
  190. LastPos = Targ
  191. end
  192. coroutine.resume(coroutine.create(function()
  193. for i = 0,1,0.1 do
  194. for i2,v in pairs(Mod:GetChildren()) do
  195. if v:IsA("BasePart") then
  196. if v.Name == "Main" then
  197. v.Transparency = i
  198. else
  199. v.Transparency = Vector3.new(0,0.7,0):lerp(Vector3.new(0,1,0),i).Y
  200. end
  201. end
  202. end
  203. wait(i*0.5)
  204. end
  205. Mod:Destroy()
  206. end))
  207. end
  208. TweenWeld = function(c,c1,step)
  209. local c0 = c.C1
  210. if c0 == c1 then
  211. step = 90
  212. end
  213. for i = -90,90,step do
  214. local r = ((math.sin(math.rad(i))+1)/2)
  215. local cf = matrixInterpolate(c0, c1, r)
  216. c.C1 = cf
  217. wait(0.000001)
  218. end
  219. end
  220. function lerp(a, b, t)
  221. return a + (b - a)*t
  222. end
  223. function slerp(a, b, t)
  224. local dot = a:Dot(b)
  225. if dot > 0.99999 or dot < -0.99999 then
  226. return t <= 0.5 and a or b
  227. else
  228. local r = math.acos(dot)
  229. return (a*math.sin((1 - t)*r) + b*math.sin(t*r)) / math.sin(r)
  230. end
  231. end
  232. function matrixInterpolate(a, b, t)
  233. local ax, ay, az, a00, a01, a02, a10, a11, a12, a20, a21, a22 = a:components()
  234. local bx, by, bz, b00, b01, b02, b10, b11, b12, b20, b21, b22 = b:components()
  235. local v0 = lerp(Vector3.new(ax , ay , az ), Vector3.new(bx , by , bz ), t) -- Position
  236. local v1 = slerp(Vector3.new(a00, a01, a02), Vector3.new(b00, b01, b02), t) -- Vector right
  237. local v2 = slerp(Vector3.new(a10, a11, a12), Vector3.new(b10, b11, b12), t) -- Vector up
  238. local v3 = slerp(Vector3.new(a20, a21, a22), Vector3.new(b20, b21, b22), t) -- Vector back
  239. return CFrame.new(
  240. v0.x, v0.y, v0.z,
  241. v1.x, v1.y, v1.z,
  242. v2.x, v2.y, v2.z,
  243. v3.x, v3.y, v3.z)
  244. end
  245. function KeyDown(Key)
  246. if Key:lower() == "q" and not DB then
  247. DB = true
  248. if Activated == false then
  249. RW.Part1 = RArm
  250. RW.C1 = CFrame.new(-1.5,0,0)
  251. TweenWeld(RW,CFrame.new(-1,1.5,0.5) * CFrame.Angles(math.rad(-150),0,math.rad(10)),6)
  252. for i = Bolt.Size.Y,5,0.1 do
  253. Bolt.Size = Vector3.new(0.5,i,0.5)
  254. BW.Part0 = RArm
  255. BW.Part1 = Bolt
  256. BW.C1 = CFrame.new(0.1,0,1) * CFrame.Angles(math.rad(90),0,0)
  257. BW.Parent = Bolt
  258. TW.Part0 = Bolt
  259. TW.Part1 = Tip
  260. Mesh.Scale = Mesh.Scale + Vector3.new(0,0.005,0)
  261. TW.C1 = CFrame.new(0,-(i/2+0.175+(Mesh.Scale.Y-0.5)/2.75),0)
  262. TW.Parent = Tip
  263. TW2.Part0 = Bolt
  264. TW2.Part1 = Tip2
  265. Mesh2.Scale = Mesh2.Scale + Vector3.new(0,0.005,0)
  266. TW2.C1 = CFrame.new(0,-(i/2+0.175+(Mesh2.Scale.Y-0.5)/2.75),0) * CFrame.Angles(0,0,math.rad(180))
  267. TW2.Parent = Tip2
  268. wait(0.000001)
  269. BW.Part0 = RArm
  270. BW.Part1 = Bolt
  271. BW.C1 = CFrame.new(0.1,0,1) * CFrame.Angles(math.rad(90),0,0)
  272. BW.Parent = Bolt
  273. TW.Part0 = Bolt
  274. TW.Part1 = Tip
  275. TW.C1 = CFrame.new(0,-(i/2+0.175+(Mesh.Scale.Y-0.5)/2.75),0)
  276. TW.Parent = Tip
  277. TW2.Part0 = Bolt
  278. TW2.Part1 = Tip2
  279. TW2.C1 = CFrame.new(0,-(i/2+0.175+(Mesh2.Scale.Y-0.5)/2.75),0) * CFrame.Angles(0,0,math.rad(180))
  280. TW2.Parent = Tip2
  281. local Color = Vector3.new(BrickColor.new("Really red").r,BrickColor.new("Really red").g,BrickColor.new("Really red").b):lerp(Vector3.new(BrickColor.new(MainColor).r,BrickColor.new(MainColor).g,BrickColor.new(MainColor).b),i/5)
  282. Bolt.Color = Color3.new(Color.X,Color.Y,Color.Z)
  283. Tip.Color = Bolt.Color
  284. Tip2.Color = Bolt.Color
  285. end
  286. LightningEffectOn = true
  287. TweenWeld(RW,CFrame.new(-1.2,0.5,0.5) * CFrame.Angles(math.rad(-40),math.rad(10),0),6)
  288. Activated = true
  289. else
  290. TweenWeld(RW,CFrame.new(-1.5,0,0),6)
  291. RW.Part1 = nil
  292. LightningEffectOn = false
  293. for i = Bolt.Size.Y,2,-0.1 do
  294. Bolt.Size = Vector3.new(0.5,i,0.5)
  295. BW.Part0 = RArm
  296. BW.Part1 = Bolt
  297. BW.C1 = CFrame.new(0.1,0,1) * CFrame.Angles(math.rad(90),0,0)
  298. BW.Parent = Bolt
  299. TW.Part0 = Bolt
  300. TW.Part1 = Tip
  301. Mesh.Scale = Mesh.Scale - Vector3.new(0,0.005,0)
  302. TW.C1 = CFrame.new(0,-(i/2+0.175+(Mesh.Scale.Y-0.5)/2.75),0)
  303. TW.Parent = Tip
  304. TW2.Part0 = Bolt
  305. TW2.Part1 = Tip2
  306. Mesh2.Scale = Mesh2.Scale - Vector3.new(0,0.005,0)
  307. TW2.C1 = CFrame.new(0,-(i/2+0.175+(Mesh2.Scale.Y-0.5)/2.75),0) * CFrame.Angles(0,0,math.rad(180))
  308. TW2.Parent = Tip2
  309. wait(0.000001)
  310. BW.Part0 = RArm
  311. BW.Part1 = Bolt
  312. BW.C1 = CFrame.new(0.1,0,1) * CFrame.Angles(math.rad(90),0,0)
  313. BW.Parent = Bolt
  314. TW.Part0 = Bolt
  315. TW.Part1 = Tip
  316. TW.C1 = CFrame.new(0,-(i/2+0.175+(Mesh.Scale.Y-0.5)/2.75),0)
  317. TW.Parent = Tip
  318. TW2.Part0 = Bolt
  319. TW2.Part1 = Tip2
  320. TW2.C1 = CFrame.new(0,-(i/2+0.175+(Mesh2.Scale.Y-0.5)/2.75),0) * CFrame.Angles(0,0,math.rad(180))
  321. TW2.Parent = Tip2
  322. local Color = Vector3.new(BrickColor.new(MainColor).r,BrickColor.new(MainColor).g,BrickColor.new(MainColor).b):lerp(Vector3.new(BrickColor.new("Really red").r,BrickColor.new("Really red").g,BrickColor.new("Really red").b),(2/i))
  323. Bolt.Color = Color3.new(Color.X,Color.Y,Color.Z)
  324. Tip.Color = Bolt.Color
  325. Tip2.Color = Bolt.Color
  326. end
  327. TW.Part0 = Bolt
  328. TW.Part1 = Tip
  329. TW.C1 = CFrame.new(0,-1.175,0)
  330. TW2.Part0 = Bolt
  331. TW2.Part1 = Tip2
  332. TW2.C1 = CFrame.new(0,-1.175,0) * CFrame.Angles(0,0,math.rad(180))
  333. Activated = false
  334. end
  335. DB = false
  336. elseif Key:lower() == "e" and Activated and not DB then
  337. DB = true
  338. TweenWeld(RW,CFrame.new(-1,1.5,0.25) * CFrame.Angles(math.rad(-170),0,math.rad(10)),10)
  339. wait(0.1)
  340. TweenWeld(RW,CFrame.new(-1,2,-0.3) * CFrame.Angles(math.rad(-155),0,math.rad(10)),11)
  341. if (Mouse.Hit.p-Tip2.CFrame.p).Magnitude > 300 then
  342. LightningBeam(Tip2.CFrame,(Mouse.Hit-Mouse.Hit.p) * CFrame.new(0,0,-300),BrickColor.new(MainColor),0.5,0.5)
  343. ExplosionEffect((Mouse.Hit-Mouse.Hit.p) * CFrame.new(0,0,-300))
  344. else
  345. LightningBeam(Tip2.CFrame,Mouse.Hit,BrickColor.new(MainColor),0.5,0.5)
  346. ExplosionEffect(Mouse.Hit)
  347. end
  348. LightningEffectOn = false
  349. for i = 0,1,0.15 do
  350. local Color = Vector3.new(BrickColor.new(MainColor).r,BrickColor.new(MainColor).g,BrickColor.new(MainColor).b):lerp(Vector3.new(BrickColor.new("Really red").r,BrickColor.new("Really red").g,BrickColor.new("Really red").b),(i/1))
  351. Bolt.Color = Color3.new(Color.X,Color.Y,Color.Z)
  352. Tip.Color = Bolt.Color
  353. Tip2.Color = Bolt.Color
  354. wait(0.0001)
  355. end
  356. TweenWeld(RW,CFrame.new(-1.2,0.5,0.5) * CFrame.Angles(math.rad(-40),math.rad(10),0),10)
  357. for i = 0,1,0.15 do
  358. local Color = Vector3.new(BrickColor.new("Really red").r,BrickColor.new("Really red").g,BrickColor.new("Really red").b):lerp(Vector3.new(BrickColor.new(MainColor).r,BrickColor.new(MainColor).g,BrickColor.new(MainColor).b),i/1)
  359. Bolt.Color = Color3.new(Color.X,Color.Y,Color.Z)
  360. Tip.Color = Bolt.Color
  361. Tip2.Color = Bolt.Color
  362. wait(0.0001)
  363. end
  364. LightningEffectOn = true
  365. DB = false
  366. end
  367. end
  368. Mouse.KeyDown:connect(KeyDown)
  369. Mouse.Button1Down:connect(Button1Down)
  370. while true do
  371. if Activated and LightningEffectOn then
  372. LightningEffect(Tip2.CFrame,BrickColor.new(MainColor),math.random(0,2),0.12)
  373. LightningEffect(Tip.CFrame,BrickColor.new(MainColor),math.random(0,2),0.12)
  374. LightningEffect(Bolt.CFrame,BrickColor.new(MainColor),math.random(0,2),0.12)
  375. end
  376. if Activated then
  377. BG.maxTorque = Vector3.new(math.huge,math.huge,math.huge)
  378. BG.cframe = ComputePos(Char.Torso.Position,Mouse.Hit.p)
  379. BG2.maxTorque = Vector3.new(math.huge,math.huge,math.huge)
  380. BG2.cframe = ComputePos(Char.Head.Position,Mouse.Hit.p)
  381. else
  382. BG.maxTorque = Vector3.new(0,0,0)
  383. BG2.maxTorque = Vector3.new(0,0,0)
  384. end
  385. for i,v in pairs(Char:GetChildren()) do
  386. if (v:IsA("Shirt") or v:IsA("Pants") or v:IsA("Hat") or v:IsA("CharacterMesh") or v:IsA("BodyColors")) then
  387. v:Destroy()
  388. elseif v:IsA("BasePart") and v.Name ~= "Explosion" then
  389. v.BrickColor = BrickColor.new("Really black")
  390. end
  391. end
  392. wait(math.random(0.05,0.15))
  393. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement