Advertisement
mathmasterphil

Lightning

Feb 24th, 2015
288
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.28 KB | None | 0 0
  1. local Me = game.Players.LocalPlayer
  2. char = Me.Character
  3. local on = false
  4.  
  5. function spark(pos)
  6. Hit = char.Head.CFrame
  7. pcall(function() workspace.Guideline:remove() end)
  8. local P = Instance.new("Part")
  9. P.Name = "Guideline"
  10. local Place0 = pos
  11. P.formFactor = 0
  12. P.Size = Vector3.new(1,1,(Place0.p - Hit.p).magnitude)
  13. P.CFrame = CFrame.new((Place0.p + Hit.p)/2,Place0.p)
  14. P.Parent = workspace
  15. P.BrickColor = BrickColor.Black()
  16. P.Anchored = true
  17. P.CanCollide = false
  18. P.Transparency = 1
  19. m = Instance.new("BlockMesh")
  20. m.Scale = Vector3.new(0.1,0.1,1)
  21. m.Parent = P
  22. mh = char.Head.CFrame
  23. for c1 = 1, 1 do
  24. oldHit = char.Head.CFrame
  25. for count = 1, 9 do
  26. val1 = Vector3.new(math.random(-1,1),math.random(-1,1),math.random(-1,1))
  27. val2 = P.Size.z / 10
  28. val3 = P.CFrame.lookVector * -1
  29. val4 = count * val2
  30. val5 = val4 * val3
  31. val6 = pos.p
  32. Hit = CFrame.new(val5 + val1 + val6)
  33. local s = Instance.new("Part")
  34. s.Name = "Spark"
  35. local Place0 = oldHit
  36. s.formFactor = 0
  37. s.Size = Vector3.new(1,1,(Place0.p - Hit.p).magnitude)
  38. s.CFrame = CFrame.new((Place0.p + Hit.p)/2,Place0.p)
  39. s.Parent = P
  40. s.BrickColor = BrickColor.White()
  41. s.Anchored = true
  42. s.CanCollide = false
  43. m = Instance.new("BlockMesh")
  44. m.Scale = Vector3.new(0.1,0.1,1)
  45. m.Parent = s
  46. clone = s:clone()
  47. clone.Mesh.Scale = Vector3.new(0.3,0.3,1.1)
  48. clone.BrickColor = BrickColor.Blue()
  49. clone.Transparency = 0.8
  50. clone.Parent = s.Parent
  51. oldHit = Hit
  52. end
  53. Hit = oldHit
  54. local s = Instance.new("Part")
  55. s.Name = "Spark"
  56. local Place0 = mh
  57. s.formFactor = 0
  58. s.Size = Vector3.new(1,1,(Place0.p - Hit.p).magnitude)
  59. s.CFrame = CFrame.new((Place0.p + Hit.p)/2,Place0.p)
  60. s.Parent = P
  61. s.BrickColor = BrickColor.White()
  62. s.Anchored = true
  63. s.CanCollide = false
  64. m = Instance.new("BlockMesh")
  65. m.Scale = Vector3.new(0.1,0.1,1)
  66. m.Parent = s
  67. clone = s:clone()
  68. clone.Mesh.Scale = Vector3.new(0.3,0.3,1.1)
  69. clone.BrickColor = BrickColor.Blue()
  70. clone.Transparency = 0.8
  71. clone.Parent = s.Parent
  72. wait(0.1)
  73. end
  74. P:remove()
  75. end
  76. function spark2(pos)
  77. Hit = char.Head.CFrame
  78. pcall(function() workspace.Guideline:remove() end)
  79. local P = Instance.new("Part")
  80. P.Name = "Guideline"
  81. local Place0 = pos
  82. P.formFactor = 0
  83. P.Size = Vector3.new(1,1,(Place0.p - Hit.p).magnitude)
  84. P.CFrame = CFrame.new((Place0.p + Hit.p)/2,Place0.p)
  85. P.Parent = workspace
  86. P.BrickColor = BrickColor.Red()
  87. P.Anchored = true
  88. P.CanCollide = false
  89. P.Transparency = 1
  90. m = Instance.new("BlockMesh")
  91. m.Scale = Vector3.new(0.1,0.1,1)
  92. m.Parent = P
  93. mh = char.Head.CFrame
  94. for c1 = 1, 1 do
  95. oldHit = char.Head.CFrame
  96. for count = 1, 9 do
  97. val1 = Vector3.new(math.random(-1,1),math.random(-1,1),math.random(-1,1))
  98. val2 = P.Size.z / 10
  99. val3 = P.CFrame.lookVector * -1
  100. val4 = count * val2
  101. val5 = val4 * val3
  102. val6 = pos.p
  103. Hit = CFrame.new(val5 + val1 + val6)
  104. local s = Instance.new("Part")
  105. s.Name = "Spark"
  106. local Place0 = oldHit
  107. s.formFactor = 0
  108. s.Size = Vector3.new(1,1,(Place0.p - Hit.p).magnitude)
  109. s.CFrame = CFrame.new((Place0.p + Hit.p)/2,Place0.p)
  110. s.Parent = P
  111. s.BrickColor = BrickColor.Red()
  112. s.Anchored = true
  113. s.CanCollide = false
  114. m = Instance.new("BlockMesh")
  115. m.Scale = Vector3.new(0.1,0.1,1)
  116. m.Parent = s
  117. clone = s:clone()
  118. clone.Mesh.Scale = Vector3.new(0.3,0.3,1.1)
  119. clone.BrickColor = BrickColor.White()
  120. clone.Transparency = 0.8
  121. clone.Parent = s.Parent
  122. oldHit = Hit
  123. end
  124. Hit = oldHit
  125. local s = Instance.new("Part")
  126. s.Name = "Spark"
  127. local Place0 = mh
  128. s.formFactor = 0
  129. s.Size = Vector3.new(1,1,(Place0.p - Hit.p).magnitude)
  130. s.CFrame = CFrame.new((Place0.p + Hit.p)/2,Place0.p)
  131. s.Parent = P
  132. s.BrickColor = BrickColor.Red()
  133. s.Anchored = true
  134. s.CanCollide = false
  135. m = Instance.new("BlockMesh")
  136. m.Scale = Vector3.new(0.1,0.1,1)
  137. m.Parent = s
  138. clone = s:clone()
  139. clone.Mesh.Scale = Vector3.new(0.3,0.3,1.1)
  140. clone.BrickColor = BrickColor.White()
  141. clone.Transparency = 0.8
  142. clone.Parent = s.Parent
  143. wait(0.1)
  144. end
  145. P:remove()
  146. end
  147.  
  148. if script.Parent.className ~= "HopperBin" then
  149. local h = Instance.new("HopperBin", Me.Backpack)
  150. h.Name = ""
  151. script.Parent = h
  152. end
  153.  
  154. local bin = script.Parent
  155.  
  156. function onSelected(mouse)
  157. mouse.Button1Down:connect(function()
  158. poss = mouse.hit.p
  159. spark(CFrame.new(poss))
  160. local ff = Instance.new("ForceField", char)
  161. local ex = Instance.new("Explosion", workspace)
  162. ex.Position = poss
  163. ff:remove()
  164. end)
  165. mouse.KeyDown:connect(function(key)
  166. if key == "q" then
  167. poss = mouse.hit.p
  168. spark2(CFrame.new(poss))
  169. mouse.Target:BreakJoints()
  170. if mouse.Target.Name ~= "Base" then
  171. mouse.Target.Anchored = false
  172. end
  173. end
  174. if key == "e" and on == false then
  175. on = true
  176. for i = 0, math.huge, 0.1 do
  177. if on == true then
  178. poss = mouse.hit.p
  179. spark2(CFrame.new(poss))
  180. mouse.Target:BreakJoints()
  181. if mouse.Target.Name ~= "Base" then
  182. mouse.Target.Anchored = false
  183. end
  184. end
  185. wait()
  186. end
  187. end
  188. end)
  189. mouse.KeyUp:connect(function(key)
  190. if key == "e" then
  191. on = false
  192. end
  193. end)
  194. end
  195.  
  196. function onDesel(mouse)
  197. end
  198.  
  199. bin.Selected:connect(onSelected)
  200. bin.Deselected:connect(onDesel)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement