Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Made By--LocalScripter local
- print ("Loading:", script.Name)
- local cloudHeight = script.Parent.Position.Y -- Where the top of the lightning is
- local base = 0 -- Where the bottom of the lightning is
- local flash = {}
- sound = Instance.new("Sound") -- Lightning Sound
- sound.Name = "LightningSound"
- sound.Volume = 1
- sound.Parent = game.Workspace
- print (script.Name, "have sucessful loaded :)")
- function createBolt(start, stop)
- local bolt = Instance.new("Part")
- bolt.Name = "Bolt"
- bolt.Anchored = true
- bolt.Locked = true
- bolt.CanCollide = false
- bolt.BrickColor = BrickColor.new("Institutional white")
- bolt.Size = Vector3.new(3, math.abs((stop - start).magnitude), 3)
- bolt.CFrame = CFrame.new(start.x, (cloudHeight - base)/2, start.z)
- bolt.Parent = script
- local lb = Instance.new("PointLight")
- lb.Parent = bolt
- lb.Brightness = 5035
- lb.Range = 100
- lb.Color = Color3.new(255, 255, 225)
- lb.Shadows = true
- local ebs = script.Electric:Clone()
- ebs.Parent = bolt
- ebs.Disabled = false
- wait(0)
- return bolt
- end
- while true do
- wait(math.random(5, 15)) -- Change the intervals if you wish
- wait(1.5)
- game.Lighting.Brightness = game.Lighting.Brightness + 3
- local axis = Vector3.new(math.random(script.Parent.Mesh.Scale.X - script.Parent.Mesh.Scale.X - script.Parent.Mesh.Scale.X, script.Parent.Mesh.Scale.X), base, math.random(script.Parent.Mesh.Scale.Y - script.Parent.Mesh.Scale.Y - script.Parent.Mesh.Scale.Y, script.Parent.Mesh.Scale.Y)) -- Change intervals to the size of your base
- local bolt = createBolt(Vector3.new(axis.x, cloudHeight, axis.z), Vector3.new(axis.x, base, axis.z))
- for i = 1, math.random(4, 8) do -- Creates the excess lighnting
- local part = bolt:clone()
- part.Size = Vector3.new(1, 1, 1)
- part.CFrame = (CFrame.new(axis) + Vector3.new(0, math.random(1, (cloudHeight - base)/1.5), 0)) * CFrame.fromEulerAnglesXYZ(0, math.random(-314, 314)/100, 0)
- part.CFrame = part.CFrame * CFrame.fromEulerAnglesXYZ(-math.random(25, 125)/100, 0, 0)
- part.Parent = script.Parent.Parent
- table.insert(flash, part)
- end
- game.Lighting.Brightness = game.Lighting.Brightness - 3
- for i = 1, 5 do
- for x = 1, #flash do
- local increment = math.random(6, 30)
- local origin = flash[x].CFrame
- flash[x].Size = flash[x].Size + Vector3.new(0, 0, increment)
- flash[x].CFrame = origin + flash[x].CFrame.lookVector * increment/2
- end
- wait()
- end
- wait(0.5)
- for i = 1, 10 do for x = 1, #flash do flash.Transparency = i/10 end bolt.Transparency = i/10 wait() end
- if bolt ~= nil then
- bolt.Parent = nil
- for i = 1, #flash do if flash[i] ~= nil then flash[i].Parent = nil end end
- flash = nil
- flash = {}
- end
- sound.Pitch = math.random(1, 3) -- This creates a high pitched lightning sound, but not too high pitched
- soundid = math.random(1,5)
- if soundid == 1 then
- sound.SoundId = "http://www.roblox.com/asset/?id=12222019"
- end
- if soundid == 2 then
- sound.SoundId = "http://www.roblox.com/asset/?id=12222030"
- end
- if soundid == 3 then
- sound.SoundId = "http://www.roblox.com/asset/?id=133426162"
- end
- if soundid == 4 then
- sound.SoundId = "http://www.roblox.com/asset/?id=131332129"
- end
- if soundid == 4 then
- sound.SoundId = "http://www.roblox.com/asset/?id=131300621"
- end
- if soundid == 5 then
- sound.SoundId = "http://www.roblox.com/asset/?id=130818250"
- end
- sound:play()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement