Advertisement
aiden50_70

Untitled

May 26th, 2019
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.84 KB | None | 0 0
  1. swait=function(num)
  2. if num==nil or num==0 then
  3. game:GetService("RunService").Heartbeat:Wait(0)
  4. else
  5. for i=0,num do
  6. game:GetService("RunService").Heartbeat:Wait(0)
  7. end
  8. end
  9. end
  10.  
  11. local Base = Instance.new("Part")
  12. Base.Name = "BoltChunk"
  13. Base.formFactor = "Custom"
  14. Base.TopSurface = 0
  15. Base.BottomSurface = 0
  16. Base.Anchored = true
  17. Base.Transparency = 0.4
  18. Base.Reflectance = 0.4
  19. Base.BrickColor = BrickColor.new("Medium blue")
  20. Instance.new("Sparkles", Base).SparkleColor = Base.Color
  21. local Leaves = Base:Clone()
  22. Leaves.Name = "Leaves"
  23. Leaves.CanCollide = false
  24. Leaves.BrickColor = BrickColor.new("Really black")
  25. Leaves.Transparency = 0
  26. Leaves.Reflectance = 0.1
  27. local leafmesh = Instance.new("SpecialMesh")
  28. leafmesh.Parent = Leaves
  29. Instance.new("CylinderMesh",Base)
  30.  
  31.  
  32. function dot(c1,c2)
  33. local m = CFrame.Angles(math.pi/2,0,0)
  34. return (c1*m).lookVector:Dot((c2*m).lookVector)
  35. end
  36.  
  37. local leaf_mult = {
  38. Vector3.new(1.5,1.5,1.2);
  39. Vector3.new(1.5,1,1.5);
  40. Vector3.new(1.2,1.5,1.5);
  41. Vector3.new(1.5,1.5,1.5);
  42. }
  43.  
  44. function Branch(base,c)
  45. if c <= 0 then
  46.  
  47. local leaves = Leaves:Clone()
  48. local vol = base.Size.x+base.Size.y+base.Size.z
  49. leaves.CFrame = base.CFrame * CFrame.new(0,base.Size.y/2,0)
  50. leaves.Parent = base.Parent
  51. else
  52. local pos = base.CFrame*CFrame.new(0,base.Size/2,0)
  53. local height = base.Size.y
  54. local width = base.Size.x
  55. local nb = 1
  56. local r = math.random(3,25)
  57.  
  58. local da = math.random(20+55/c,40+40/c)
  59.  
  60. local ba = math.random(-da/3,da/3)
  61.  
  62.  
  63. for i=0,nb-1 do
  64. local branch = base:Clone()
  65. branch.Name = "Branch"
  66. local h = height*math.random(95,115)/100 -- height .95 to 1.15 of original
  67.  
  68. local new = branch.CFrame * CFrame.new(0,height/2,0) * CFrame.Angles(0,0,math.rad(ba))
  69. new = new * CFrame.Angles(0,i*(math.pi*2/nb)+r,math.rad(da/2)) * CFrame.new(0,h/2,0)
  70.  
  71.  
  72. local w = dot(new,branch.CFrame)*width*0.9
  73.  
  74. branch.Size = Vector3.new(width,h,width)
  75. branch.CFrame = new
  76. branch.Parent = base.Parent
  77. branch.Material = 'Neon'
  78. branch.BrickColor = BrickColor.new('Cyan')
  79.  
  80. Branch(branch,c-1)
  81. swait()
  82. end
  83. end
  84. end
  85.  
  86. function Flash()
  87. local Lighting = game:GetService('Lighting')
  88. Lighting.Brightness = 12
  89. wait(.3)
  90. Lighting.Brightness = -0.5
  91. end
  92.  
  93. function GenerateBolt(location,complexity,width,height)
  94. local tree = Instance.new("Model")
  95. tree.Name = "Lightning Bolt"
  96. tree.Parent = workspace
  97. local base = Base:Clone()
  98. base.Parent = tree
  99. base.Size = Vector3.new(width,height,width)
  100. base.CFrame = CFrame.new(location) * CFrame.new(0,height/2,0) * CFrame.Angles(0,math.rad(math.random(1,360)),0)
  101. Branch(base,complexity)
  102. local expl = Instance.new("Explosion")
  103. expl.ExplosionType = 0
  104. expl.BlastRadius = 15
  105. expl.BlastPressure = expl.BlastPressure * 8
  106. expl.Position = location
  107. expl.Parent = workspace
  108. local sounds = {'rbxassetid://539649706','rbxassetid://858154930','rbxassetid://821439273','rbxassetid://224339201'}
  109. local s = Instance.new('Sound',workspace)
  110. s.Volume = 1
  111. s.SoundId = sounds[math.random(1,#sounds)]
  112. s:Play()
  113. Flash()
  114. game:GetService("Debris"):AddItem(tree,math.random(0.01,.1))
  115. end
  116.  
  117. function NewStorm()
  118. local function Cloud(x,z,size,lightning)
  119. spawn(function()
  120. local c = Instance.new("Part",workspace)
  121. c.Size = Vector3.new(1,1,1)
  122. c.CanCollide = false
  123. c.CastShadow = true
  124. c.Anchored = true
  125. c.Position = Vector3.new(x,350,z)
  126. c.BrickColor = BrickColor.DarkGray()
  127. local m = Instance.new('FileMesh',c)
  128. m.MeshId = 'http://www.roblox.com/asset/?id=1095708'
  129. game:GetService("RunService").Stepped:Connect(function()
  130. c.CFrame = c.CFrame * CFrame.Angles(0,0.05,0)
  131. c.CFrame = c.CFrame * CFrame.new(math.random(-1,1),0,math.random(-1,1))
  132. end)
  133. for i = 1, size+512 do
  134. swait()
  135. m.Scale = m.Scale + Vector3.new(0.07,.07,0.07)
  136. if lightning then
  137. if math.random(1,160)==6 then
  138. local num = c.Position.Y+2
  139. local max = i
  140. if num > max then
  141. num = max
  142. end
  143. GenerateBolt(Vector3.new(c.Position.X,0,c.Position.Z),5,3,50)
  144. end
  145. end
  146. end
  147. end)
  148. end
  149. local f = Instance.new('Sound',workspace)
  150. f.Volume = 1
  151. f.SoundId = 'rbxassetid://186377104'
  152. f.Looped = true
  153. f:Play()
  154. for i = 1, 50 do
  155. game.Lighting.Brightness = game.Lighting.Brightness - 0.05
  156. swait()
  157. end
  158. for i = 1, 100 do -- create the storm
  159. local f = false
  160. if math.random(1,5)==3 then
  161. f = true
  162. end
  163. Cloud(math.random(-300,300),math.random(-300,300),math.random(100,625),f)
  164. wait(math.random(0.001,0.4))
  165. end
  166. -- tornado
  167. wait(4)
  168. local tor_base = Instance.new('Part',workspace)
  169. tor_base.Size = Vector3.new(1,1,1)
  170. tor_base.Transparency = .25
  171. tor_base.Anchored = true
  172. tor_base.CanCollide = false
  173. tor_base.CFrame = CFrame.new(0,0,0)
  174. --local ms = Instance.new('FileMesh',tor_base)
  175. --ms.Scale = Vector3.new(50,50,50)
  176. --ms.MeshId = 'http://www.roblox.com/asset/?id=102638417'
  177. local Smoke = Instance.new('Smoke',tor_base)
  178. Smoke.Opacity = 1
  179. Smoke.RiseVelocity = 10
  180. Smoke.Size = 3
  181. Smoke.Color = Color3.fromRGB(126,126,126)
  182. local partc = Instance.new('ParticleEmitter',tor_base)
  183. partc.Texture = 'rbxasset://textures/particles/smoke_main.dds'
  184. partc.Color = ColorSequence.new({ColorSequenceKeypoint.new(0,Color3.fromRGB(126,126,126)),ColorSequenceKeypoint.new(1,Color3.fromRGB(126,126,126))})
  185. partc.Size = NumberSequence.new({NumberSequenceKeypoint.new(0,0),NumberSequenceKeypoint.new(1,30)})
  186. partc.Transparency = NumberSequence.new({NumberSequenceKeypoint.new(0,0),NumberSequenceKeypoint.new(1,1)})
  187. partc.Rate = 300
  188. partc.Speed = NumberRange.new(1,22)
  189. partc.SpreadAngle = Vector2.new(20,20)
  190.  
  191. local partc2 = Instance.new('ParticleEmitter',tor_base)
  192. partc2.Texture = 'rbxasset://textures/particles/smoke_main.dds'
  193. partc2.Color = ColorSequence.new({ColorSequenceKeypoint.new(0,Color3.fromRGB(126,126,126)),ColorSequenceKeypoint.new(1,Color3.fromRGB(126,126,126))})
  194. partc2.Size = NumberSequence.new({NumberSequenceKeypoint.new(0,0),NumberSequenceKeypoint.new(1,50)})
  195. partc2.Transparency = NumberSequence.new({NumberSequenceKeypoint.new(0,0),NumberSequenceKeypoint.new(1,1)})
  196. partc2.Rate = 300
  197. partc2.Lifetime = NumberRange.new(15,28)
  198. partc2.Speed = NumberRange.new(7,12)
  199. partc2.SpreadAngle = Vector2.new(30,30)
  200.  
  201. local s1 = 'rbxassetid://318451789'
  202. local s2 = 'rbxassetid://184973424'
  203. local so = Instance.new("Sound",tor_base)
  204. so.SoundId = s1
  205. so.Volume = 1
  206. so.Looped = true
  207. so:Play()
  208. local so2 = Instance.new("Sound",tor_base)
  209. so2.SoundId = s2
  210. so2.Volume = 1
  211. so2.Looped = true
  212. so2:Play()
  213. local count = 0
  214. local dirX,dirZ=0,5
  215. function Scan(obj)
  216. local f = {}
  217. for i,v in pairs(obj:GetChildren()) do
  218. table.insert(f,v)
  219. end
  220. for i,v in pairs(f) do
  221.  
  222. if v:IsA("BasePart") then
  223. local mag = (tor_base.Position-v.Position).magnitude
  224. if mag<=45 then
  225. local vel = Instance.new('BodyVelocity',v)
  226. vel.Velocity = (v.Position-tor_base.Position).unit*-(70/(mag))+Vector3.new(math.random(-13,13),0,math.random(-13,13))
  227. vel.MaxForce = Vector3.new(999,999,999)*999999999999e99
  228. vel.P = 30003333333
  229. game:GetService("Debris"):AddItem(vel,0.1)
  230. elseif mag <=0 then
  231. local vel = Instance.new('BodyVelocity',v)
  232. vel.Velocity = Vector3.new(math.random(-300,300),math.random(-300,300),math.random(-300,300))
  233. vel.MaxForce = Vector3.new(999,999,999)*999999999999e99
  234. vel.P = 30003333333
  235. end
  236. elseif v:IsA("Model") and not v:FindFirstChild('Head') then
  237. for a,b in pairs(v:GetChildren()) do
  238. if b:IsA('BasePart') and b:GetMass()<300 then
  239. b.Anchored = false
  240. local mag = (tor_base.Position-b.Position).magnitude
  241. if mag<=45 then
  242. b.Parent:BreakJoints()
  243. b:BreakJoints()
  244. local vel = Instance.new('BodyVelocity',b)
  245. vel.Velocity = (b.Position-tor_base.Position).unit*-(70/(mag))+Vector3.new(math.random(-13,13),0,math.random(-13,13))
  246. vel.MaxForce = Vector3.new(999,999,999)*999999999999e99
  247. vel.P = 30003333333
  248. game:GetService("Debris"):AddItem(vel,0.1)
  249. elseif mag <=0 then
  250. local vel = Instance.new('BodyVelocity',b)
  251. vel.Velocity = Vector3.new(math.random(-300,300),math.random(-300,300),math.random(-300,300))
  252. vel.MaxForce = Vector3.new(999,999,999)*999999999999e99
  253. vel.P = 30003333333
  254. end
  255. end
  256. end
  257. elseif v:IsA("Model") and v:FindFirstChild('Head') then
  258. local vf = v.Head
  259. local mag = (tor_base.Position-vf.Position).magnitude
  260. if mag<=45 then
  261. local vel = Instance.new('BodyVelocity',vf)
  262. vel.Velocity = (vf.Position-tor_base.Position).unit*-(70/(mag))+Vector3.new(math.random(-13,13),0,math.random(-13,13))
  263. vel.MaxForce = Vector3.new(999,999,999)*999999999999e99
  264. vel.P = 30003333333
  265. game:GetService("Debris"):AddItem(vel,0.1)
  266. if v:findFirstChildOfClass('Humanoid') then
  267. if math.random(1,12)==5 then
  268. v:findFirstChildOfClass('Humanoid'):TakeDamage(1)
  269. end
  270. end
  271. elseif mag<=5 then
  272. local vel = Instance.new('BodyVelocity',vf)
  273. vel.Velocity = Vector3.new(math.random(-300,300),math.random(-300,300),math.random(-300,300))
  274. vel.MaxForce = Vector3.new(999,999,999)*999999999999e99
  275. vel.P = 30003333333
  276. end
  277. end
  278. end
  279. return
  280. end
  281. game:GetService("RunService").Stepped:Connect(function()
  282. -- tornado damage
  283. Scan(workspace)
  284. for i,v in pairs(workspace:GetChildren()) do
  285. Scan(v)
  286. end
  287. -- effects and movement
  288. tor_base.CFrame=tor_base.CFrame*CFrame.new(dirX/50,0,dirZ/50)
  289. count = count + 1
  290. if math.random(1,100)==count then
  291. count = 1
  292. print("New Direction")
  293. dirX = math.random(-3,3)
  294. dirZ = math.random(-3,3)
  295. end
  296. if math.random(1,100)==52 then
  297. print('Lightning')
  298. GenerateBolt(Vector3.new(tor_base.Position.X+math.random(-13,13),0,tor_base.Position.Y+math.random(-13,13)),5,7,50)
  299. end
  300. end)
  301. end
  302. wait(5)
  303. NewStorm()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement