Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local rad = math.rad
- local random = math.random
- local acos = math.acos
- local sin = math.sin
- local cos = math.cos
- wait(1)
- local Debounce = false
- local RunService = game:GetService("RunService")
- local Debris = game:GetService("Debris")
- local Player = game.Players:FindFirstChild("Dark_Eccentric")
- if not Player then
- Player = game.Players:FindFirstChild("Player1")
- end
- mouse = Player:GetMouse()
- local Character = Player.Character
- local Torso = Character.Torso
- local Humanoid = Character.Humanoid
- local MAXV3 = Vector3.new(1,1,1)*math.huge
- local Tool = Instance.new("Tool",Player.Backpack)
- Tool.Name = "Lightning"
- Tool.GripPos = Vector3.new(0,0,-0.9)
- Tool.GripForward = Vector3.new(1,0,0)
- Tool.GripRight = Vector3.new(0,-1,0)
- Tool.GripUp = Vector3.new(0,0,1)
- local Staff = Instance.new("Part",Tool)
- Staff.Name = "Handle"
- Staff.TopSurface = "Smooth"
- Staff.BottomSurface = "Smooth"
- Staff.FormFactor = "Custom"
- Staff.CanCollide = false
- Staff.Size = Vector3.new(1,0.8,8)
- local Mesh = Instance.new("SpecialMesh",Staff)
- Mesh.MeshId = "http://www.roblox.com/asset/?id=27840040"
- Mesh.TextureId = "http://www.roblox.com/asset/?id=27840082"
- Mesh.Scale = Vector3.new(2,1,1)
- local LightningPart = Instance.new("Part")
- LightningPart.TopSurface = 0
- LightningPart.BottomSurface = 0
- LightningPart.FormFactor = "Symmetric"
- LightningPart.Size = Vector3.new(1,1,1)
- LightningPart.Material = "Neon"
- LightningPart.Anchored = true
- LightningPart.CanCollide = false
- LightningPart.BrickColor = BrickColor.new("Bright blue")
- Instance.new("BlockMesh",LightningPart)
- function FindHumanoid(p)
- if p == workspace then
- return
- end
- local h = p:FindFirstChild("Humanoid")
- if h and h.Health > 0 and h ~= Humanoid then
- return h
- else
- return FindHumanoid(p.Parent)
- end
- end
- function SetLine(part, pos1, pos2, size)
- size = size or 0.15
- local mid = (pos1+pos2)/2
- local dist = (pos1-pos2).magnitude
- if dist <= 0 then
- return
- end
- part["Mesh"].Scale = Vector3.new(size,size,dist)
- part.CFrame = CFrame.new(mid,pos2)
- end
- function Perpendicular(vector)
- local v2 = Vector3.new(random(),random(),random()).unit
- return vector:Cross(v2)
- end
- function DrawLightning(pos1, pos2, displace, detail, size)
- if displace < detail then
- local p = LightningPart:clone()
- p.Parent = workspace
- SetLine(p, pos1, pos2, size)
- game:GetService("Debris"):AddItem(p,0.08+random()/10)
- else
- local mid = (pos1+pos2)/2
- mid = mid + Vector3.new(random()-0.5, random()-0.5, random()-0.5)*displace
- DrawLightning(pos1, mid, displace/2, detail,size)
- DrawLightning(mid, pos2, displace/2, detail,size)
- end
- end
- function FindClosest()
- local closest = nil
- local angle = rad(25)
- local lv = Torso.CFrame.lookVector
- for _,v in pairs(game.Players:GetPlayers()) do
- if v ~= Player then
- local char = v.Character
- if char and char:FindFirstChild("Humanoid") and char.Humanoid.Health > 0 then
- local pos = char.Torso.Position
- local lv2 = (pos-Torso.Position).unit
- local a = acos(lv:Dot(lv2))
- if a <= angle then
- angle = a
- closest = char
- end
- end
- end
- end
- return closest
- end
- function LaunchParticle(origin, part, dir, speed, spin_velocity, life_time, property_velocity)
- if not dir then
- dir = Vector3.new(random()-0.5,random()-0.5,random()-0.5)
- dir = dir/dir.magnitude
- end
- property_velocity = property_velocity or false
- speed = speed or random(30,40)
- spin_velocity = spin_velocity or Vector3.new()
- part = part --or CreatePart(nil)
- part.CFrame = CFrame.new(origin,origin+dir)
- if not property_velocity then
- local bv = Instance.new("BodyVelocity",part)
- bv.maxForce = MAXV3
- bv.velocity = dir*speed
- else
- part.Velocity = dir*speed
- end
- if spin_velocity.magnitude > 0 then
- local ba = Instance.new("BodyAngularVelocity",part)
- ba.maxTorque = MAXV3
- ba.angularvelocity = spin_velocity
- end
- Debris:AddItem(part,life_time)
- end
- local Rock = Instance.new("Part")
- Rock.Size = Vector3.new(1,1,1)*4
- Rock.TopSurface = "Smooth"
- Rock.BottomSurface = "Smooth"
- function Crater(pos)
- local angle
- local baseCF = CFrame.new(pos)
- local maxParts = 20
- for i = 0,maxParts do
- angle = random()*2*math.pi
- local origin = baseCF*CFrame.Angles(0,angle,0)*CFrame.new(0,0,random(6,10))
- local part2 = Rock:Clone()
- --part2.CanCollide = false
- part2.Parent = workspace
- part2.Size = Vector3.new(1,1,1)*random(3,7)
- part2.BrickColor = BrickColor.new("Cocoa")
- local dir = CFrame.new(baseCF.p,(origin*CFrame.new(0,random(6,13),0)).p).lookVector
- LaunchParticle(origin.p,part2,dir,random(50,100),nil,0.9,true)
- end
- end
- function Judgment()
- local ClosestBody = FindClosest()
- if not ClosestBody then
- --ClosestBody = Character
- end
- if ClosestBody then
- local pos = ClosestBody.Torso.Position
- DrawLightning(pos+Vector3.new(0,500,0),pos-Vector3.new(0,3,0), 150, 10, 20)
- Crater(pos-Vector3.new(0,3,0))
- ClosestBody.Humanoid:TakeDamage(15)
- end
- end
- function NearestPlayers(pos, dist)
- local players = {}
- for _,v in pairs(game.Players:GetPlayers()) do
- if v.Character and v.Character:FindFirstChild("Humanoid") and v.Character.Humanoid.Health > 0 then
- local d = (pos-v.Character.Torso.Position).magnitude
- if d <= dist then
- table.insert(players,v.Character)
- end
- end
- end
- return players
- end
- function onKeyDown(key)
- if key == "f" then
- local displace = 50
- local detail = 1
- for radius = 1, 30,0.5 do
- local base = Torso.Position + Vector3.new(cos(random()*2*math.pi)*radius,-2.5,sin(random()*2*math.pi)*radius)
- local players = NearestPlayers(base,7)
- for _,v in pairs(players) do
- v.Humanoid:TakeDamage(4)
- end
- local top = base + Vector3.new(0,50,0)
- DrawLightning(top,base, displace, detail)
- wait(0.03)
- end
- end
- end
- mouse.KeyDown:connect(onKeyDown)
- Tool.Activated:connect(function()
- Judgment()
- end)
Add Comment
Please, Sign In to add comment