Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- swait=function(num)
- if num==nil or num==0 then
- game:GetService("RunService").Heartbeat:Wait(0)
- else
- for i=0,num do
- game:GetService("RunService").Heartbeat:Wait(0)
- end
- end
- end
- local Base = Instance.new("Part")
- Base.Name = "BoltChunk"
- Base.formFactor = "Custom"
- Base.TopSurface = 0
- Base.BottomSurface = 0
- Base.Anchored = true
- Base.Transparency = 0.4
- Base.Reflectance = 0.4
- Base.BrickColor = BrickColor.new("Medium blue")
- local Leaves = Base:Clone()
- Leaves.Name = "Leaves"
- Leaves.CanCollide = false
- Leaves.BrickColor = BrickColor.new("Really black")
- Leaves.Transparency = 0
- Leaves.Reflectance = 0.1
- local leafmesh = Instance.new("SpecialMesh")
- leafmesh.Parent = Leaves
- Instance.new("CylinderMesh",Base)
- function dot(c1,c2)
- local m = CFrame.Angles(math.pi/2,0,0)
- return (c1*m).lookVector:Dot((c2*m).lookVector)
- end
- local leaf_mult = {
- Vector3.new(1.5,1.5,1.2);
- Vector3.new(1.5,1,1.5);
- Vector3.new(1.2,1.5,1.5);
- Vector3.new(1.5,1.5,1.5);
- }
- function Branch(base,c)
- if c <= 0 then
- local leaves = Leaves:Clone()
- local vol = base.Size.x+base.Size.y+base.Size.z
- leaves.CFrame = base.CFrame * CFrame.new(0,base.Size.y/2,0)
- leaves.Parent = base.Parent
- else
- local pos = base.CFrame*CFrame.new(0,base.Size/2,0)
- local height = base.Size.y
- local width = base.Size.x
- local nb = 1
- local r = math.random(3,25)
- local da = math.random(20+55/c,40+40/c)
- local ba = math.random(-da/3,da/3)
- for i=0,nb-1 do
- local branch = base:Clone()
- branch.Name = "Branch"
- local h = height*math.random(95,115)/100 -- height .95 to 1.15 of original
- local new = branch.CFrame * CFrame.new(0,height/2,0) * CFrame.Angles(0,0,math.rad(ba))
- new = new * CFrame.Angles(0,i*(math.pi*2/nb)+r,math.rad(da/2)) * CFrame.new(0,h/2,0)
- local w = dot(new,branch.CFrame)*width*0.9
- branch.Size = Vector3.new(width,h,width)
- branch.CFrame = new
- branch.Parent = base.Parent
- branch.Material = 'Neon'
- branch.BrickColor = BrickColor.new('Cyan')
- Branch(branch,c-1)
- swait()
- end
- end
- end
- function Flash()
- local Lighting = game:GetService('Lighting')
- Lighting.Brightness = 12
- wait(.3)
- Lighting.Brightness = -0.5
- end
- function GenerateBolt(location,complexity,width,height)
- local tree = Instance.new("Model")
- tree.Name = "Lightning Bolt"
- tree.Parent = workspace
- local base = Base:Clone()
- base.Parent = tree
- base.Size = Vector3.new(width,height,width)
- base.CFrame = CFrame.new(location) * CFrame.new(0,height/2,0) * CFrame.Angles(0,math.rad(math.random(1,360)),0)
- Branch(base,complexity)
- local expl = Instance.new("Explosion")
- expl.ExplosionType = 0
- expl.BlastRadius = 15
- expl.BlastPressure = expl.BlastPressure * 8
- expl.Position = location
- expl.Parent = workspace
- local sounds = {'rbxassetid://539649706','rbxassetid://858154930','rbxassetid://821439273','rbxassetid://224339201'}
- local s = Instance.new('Sound',workspace)
- s.Volume = 1
- s.SoundId = sounds[math.random(1,#sounds)]
- s:Play()
- Flash()
- game:GetService("Debris"):AddItem(tree,math.random(0.01,.1))
- end
- function NewStorm()
- local function Cloud(x,z,size,lightning)
- spawn(function()
- local c = Instance.new("Part",workspace)
- c.Size = Vector3.new(1,1,1)
- c.CanCollide = false
- c.CastShadow = true
- c.Anchored = true
- c.Position = Vector3.new(x,350,z)
- c.BrickColor = BrickColor.DarkGray()
- local m = Instance.new('FileMesh',c)
- m.MeshId = 'http://www.roblox.com/asset/?id=1095708'
- game:GetService("RunService").Stepped:Connect(function()
- c.CFrame = c.CFrame * CFrame.Angles(0,0.05,0)
- c.CFrame = c.CFrame * CFrame.new(math.random(-1,1),0,math.random(-1,1))
- end)
- for i = 1, size+512 do
- swait()
- m.Scale = m.Scale + Vector3.new(0.07,.07,0.07)
- if lightning then
- if math.random(1,160)==6 then
- local num = c.Position.Y+2
- local max = i
- if num > max then
- num = max
- end
- GenerateBolt(Vector3.new(c.Position.X,0,c.Position.Z),5,3,50)
- end
- end
- end
- end)
- end
- local f = Instance.new('Sound',workspace)
- f.Volume = 1
- f.SoundId = 'rbxassetid://186377104'
- f.Looped = true
- f:Play()
- for i = 1, 50 do
- game.Lighting.Brightness = game.Lighting.Brightness - 0.05
- swait()
- end
- for i = 1, 100 do -- create the storm
- local f = false
- if math.random(1,5)==3 then
- f = true
- end
- Cloud(math.random(-300,300),math.random(-300,300),math.random(100,625),f)
- wait(math.random(0.001,0.4))
- end
- -- tornado
- wait(4)
- local tor_base = Instance.new('Part',workspace)
- tor_base.Size = Vector3.new(1,1,1)
- tor_base.Transparency = .25
- tor_base.Anchored = true
- tor_base.CanCollide = false
- tor_base.CFrame = CFrame.new(0,0,0)
- --local ms = Instance.new('FileMesh',tor_base)
- --ms.Scale = Vector3.new(50,50,50)
- --ms.MeshId = 'http://www.roblox.com/asset/?id=102638417'
- local Smoke = Instance.new('Smoke',tor_base)
- Smoke.Opacity = 1
- Smoke.RiseVelocity = 10
- Smoke.Size = 3
- Smoke.Color = Color3.fromRGB(126,126,126)
- local partc = Instance.new('ParticleEmitter',tor_base)
- partc.Texture = 'rbxasset://textures/particles/smoke_main.dds'
- partc.Color = ColorSequence.new({ColorSequenceKeypoint.new(0,Color3.fromRGB(126,126,126)),ColorSequenceKeypoint.new(1,Color3.fromRGB(126,126,126))})
- partc.Size = NumberSequence.new({NumberSequenceKeypoint.new(0,0),NumberSequenceKeypoint.new(1,30)})
- partc.Transparency = NumberSequence.new({NumberSequenceKeypoint.new(0,0),NumberSequenceKeypoint.new(1,1)})
- partc.Rate = 300
- partc.Speed = NumberRange.new(1,22)
- partc.SpreadAngle = Vector2.new(20,20)
- local partc2 = Instance.new('ParticleEmitter',tor_base)
- partc2.Texture = 'rbxasset://textures/particles/smoke_main.dds'
- partc2.Color = ColorSequence.new({ColorSequenceKeypoint.new(0,Color3.fromRGB(126,126,126)),ColorSequenceKeypoint.new(1,Color3.fromRGB(126,126,126))})
- partc2.Size = NumberSequence.new({NumberSequenceKeypoint.new(0,0),NumberSequenceKeypoint.new(1,50)})
- partc2.Transparency = NumberSequence.new({NumberSequenceKeypoint.new(0,0),NumberSequenceKeypoint.new(1,1)})
- partc2.Rate = 300
- partc2.Lifetime = NumberRange.new(15,28)
- partc2.Speed = NumberRange.new(7,12)
- partc2.SpreadAngle = Vector2.new(30,30)
- local s1 = 'rbxassetid://318451789'
- local s2 = 'rbxassetid://184973424'
- local so = Instance.new("Sound",tor_base)
- so.SoundId = s1
- so.Volume = 1
- so.Looped = true
- so:Play()
- local so2 = Instance.new("Sound",tor_base)
- so2.SoundId = s2
- so2.Volume = 1
- so2.Looped = true
- so2:Play()
- local count = 0
- local dirX,dirZ=0,5
- function Scan(obj)
- local f = {}
- for i,v in pairs(obj:GetChildren()) do
- table.insert(f,v)
- end
- for i,v in pairs(f) do
- if v:IsA("BasePart") then
- local mag = (tor_base.Position-v.Position).magnitude
- if mag<=45 then
- local vel = Instance.new('BodyVelocity',v)
- vel.Velocity = (v.Position-tor_base.Position).unit*-(70/(mag))+Vector3.new(math.random(-13,13),0,math.random(-13,13))
- vel.MaxForce = Vector3.new(999,999,999)*999999999999e99
- vel.P = 30003333333
- game:GetService("Debris"):AddItem(vel,0.1)
- elseif mag <=0 then
- local vel = Instance.new('BodyVelocity',v)
- vel.Velocity = Vector3.new(math.random(-300,300),math.random(-300,300),math.random(-300,300))
- vel.MaxForce = Vector3.new(999,999,999)*999999999999e99
- vel.P = 30003333333
- end
- elseif v:IsA("Model") and not v:FindFirstChild('Head') then
- for a,b in pairs(v:GetChildren()) do
- if b:IsA('BasePart') and b:GetMass()<300 then
- b.Anchored = false
- local mag = (tor_base.Position-b.Position).magnitude
- if mag<=45 then
- b.Parent:BreakJoints()
- b:BreakJoints()
- local vel = Instance.new('BodyVelocity',b)
- vel.Velocity = (b.Position-tor_base.Position).unit*-(70/(mag))+Vector3.new(math.random(-13,13),0,math.random(-13,13))
- vel.MaxForce = Vector3.new(999,999,999)*999999999999e99
- vel.P = 30003333333
- game:GetService("Debris"):AddItem(vel,0.1)
- elseif mag <=0 then
- local vel = Instance.new('BodyVelocity',b)
- vel.Velocity = Vector3.new(math.random(-300,300),math.random(-300,300),math.random(-300,300))
- vel.MaxForce = Vector3.new(999,999,999)*999999999999e99
- vel.P = 30003333333
- end
- end
- end
- elseif v:IsA("Model") and v:FindFirstChild('Head') then
- local vf = v.Head
- local mag = (tor_base.Position-vf.Position).magnitude
- if mag<=45 then
- local vel = Instance.new('BodyVelocity',vf)
- vel.Velocity = (vf.Position-tor_base.Position).unit*-(70/(mag))+Vector3.new(math.random(-13,13),0,math.random(-13,13))
- vel.MaxForce = Vector3.new(999,999,999)*999999999999e99
- vel.P = 30003333333
- game:GetService("Debris"):AddItem(vel,0.1)
- if v:findFirstChildOfClass('Humanoid') then
- if math.random(1,12)==5 then
- v:findFirstChildOfClass('Humanoid'):TakeDamage(1)
- end
- end
- elseif mag<=5 then
- local vel = Instance.new('BodyVelocity',vf)
- vel.Velocity = Vector3.new(math.random(-300,300),math.random(-300,300),math.random(-300,300))
- vel.MaxForce = Vector3.new(999,999,999)*999999999999e99
- vel.P = 30003333333
- end
- end
- end
- return
- end
- game:GetService("RunService").Stepped:Connect(function()
- -- tornado damage
- Scan(workspace)
- for i,v in pairs(workspace:GetChildren()) do
- Scan(v)
- end
- -- effects and movement
- tor_base.CFrame=tor_base.CFrame*CFrame.new(dirX/50,0,dirZ/50)
- count = count + 1
- if math.random(1,100)==count then
- count = 1
- print("New Direction")
- dirX = math.random(-3,3)
- dirZ = math.random(-3,3)
- end
- if math.random(1,100)==52 then
- print('Lightning')
- GenerateBolt(Vector3.new(tor_base.Position.X+math.random(-13,13),0,tor_base.Position.Y+math.random(-13,13)),5,7,50)
- end
- end)
- end
- wait(5)
- NewStorm()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement