Advertisement
EpicZombie226_YT

Lightning Strike (Script made by me)

May 16th, 2018
1,774
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.31 KB | None | 0 0
  1. --Made By--LocalScripter local
  2. print ("Loading:", script.Name)
  3.  
  4. local cloudHeight = script.Parent.Position.Y -- Where the top of the lightning is
  5. local base = 0 -- Where the bottom of the lightning is
  6. local flash = {}
  7. sound = Instance.new("Sound") -- Lightning Sound
  8. sound.Name = "LightningSound"
  9. sound.Volume = 1
  10. sound.Parent = game.Workspace
  11. print (script.Name, "have sucessful loaded :)")
  12. function createBolt(start, stop)
  13. local bolt = Instance.new("Part")
  14. bolt.Name = "Bolt"
  15. bolt.Anchored = true
  16. bolt.Locked = true
  17. bolt.CanCollide = false
  18. bolt.BrickColor = BrickColor.new("Institutional white")
  19. bolt.Size = Vector3.new(3, math.abs((stop - start).magnitude), 3)
  20. bolt.CFrame = CFrame.new(start.x, (cloudHeight - base)/2, start.z)
  21. bolt.Parent = script
  22. local lb = Instance.new("PointLight")
  23. lb.Parent = bolt
  24. lb.Brightness = 5035
  25. lb.Range = 100
  26. lb.Color = Color3.new(255, 255, 225)
  27. lb.Shadows = true
  28. local ebs = script.Electric:Clone()
  29. ebs.Parent = bolt
  30. ebs.Disabled = false
  31. wait(0)
  32. return bolt
  33. end
  34.  
  35. while true do
  36. wait(math.random(5, 15)) -- Change the intervals if you wish
  37. wait(1.5)
  38. game.Lighting.Brightness = game.Lighting.Brightness + 3
  39. 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
  40. local bolt = createBolt(Vector3.new(axis.x, cloudHeight, axis.z), Vector3.new(axis.x, base, axis.z))
  41. for i = 1, math.random(4, 8) do -- Creates the excess lighnting
  42. local part = bolt:clone()
  43. part.Size = Vector3.new(1, 1, 1)
  44. 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)
  45. part.CFrame = part.CFrame * CFrame.fromEulerAnglesXYZ(-math.random(25, 125)/100, 0, 0)
  46. part.Parent = script.Parent.Parent
  47. table.insert(flash, part)
  48. end
  49. game.Lighting.Brightness = game.Lighting.Brightness - 3
  50. for i = 1, 5 do
  51. for x = 1, #flash do
  52. local increment = math.random(6, 30)
  53. local origin = flash[x].CFrame
  54. flash[x].Size = flash[x].Size + Vector3.new(0, 0, increment)
  55. flash[x].CFrame = origin + flash[x].CFrame.lookVector * increment/2
  56. end
  57. wait()
  58. end
  59. wait(0.5)
  60. for i = 1, 10 do for x = 1, #flash do flash.Transparency = i/10 end bolt.Transparency = i/10 wait() end
  61. if bolt ~= nil then
  62. bolt.Parent = nil
  63. for i = 1, #flash do if flash[i] ~= nil then flash[i].Parent = nil end end
  64. flash = nil
  65. flash = {}
  66. end
  67. sound.Pitch = math.random(1, 3) -- This creates a high pitched lightning sound, but not too high pitched
  68. soundid = math.random(1,5)
  69. if soundid == 1 then
  70. sound.SoundId = "http://www.roblox.com/asset/?id=12222019"
  71. end
  72. if soundid == 2 then
  73. sound.SoundId = "http://www.roblox.com/asset/?id=12222030"
  74. end
  75. if soundid == 3 then
  76. sound.SoundId = "http://www.roblox.com/asset/?id=133426162"
  77. end
  78. if soundid == 4 then
  79. sound.SoundId = "http://www.roblox.com/asset/?id=131332129"
  80. end
  81. if soundid == 4 then
  82. sound.SoundId = "http://www.roblox.com/asset/?id=131300621"
  83. end
  84. if soundid == 5 then
  85. sound.SoundId = "http://www.roblox.com/asset/?id=130818250"
  86. end
  87. sound:play()
  88. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement