Dark_EccentricYT

Untitled

Aug 4th, 2018
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.81 KB | None | 0 0
  1.  
  2. local rad = math.rad
  3. local random = math.random
  4. local acos = math.acos
  5. local sin = math.sin
  6. local cos = math.cos
  7.  
  8. wait(1)
  9. local Debounce = false
  10. local RunService = game:GetService("RunService")
  11. local Debris = game:GetService("Debris")
  12. local Player = game.Players:FindFirstChild("Dark_Eccentric")
  13. if not Player then
  14. Player = game.Players:FindFirstChild("Player1")
  15. end
  16. mouse = Player:GetMouse()
  17. local Character = Player.Character
  18. local Torso = Character.Torso
  19. local Humanoid = Character.Humanoid
  20. local MAXV3 = Vector3.new(1,1,1)*math.huge
  21.  
  22. local Tool = Instance.new("Tool",Player.Backpack)
  23. Tool.Name = "Lightning"
  24. Tool.GripPos = Vector3.new(0,0,-0.9)
  25. Tool.GripForward = Vector3.new(1,0,0)
  26. Tool.GripRight = Vector3.new(0,-1,0)
  27. Tool.GripUp = Vector3.new(0,0,1)
  28. local Staff = Instance.new("Part",Tool)
  29. Staff.Name = "Handle"
  30. Staff.TopSurface = "Smooth"
  31. Staff.BottomSurface = "Smooth"
  32. Staff.FormFactor = "Custom"
  33. Staff.CanCollide = false
  34. Staff.Size = Vector3.new(1,0.8,8)
  35. local Mesh = Instance.new("SpecialMesh",Staff)
  36. Mesh.MeshId = "http://www.roblox.com/asset/?id=27840040"
  37. Mesh.TextureId = "http://www.roblox.com/asset/?id=27840082"
  38. Mesh.Scale = Vector3.new(2,1,1)
  39.  
  40. local LightningPart = Instance.new("Part")
  41. LightningPart.TopSurface = 0
  42. LightningPart.BottomSurface = 0
  43. LightningPart.FormFactor = "Symmetric"
  44. LightningPart.Size = Vector3.new(1,1,1)
  45. LightningPart.Material = "Neon"
  46. LightningPart.Anchored = true
  47. LightningPart.CanCollide = false
  48. LightningPart.BrickColor = BrickColor.new("Bright blue")
  49. Instance.new("BlockMesh",LightningPart)
  50.  
  51. function FindHumanoid(p)
  52. if p == workspace then
  53. return
  54. end
  55. local h = p:FindFirstChild("Humanoid")
  56. if h and h.Health > 0 and h ~= Humanoid then
  57. return h
  58. else
  59. return FindHumanoid(p.Parent)
  60. end
  61. end
  62.  
  63. function SetLine(part, pos1, pos2, size)
  64. size = size or 0.15
  65. local mid = (pos1+pos2)/2
  66. local dist = (pos1-pos2).magnitude
  67. if dist <= 0 then
  68. return
  69. end
  70. part["Mesh"].Scale = Vector3.new(size,size,dist)
  71. part.CFrame = CFrame.new(mid,pos2)
  72. end
  73.  
  74. function Perpendicular(vector)
  75. local v2 = Vector3.new(random(),random(),random()).unit
  76. return vector:Cross(v2)
  77. end
  78.  
  79.  
  80. function DrawLightning(pos1, pos2, displace, detail, size)
  81. if displace < detail then
  82. local p = LightningPart:clone()
  83. p.Parent = workspace
  84. SetLine(p, pos1, pos2, size)
  85. game:GetService("Debris"):AddItem(p,0.08+random()/10)
  86. else
  87. local mid = (pos1+pos2)/2
  88. mid = mid + Vector3.new(random()-0.5, random()-0.5, random()-0.5)*displace
  89. DrawLightning(pos1, mid, displace/2, detail,size)
  90. DrawLightning(mid, pos2, displace/2, detail,size)
  91. end
  92. end
  93.  
  94. function FindClosest()
  95. local closest = nil
  96. local angle = rad(25)
  97. local lv = Torso.CFrame.lookVector
  98. for _,v in pairs(game.Players:GetPlayers()) do
  99. if v ~= Player then
  100. local char = v.Character
  101. if char and char:FindFirstChild("Humanoid") and char.Humanoid.Health > 0 then
  102. local pos = char.Torso.Position
  103. local lv2 = (pos-Torso.Position).unit
  104. local a = acos(lv:Dot(lv2))
  105. if a <= angle then
  106. angle = a
  107. closest = char
  108. end
  109. end
  110. end
  111. end
  112. return closest
  113. end
  114.  
  115. function LaunchParticle(origin, part, dir, speed, spin_velocity, life_time, property_velocity)
  116. if not dir then
  117. dir = Vector3.new(random()-0.5,random()-0.5,random()-0.5)
  118. dir = dir/dir.magnitude
  119. end
  120. property_velocity = property_velocity or false
  121. speed = speed or random(30,40)
  122. spin_velocity = spin_velocity or Vector3.new()
  123. part = part --or CreatePart(nil)
  124. part.CFrame = CFrame.new(origin,origin+dir)
  125. if not property_velocity then
  126. local bv = Instance.new("BodyVelocity",part)
  127. bv.maxForce = MAXV3
  128. bv.velocity = dir*speed
  129. else
  130. part.Velocity = dir*speed
  131. end
  132. if spin_velocity.magnitude > 0 then
  133. local ba = Instance.new("BodyAngularVelocity",part)
  134. ba.maxTorque = MAXV3
  135. ba.angularvelocity = spin_velocity
  136. end
  137. Debris:AddItem(part,life_time)
  138. end
  139.  
  140. local Rock = Instance.new("Part")
  141. Rock.Size = Vector3.new(1,1,1)*4
  142. Rock.TopSurface = "Smooth"
  143. Rock.BottomSurface = "Smooth"
  144.  
  145. function Crater(pos)
  146. local angle
  147. local baseCF = CFrame.new(pos)
  148. local maxParts = 20
  149. for i = 0,maxParts do
  150. angle = random()*2*math.pi
  151. local origin = baseCF*CFrame.Angles(0,angle,0)*CFrame.new(0,0,random(6,10))
  152. local part2 = Rock:Clone()
  153. --part2.CanCollide = false
  154. part2.Parent = workspace
  155. part2.Size = Vector3.new(1,1,1)*random(3,7)
  156. part2.BrickColor = BrickColor.new("Cocoa")
  157. local dir = CFrame.new(baseCF.p,(origin*CFrame.new(0,random(6,13),0)).p).lookVector
  158. LaunchParticle(origin.p,part2,dir,random(50,100),nil,0.9,true)
  159. end
  160. end
  161.  
  162.  
  163. function Judgment()
  164. local ClosestBody = FindClosest()
  165. if not ClosestBody then
  166. --ClosestBody = Character
  167. end
  168. if ClosestBody then
  169. local pos = ClosestBody.Torso.Position
  170. DrawLightning(pos+Vector3.new(0,500,0),pos-Vector3.new(0,3,0), 150, 10, 20)
  171. Crater(pos-Vector3.new(0,3,0))
  172. ClosestBody.Humanoid:TakeDamage(15)
  173. end
  174. end
  175.  
  176. function NearestPlayers(pos, dist)
  177. local players = {}
  178. for _,v in pairs(game.Players:GetPlayers()) do
  179. if v.Character and v.Character:FindFirstChild("Humanoid") and v.Character.Humanoid.Health > 0 then
  180. local d = (pos-v.Character.Torso.Position).magnitude
  181. if d <= dist then
  182. table.insert(players,v.Character)
  183. end
  184. end
  185. end
  186. return players
  187. end
  188.  
  189. function onKeyDown(key)
  190. if key == "f" then
  191. local displace = 50
  192. local detail = 1
  193. for radius = 1, 30,0.5 do
  194. local base = Torso.Position + Vector3.new(cos(random()*2*math.pi)*radius,-2.5,sin(random()*2*math.pi)*radius)
  195. local players = NearestPlayers(base,7)
  196. for _,v in pairs(players) do
  197. v.Humanoid:TakeDamage(4)
  198. end
  199. local top = base + Vector3.new(0,50,0)
  200. DrawLightning(top,base, displace, detail)
  201. wait(0.03)
  202. end
  203. end
  204. end
  205. mouse.KeyDown:connect(onKeyDown)
  206. Tool.Activated:connect(function()
  207. Judgment()
  208. end)
Add Comment
Please, Sign In to add comment