Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Tower = script.Parent
- local Head = Tower.Light
- local Base = Tower.Base
- local SafeList = {'safeteamshere'}
- local range = 20
- local firing = false
- local targets = {}
- function Fire()
- if firing == false then
- firing = true
- Head.Humming:Play()
- Head.BrickColor = BrickColor.new('Cyan')
- wait(2)
- for index, player in ipairs(targets) do
- delay(0,function () Fry(player) end)
- end
- wait(0.2)
- Head.BrickColor = BrickColor.new('Medium stone grey')
- Head.Humming:Stop()
- firing = false
- end
- end
- function Scan()
- targets = {}
- for index, player in ipairs(game.Players:GetPlayers()) do
- local safe = false
- for i , teams in ipairs(SafeList) do
- if string.lower(team) == string.lower(player.Team) then
- safe = true
- end
- end
- if safe == false then
- if player.Character ~= nil then
- local Human
- local Torso
- for i , child in ipairs(player.Character:GetChildren()) do
- if child:isA("Humanoid") then
- Human = child
- elseif child.Name == "Torso" and child:isA("BasePart") then
- Torso = child
- end
- end
- if Human and Torso then
- if (Torso.Position-(Head.Position+Vector3.new(0,-16,0))).magnitude < range then
- if Human.Health > 0 then
- table.insert(targets,player)
- end
- end
- end
- end
- end
- end
- if #targets > 0 and firing == false then
- Fire()
- end
- end
- function Fry(player)
- if player.Character ~= nil then
- local Human
- local Torso
- for i , child in ipairs(player.Character:GetChildren()) do
- if child:isA("Humanoid") then
- Human = child
- elseif child.Name == "Torso" and child:isA("BasePart") then
- Torso = child
- end
- end
- if Human and Torso then
- if (Torso.Position-(Head.Position+Vector3.new(0,-16,0))).magnitude < range then
- if Human.Health > 0 then
- local startpos = Head.Position
- local targetpos = Torso.Position
- local currentpos = startpos
- targetpos = Torso.Position
- local dist = (startpos-targetpos).magnitude
- for i, part in ipairs(player.Character:GetChildren()) do
- if part:isA("BasePart") then
- part:remove()
- end
- end
- local mark = Instance.new("Part")
- mark.Anchored = true
- mark.Locked = true
- mark.CanCollide = false
- mark.Transparency = 1
- mark.formFactor = 0
- mark.Name = "Lightning struck"
- mark.Size = Vector3.new(10,1,10)
- mark.CFrame = CFrame.new(targetpos.X,Base.Position.Y-0.55,targetpos.Z)
- mark.CFrame = mark.CFrame*CFrame.Angles(0,math.rad(math.random(0,360)),0)
- local hitMark = Instance.new("Decal")
- hitMark.Texture = "http://www.roblox.com/asset/?id=29710350"
- hitMark.Face = "Top"
- hitMark.Parent = mark
- local markSmoke = Instance.new("Smoke")
- markSmoke.Parent = mark
- markSmoke.Opacity = 0.15
- markSmoke.Color = Color3.new(-30,-30,-30)
- markSmoke.RiseVelocity = 6
- markSmoke.Size = 2
- mark.Parent = player.Character
- for strikes = 1, 8 do
- local stream = Instance.new("Model")
- stream.Name = "LightningStream"
- stream.Parent = player.Character
- local sound = Instance.new("Sound")
- sound.SoundId = "rbxassetid://155518563"
- sound.Parent = Tower
- sound.Pitch = 0.7+(math.random()/3)
- sound:play()
- wait()
- for i = 0, dist,8 do
- local dire = CFrame.new(currentpos,targetpos)
- local nextx = math.random(-4,4)
- local nexty = math.random(-4,4)
- local nextz = math.random(-4,4)
- local dire = dire*CFrame.new(0,0,-8)*CFrame.new(nextx,nexty,nexz)
- local nextpos = dire.p
- local l = CreateSection(currentpos,nextpos,"Cyan",0.3)
- l.Parent = stream
- currentpos = nextpos
- end
- currentpos = startpos
- delay(0.1,function() stream:remove() end)
- end
- end
- end
- end
- end
- end
- function CreateSection(pos1,pos2,color,size)
- local part = Instance.new("Part")
- local pe = script.ParticleEmitter:Clone()
- part.TopSurface = 0
- part.BottomSurface = 0
- part.Anchored = true
- part.CanCollide = false
- part.Locked = true
- part.formFactor = "Custom"
- part.BrickColor = BrickColor.new(color)
- part.Transparency = 1
- local dist = (pos1-pos2).magnitude
- part.Size = Vector3.new(size,size,dist)
- part.CFrame = CFrame.new((pos1+pos2)/2,pos2)
- pe.Parent = part
- return part
- end
- Tower.ChildAdded:connect(function(child)
- if child:isA("Sound") then
- wait(5)
- child:remove()
- end
- end)
- while true do
- wait(0.1)
- if script.Parent.Parent.WhaleOil.WhaleOil.ClickDetector.Value.Value == true then
- delay(0,function() Scan() end)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement