Advertisement
Gzald

Zombie attack script

Apr 19th, 2022
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.98 KB | None | 0 0
  1. local ScreenGui = Instance.new("ScreenGui")
  2. local OpenF = Instance.new("Frame")
  3. local OpenB = Instance.new("TextButton")
  4. local MainF = Instance.new("Frame")
  5. local Title = Instance.new("TextLabel")
  6. local AutoFarm = Instance.new("TextButton")
  7. local Noclip = Instance.new("TextButton")
  8. local WalkSpeed = Instance.new("TextButton")
  9. local Close = Instance.new("TextButton")
  10. --Properties:
  11. ScreenGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
  12. ScreenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
  13. ScreenGui.Parent = game.CoreGui
  14.  
  15. OpenF.Name = "OpenF"
  16. OpenF.Parent = ScreenGui
  17. OpenF.Active = true
  18. OpenF.BackgroundColor3 = Color3.new(0, 0, 0)
  19. OpenF.BackgroundTransparency = 0.40000000596046
  20. OpenF.Position = UDim2.new(0.92768085, 0, 0.626178563, 0)
  21. OpenF.Size = UDim2.new(0, 98, 0, 28)
  22.  
  23. OpenB.Name = "OpenB"
  24. OpenB.Parent = OpenF
  25. OpenB.BackgroundColor3 = Color3.new(1, 1, 1)
  26. OpenB.BackgroundTransparency = 1
  27. OpenB.Position = UDim2.new(0.0102040814, 0, 0.0357142873, 0)
  28. OpenB.Size = UDim2.new(0, 103, 0, 25)
  29. OpenB.Font = Enum.Font.Gotham
  30. OpenB.Text = "Open"
  31. OpenB.TextColor3 = Color3.new(1, 1, 1)
  32. OpenB.TextSize = 14
  33. OpenB.MouseButton1Click:connect(function()
  34. OpenF.Visible = false
  35. MainF.Visible = true
  36. end)
  37.  
  38. MainF.Name = "MainF"
  39. MainF.Parent = ScreenGui
  40. MainF.Active = true
  41. MainF.BackgroundColor3 = Color3.new(0, 0, 0)
  42. MainF.BackgroundTransparency = 0.40000000596046
  43. MainF.Position = UDim2.new(0.369627506, 0, 0.30831641, 0)
  44. MainF.Size = UDim2.new(0, 170, 0, 224)
  45. MainF.Draggable = True
  46.  
  47. Title.Name = "Title"
  48. Title.Parent = MainF
  49. Title.Active = true
  50. Title.BackgroundColor3 = Color3.new(0, 0, 0)
  51. Title.BackgroundTransparency = 0.40000000596046
  52. Title.Size = UDim2.new(0, 170, 0, 30)
  53. Title.Font = Enum.Font.GothamBold
  54. Title.Text = "Attack On Zombies"
  55. Title.TextColor3 = Color3.new(1, 1, 1)
  56. Title.TextSize = 14
  57.  
  58. AutoFarm.Name = "AutoFarm"
  59. AutoFarm.Parent = MainF
  60. AutoFarm.BackgroundColor3 = Color3.new(0, 0, 0)
  61. AutoFarm.BackgroundTransparency = 0.40000000596046
  62. AutoFarm.Position = UDim2.new(0.0588235334, 0, 0.214285731, 0)
  63. AutoFarm.Size = UDim2.new(0, 150, 0, 26)
  64. AutoFarm.Font = Enum.Font.Gotham
  65. AutoFarm.Text = "Auto Farm"
  66. AutoFarm.TextColor3 = Color3.new(1, 1, 1)
  67. AutoFarm.TextSize = 14
  68. AutoFarm.MouseButton1Click:connect(function()
  69. local groundDistance = 8
  70. local Player = game:GetService("Players").LocalPlayer
  71. local function getNearest()
  72. local nearest, dist = nil, 99999
  73. for _,v in pairs(game.Workspace.BossFolder:GetChildren()) do
  74. if(v:FindFirstChild("Head")~=nil)then
  75. local m =(Player.Character.Head.Position-v.Head.Position).magnitude
  76. if(m<dist)then
  77. dist = m
  78. nearest = v
  79. end
  80. end
  81. end
  82. for _,v in pairs(game.Workspace.enemies:GetChildren()) do
  83. if(v:FindFirstChild("Head")~=nil)then
  84. local m =(Player.Character.Head.Position-v.Head.Position).magnitude
  85. if(m<dist)then
  86. dist = m
  87. nearest = v
  88. end
  89. end
  90. end
  91. return nearest
  92. end
  93. _G.farm2 = true
  94. Player.Chatted:Connect(function(m)
  95. if(m==";autofarm false")then
  96. _G.farm2 = false
  97. elseif(m==";autofarm true")then
  98. _G.farm2 = true
  99. end
  100. end)
  101. _G.globalTarget = nil
  102. game:GetService("RunService").RenderStepped:Connect(function()
  103. if(_G.farm2==true)then
  104. local target = getNearest()
  105. if(target~=nil)then
  106. game:GetService("Workspace").CurrentCamera.CFrame = CFrame.new(game:GetService("Workspace").CurrentCamera.CFrame.p, target.Head.Position)
  107. Player.Character.HumanoidRootPart.CFrame = (target.HumanoidRootPart.CFrame * CFrame.new(0, groundDistance, 9))
  108. _G.globalTarget = target
  109. end
  110. end
  111. end)
  112. spawn(function()
  113. while wait() do
  114. game.Players.LocalPlayer.Character.HumanoidRootPart.Velocity = Vector3.new(0,0,0)
  115. game.Players.LocalPlayer.Character.Torso.Velocity = Vector3.new(0,0,0)
  116. end
  117. end)
  118. while wait() do
  119. if(_G.farm2==true and _G.globalTarget~=nil and _G.globalTarget:FindFirstChild("Head") and Player.Character:FindFirstChildOfClass("Tool"))then
  120. local target = _G.globalTarget
  121. game.ReplicatedStorage.Gun:FireServer({["Normal"] = Vector3.new(0, 0, 0), ["Direction"] = target.Head.Position, ["Name"] = Player.Character:FindFirstChildOfClass("Tool").Name, ["Hit"] = target.Head, ["Origin"] = target.Head.Position, ["Pos"] = target.Head.Position,})
  122. wait()
  123. end
  124. end
  125. end)
  126.  
  127. Noclip.Name = "Noclip"
  128. Noclip.Parent = MainF
  129. Noclip.BackgroundColor3 = Color3.new(0, 0, 0)
  130. Noclip.BackgroundTransparency = 0.40000000596046
  131. Noclip.Position = UDim2.new(0.0588235334, 0, 0.504464269, 0)
  132. Noclip.Size = UDim2.new(0, 150, 0, 26)
  133. Noclip.Font = Enum.Font.Gotham
  134. Noclip.Text = "Noclip [\"n\"]"
  135. Noclip.TextColor3 = Color3.new(1, 1, 1)
  136. Noclip.TextSize = 14
  137. Noclip.MouseButton1Click:connect(function()
  138. local plr = game:service'Players'.LocalPlayer
  139. local char = plr.Character
  140. local hum = char:FindFirstChildOfClass'Humanoid'
  141. local mouse = plr:GetMouse()
  142. on = false
  143.  
  144. mouse.KeyDown:connect(function(key)
  145. if key == "n" then
  146. if not on then
  147. on = true
  148. elseif on then
  149. on = false
  150. end
  151. end
  152. end)
  153.  
  154. while wait() do
  155. if char then
  156. hum = char:FindFirstChildOfClass'Humanoid'
  157. end
  158. if on then
  159. hum:ChangeState(11)
  160. end
  161. end
  162.  
  163. end)
  164.  
  165. WalkSpeed.Name = "WalkSpeed"
  166. WalkSpeed.Parent = MainF
  167. WalkSpeed.BackgroundColor3 = Color3.new(0, 0, 0)
  168. WalkSpeed.BackgroundTransparency = 0.40000000596046
  169. WalkSpeed.Position = UDim2.new(0.0588235334, 0, 0.8125, 0)
  170. WalkSpeed.Size = UDim2.new(0, 150, 0, 26)
  171. WalkSpeed.Font = Enum.Font.Gotham
  172. WalkSpeed.Text = "Walkspeed"
  173. WalkSpeed.TextColor3 = Color3.new(1, 1, 1)
  174. WalkSpeed.TextSize = 14
  175. WalkSpeed.MouseButton1Click:connect(function()
  176. game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 100
  177. end)
  178.  
  179. Close.Name = "Close"
  180. Close.Parent = MainF
  181. Close.BackgroundColor3 = Color3.new(1, 0, 0.0156863)
  182. Close.BackgroundTransparency = 1
  183. Close.Position = UDim2.new(0.841176391, 0, -0.0223214328, 0)
  184. Close.Size = UDim2.new(0, 27, 0, 39)
  185. Close.Font = Enum.Font.SourceSans
  186. Close.Text = "X"
  187. Close.TextColor3 = Color3.new(1, 0, 0.0156863)
  188. Close.TextSize = 48
  189. Close.MouseButton1Click:connect(function()
  190. MainF.Visible = false
  191. OpenF.Visible = true
  192. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement