Advertisement
aiden50_70

Untitled

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