Advertisement
Guest User

Untitled

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