Advertisement
Guest User

Untitled

a guest
Aug 25th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.59 KB | None | 0 0
  1. local Tower = script.Parent
  2. local Head = Tower.Light
  3. local Base = Tower.Base
  4.  
  5. local SafeList = {'safeteamshere'}
  6.  
  7. local range = 20
  8.  
  9. local firing = false
  10.  
  11. local targets = {}
  12.  
  13. function Fire()
  14.     if firing == false then
  15.         firing = true
  16.         Head.Humming:Play()
  17.         Head.BrickColor = BrickColor.new('Cyan')
  18.         wait(2)
  19.         for index, player in ipairs(targets) do
  20.             delay(0,function () Fry(player) end)
  21.         end
  22.         wait(0.2)
  23.         Head.BrickColor = BrickColor.new('Medium stone grey')
  24.         Head.Humming:Stop()
  25.         firing = false
  26.     end
  27. end
  28.  
  29.  
  30. function Scan()
  31.     targets = {}
  32.     for index, player in ipairs(game.Players:GetPlayers()) do
  33.         local safe = false
  34.         for i , teams in ipairs(SafeList) do
  35.             if string.lower(team) == string.lower(player.Team) then
  36.                 safe = true
  37.             end
  38.         end
  39.         if safe == false then
  40.             if player.Character ~= nil then
  41.                 local Human
  42.                 local Torso
  43.                 for i , child in ipairs(player.Character:GetChildren()) do
  44.                     if child:isA("Humanoid") then
  45.                         Human = child
  46.                     elseif child.Name == "Torso" and child:isA("BasePart") then
  47.                         Torso = child
  48.                     end
  49.                 end
  50.                 if Human and Torso then
  51.                     if (Torso.Position-(Head.Position+Vector3.new(0,-16,0))).magnitude < range then
  52.                         if Human.Health > 0 then
  53.                             table.insert(targets,player)
  54.                         end
  55.                     end
  56.                 end
  57.             end
  58.         end
  59.     end
  60.     if #targets > 0 and firing == false then
  61.         Fire()
  62.     end
  63. end
  64.            
  65. function Fry(player)
  66.     if player.Character ~= nil then
  67.         local Human
  68.         local Torso
  69.         for i , child in ipairs(player.Character:GetChildren()) do
  70.             if child:isA("Humanoid") then
  71.                 Human = child
  72.             elseif child.Name == "Torso" and child:isA("BasePart") then
  73.                 Torso = child
  74.             end
  75.         end
  76.         if Human and Torso then
  77.             if (Torso.Position-(Head.Position+Vector3.new(0,-16,0))).magnitude < range then
  78.                 if Human.Health > 0 then
  79.                     local startpos = Head.Position
  80.                     local targetpos = Torso.Position
  81.                     local currentpos = startpos
  82.                     targetpos = Torso.Position
  83.                     local dist = (startpos-targetpos).magnitude
  84.                     for i, part in ipairs(player.Character:GetChildren()) do
  85.                         if part:isA("BasePart") then
  86.                             part:remove()
  87.                         end
  88.                     end
  89.                     local mark = Instance.new("Part")
  90.                     mark.Anchored = true
  91.                     mark.Locked = true
  92.                     mark.CanCollide = false
  93.                     mark.Transparency = 1
  94.                     mark.formFactor = 0
  95.                     mark.Name = "Lightning struck"
  96.                     mark.Size = Vector3.new(10,1,10)
  97.                     mark.CFrame = CFrame.new(targetpos.X,Base.Position.Y-0.55,targetpos.Z)
  98.                     mark.CFrame = mark.CFrame*CFrame.Angles(0,math.rad(math.random(0,360)),0)
  99.                     local hitMark = Instance.new("Decal")
  100.                     hitMark.Texture = "http://www.roblox.com/asset/?id=29710350"
  101.                     hitMark.Face = "Top"
  102.                     hitMark.Parent = mark
  103.                     local markSmoke = Instance.new("Smoke")
  104.                     markSmoke.Parent = mark
  105.                     markSmoke.Opacity = 0.15
  106.                     markSmoke.Color = Color3.new(-30,-30,-30)
  107.                     markSmoke.RiseVelocity = 6
  108.                     markSmoke.Size = 2
  109.                     mark.Parent = player.Character
  110.                     for strikes = 1, 8 do
  111.                         local stream = Instance.new("Model")
  112.                         stream.Name = "LightningStream"
  113.                         stream.Parent = player.Character
  114.                         local sound = Instance.new("Sound")
  115.                         sound.SoundId = "rbxassetid://155518563"
  116.                         sound.Parent = Tower
  117.                         sound.Pitch = 0.7+(math.random()/3)
  118.                         sound:play()
  119.                         wait()
  120.                         for i = 0, dist,8 do   
  121.                             local dire = CFrame.new(currentpos,targetpos)
  122.                             local nextx = math.random(-4,4)
  123.                             local nexty = math.random(-4,4)
  124.                             local nextz = math.random(-4,4)
  125.                             local dire = dire*CFrame.new(0,0,-8)*CFrame.new(nextx,nexty,nexz)
  126.                             local nextpos = dire.p
  127.                             local l = CreateSection(currentpos,nextpos,"Cyan",0.3)
  128.                             l.Parent = stream
  129.                             currentpos = nextpos
  130.                         end
  131.                         currentpos = startpos
  132.                         delay(0.1,function() stream:remove()   end)
  133.                     end
  134.                 end
  135.             end
  136.         end
  137.     end
  138. end
  139. function CreateSection(pos1,pos2,color,size)
  140.     local part = Instance.new("Part")
  141.     local pe = script.ParticleEmitter:Clone()
  142.     part.TopSurface = 0
  143.     part.BottomSurface = 0
  144.     part.Anchored = true
  145.     part.CanCollide = false
  146.     part.Locked = true
  147.     part.formFactor = "Custom"
  148.     part.BrickColor = BrickColor.new(color)
  149.     part.Transparency = 1
  150.     local dist = (pos1-pos2).magnitude
  151.     part.Size = Vector3.new(size,size,dist)
  152.     part.CFrame = CFrame.new((pos1+pos2)/2,pos2)
  153.     pe.Parent = part   
  154.     return part
  155. end
  156.  
  157. Tower.ChildAdded:connect(function(child)
  158.     if child:isA("Sound") then
  159.         wait(5)
  160.         child:remove()
  161.     end
  162. end)
  163.  
  164. while true do
  165.     wait(0.1)
  166.     if script.Parent.Parent.WhaleOil.WhaleOil.ClickDetector.Value.Value == true then
  167.     delay(0,function() Scan() end)
  168.     end
  169. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement