Advertisement
Guest User

Untitled

a guest
Nov 18th, 2018
8,443
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 9.11 KB | None | 0 0
  1. PLAYER  = game.Players.LocalPlayer
  2. MOUSE   = PLAYER:GetMouse()
  3. CC      = game.Workspace.CurrentCamera
  4.  
  5. ENABLED      = false
  6. ESP_ENABLED  = false
  7.  
  8. _G.FREE_FOR_ALL = true
  9.  
  10. _G.BIND        = 50
  11. _G.ESP_BIND    = 52
  12. _G.CHANGE_AIM  = 'q'
  13. CLOSE          = 'p'
  14. OPEN           = 'l'
  15. DESTROY        = 'x'
  16.  
  17. _G.AIM_AT = 'Head'
  18.  
  19. wait(1)
  20.  
  21. function GetNearestPlayerToMouse()
  22.     local PLAYERS      = {}
  23.     local PLAYER_HOLD  = {}
  24.     local DISTANCES    = {}
  25.     for i, v in pairs(game.Workspace.Zombies:GetChildren()) do
  26.         if v ~= PLAYER then
  27.             table.insert(PLAYERS, v)
  28.         end
  29.     end
  30.     for i, v in pairs(PLAYERS) do
  31.         if _G.FREE_FOR_ALL == false then
  32.             if v and (v) ~= nil and v.TeamColor ~= PLAYER.TeamColor then
  33.                 local AIM = v:FindFirstChild(_G.AIM_AT)
  34.                 if AIM ~= nil then
  35.                     local DISTANCE                 = (AIM.Position - game.Workspace.CurrentCamera.CoordinateFrame.p).magnitude
  36.                     local RAY                      = Ray.new(game.Workspace.CurrentCamera.CoordinateFrame.p, (MOUSE.Hit.p - CC.CoordinateFrame.p).unit * DISTANCE)
  37.                     local HIT,POS                  = game.Workspace:FindPartOnRay(RAY, game.Workspace)
  38.                     local DIFF                     = math.floor((POS - AIM.Position).magnitude)
  39.                     PLAYER_HOLD[v.Name .. i]       = {}
  40.                     PLAYER_HOLD[v.Name .. i].dist  = DISTANCE
  41.                     PLAYER_HOLD[v.Name .. i].plr   = v
  42.                     PLAYER_HOLD[v.Name .. i].diff  = DIFF
  43.                     table.insert(DISTANCES, DIFF)
  44.                 end
  45.             end
  46.         elseif _G.FREE_FOR_ALL == true then
  47.             local AIM = v:FindFirstChild(_G.AIM_AT)
  48.             if AIM ~= nil then
  49.                 local DISTANCE                 = (AIM.Position - game.Workspace.CurrentCamera.CoordinateFrame.p).magnitude
  50.                 local RAY                      = Ray.new(game.Workspace.CurrentCamera.CoordinateFrame.p, (MOUSE.Hit.p - CC.CoordinateFrame.p).unit * DISTANCE)
  51.                 local HIT,POS                  = game.Workspace:FindPartOnRay(RAY, game.Workspace)
  52.                 local DIFF                     = math.floor((POS - AIM.Position).magnitude)
  53.                 PLAYER_HOLD[v.Name .. i]       = {}
  54.                 PLAYER_HOLD[v.Name .. i].dist  = DISTANCE
  55.                 PLAYER_HOLD[v.Name .. i].plr   = v
  56.                 PLAYER_HOLD[v.Name .. i].diff  = DIFF
  57.                 table.insert(DISTANCES, DIFF)
  58.             end
  59.         end
  60.     end
  61.    
  62.     if unpack(DISTANCES) == nil then
  63.         return false
  64.     end
  65.    
  66.     local L_DISTANCE = math.floor(math.min(unpack(DISTANCES)))
  67.     if L_DISTANCE > 20 then
  68.         return false
  69.     end
  70.    
  71.     for i, v in pairs(PLAYER_HOLD) do
  72.         if v.diff == L_DISTANCE then
  73.             return v.plr
  74.         end
  75.     end
  76.     return false
  77. end
  78.  
  79. GUI_MAIN                           = Instance.new('ScreenGui', game.CoreGui)
  80. GUI_TARGET                         = Instance.new('TextLabel', GUI_MAIN)
  81. GUI_AIM_AT                         = Instance.new('TextLabel', GUI_MAIN)
  82. GUI_CREDITS                         = Instance.new('TextLabel', GUI_MAIN)
  83.  
  84. GUI_MAIN.Name                      = 'AIMBOT'
  85.  
  86. GUI_TARGET.Size                    = UDim2.new(0,200,0,30)
  87. GUI_TARGET.BackgroundTransparency  = 1.5
  88. GUI_TARGET.BackgroundColor         = BrickColor.new('Fossil')
  89. GUI_TARGET.BorderSizePixel         = 0
  90. GUI_TARGET.Position                = UDim2.new(0.5,-100,0,0)
  91. GUI_TARGET.Text                    = 'AIMBOT : Loaded, Press F9 for instructions!'
  92. GUI_TARGET.TextColor3              = Color3.new(1,1,1)
  93. GUI_TARGET.TextStrokeTransparency  = 1
  94. GUI_TARGET.TextWrapped             = true
  95. GUI_TARGET.FontSize                = 'Size24'
  96. GUI_TARGET.Font                    = 'SourceSansBold'
  97. GUI_TARGET.TextScaled              = true
  98.  
  99. GUI_CREDITS.Size                    = UDim2.new(0, 237, 0, 14)
  100. GUI_CREDITS.BackgroundTransparency  = 1.5
  101. GUI_CREDITS.BackgroundColor         = BrickColor.new('Fossil')
  102. GUI_CREDITS.BorderSizePixel         = 0
  103. GUI_CREDITS.Position                = UDim2.new(0.5,-110,0,60)
  104. GUI_CREDITS.Text                    = 'Gui and half of the script made by LAZ3R#3702'
  105. GUI_CREDITS.TextColor3              = Color3.new(1,1,1)
  106. GUI_CREDITS.TextStrokeTransparency  = 1
  107. GUI_CREDITS.TextWrapped             = true
  108. GUI_CREDITS.Font                    = 'SourceSansBold'
  109. GUI_CREDITS.TextSize                = 14
  110. GUI_CREDITS.TextScaled              = true
  111.  
  112. GUI_AIM_AT.Size                    = UDim2.new(0,200,0,20)
  113. GUI_AIM_AT.BackgroundTransparency  = 1.5
  114. GUI_AIM_AT.BackgroundColor         = BrickColor.new('Fossil')
  115. GUI_AIM_AT.BorderSizePixel         = 0
  116. GUI_AIM_AT.Position                = UDim2.new(0.5,-100,0,30)
  117. GUI_AIM_AT.Text                    = 'AIMING : HEAD'
  118. GUI_AIM_AT.TextColor3              = Color3.new(1,1,1)
  119. GUI_AIM_AT.TextStrokeTransparency  = 1
  120. GUI_AIM_AT.TextWrapped             = true
  121. GUI_AIM_AT.FontSize                = 'Size18'
  122. GUI_AIM_AT.Font                    = 'SourceSansBold'
  123.  
  124. local TRACK = false
  125.  
  126. function CREATE(BASE, TEAM)
  127.     local ESP_MAIN                   = Instance.new('BillboardGui', PLAYER.PlayerGui)
  128.     local ESP_DOT                    = Instance.new('Frame', ESP_MAIN)
  129.     local ESP_NAME                   = Instance.new('TextLabel', ESP_MAIN)
  130.    
  131.     ESP_MAIN.Name                    = 'ESP'
  132.     ESP_MAIN.Adornee                 = BASE
  133.     ESP_MAIN.AlwaysOnTop             = true
  134.     ESP_MAIN.ExtentsOffset           = Vector3.new(0, 1, 0)
  135.     ESP_MAIN.Size                    = UDim2.new(0, 5, 0, 5)
  136.    
  137.     ESP_DOT.Name                     = 'DOT'
  138.     ESP_DOT.BackgroundColor          = BrickColor.new('Bright red')
  139.     ESP_DOT.BackgroundTransparency   = 0.3
  140.     ESP_DOT.BorderSizePixel          = 0
  141.     ESP_DOT.Position                 = UDim2.new(-0.5, 0, -0.5, 0)
  142.     ESP_DOT.Size                     = UDim2.new(2, 0, 2, 0)
  143.     ESP_DOT.Visible                  = true
  144.     ESP_DOT.ZIndex                   = 10
  145.    
  146.     ESP_NAME.Name                    = 'NAME'
  147.     ESP_NAME.BackgroundColor3        = Color3.new(255, 255, 255)
  148.     ESP_NAME.BackgroundTransparency  = 1
  149.     ESP_NAME.BorderSizePixel         = 0
  150.     ESP_NAME.Position                = UDim2.new(0, 0, 0, -40)
  151.     ESP_NAME.Size                    = UDim2.new(1, 0, 10, 0)
  152.     ESP_NAME.Visible                 = true
  153.     ESP_NAME.ZIndex                  = 10
  154.     ESP_NAME.Font                    = 'ArialBold'
  155.     ESP_NAME.FontSize                = 'Size14'
  156.     ESP_NAME.Text                    = BASE.Parent.Name:upper()
  157.     ESP_NAME.TextColor               = BrickColor.new('Bright red')
  158. end
  159.  
  160. function CLEAR()
  161.     for _,v in pairs(PLAYER.PlayerGui:children()) do
  162.         if v.Name == 'ESP' and v:IsA('BillboardGui') then
  163.             v:Destroy()
  164.         end
  165.     end
  166. end
  167.  
  168. function FIND()
  169.     CLEAR()
  170.     TRACK = true
  171.     spawn(function()
  172.         while wait() do
  173.             if TRACK then
  174.                 CLEAR()
  175.                 for i,v in pairs(game.Players:GetChildren()) do
  176.                     if v and v:FindFirstChild('Head') then
  177.                         if _G.FREE_FOR_ALL == false then
  178.                             if v.TeamColor ~= PLAYER.TeamColor then
  179.                                 if v:FindFirstChild('Head') then
  180.                                     CREATE(v.Head, true)
  181.                                 end
  182.                             end
  183.                         else
  184.                             if v:FindFirstChild('Head') then
  185.                                 CREATE(v.Head, true)
  186.                             end
  187.                         end
  188.                     end
  189.                 end
  190.             end
  191.         end
  192.         wait(1)
  193.     end)
  194. end
  195.  
  196. MOUSE.KeyDown:connect(function(KEY)
  197.     KEY = KEY:lower():byte()
  198.     if KEY == _G.BIND then
  199.         ENABLED = true
  200.     end
  201. end)
  202.  
  203. print("--------------------")
  204. print("Instructions :")
  205. print("NOTE : Aimbot is already enabled automatically, there is no hotkey!!")
  206. print("Press Q to change Aim")
  207. print("Press P to close the gui")
  208. print("Press L to open the gui")
  209. print("Press X to delete the gui")
  210. print("Press left ctrl + left alt for esp ;)")
  211. print("Once Zombies have spawned, hold left ctrl and it will aim at the them!")
  212. print("All set? Alright, have fun!")
  213. print("Made By LAZ3R#3702")
  214. print("--------------------")
  215.  
  216.  
  217. MOUSE.KeyDown:connect(function(KEY)
  218.          if KEY == CLOSE then
  219. GUI_TARGET.Visible = false
  220. GUI_AIM_AT.Visible = false
  221. GUI_CREDITS.Visible = false
  222.          else if KEY == OPEN then
  223. GUI_TARGET.Visible = true
  224. GUI_AIM_AT.Visible = true
  225. GUI_CREDITS.Visible = true
  226. end
  227. end
  228. end)
  229.  
  230. MOUSE.KeyDown:connect(function(KEY)
  231.          if KEY == DESTROY then
  232.          game.CoreGui:FindFirstChild("AIMBOT"):Destroy()
  233. end
  234. end)
  235.  
  236. MOUSE.KeyUp:connect(function(KEY)
  237.     KEY = KEY:lower():byte()
  238.     if KEY == _G.BIND then
  239.         ENABLED = false
  240.     end
  241. end)
  242.  
  243. MOUSE.KeyDown:connect(function(KEY)
  244.     KEY = KEY:lower():byte()
  245.     if KEY == _G.ESP_BIND then
  246.         if ESP_ENABLED == false then
  247.             FIND()
  248.             ESP_ENABLED = true
  249.             print('ESP : ON')
  250.         elseif ESP_ENABLED == true then
  251.             wait()
  252.             CLEAR()
  253.             TRACK = false
  254.             ESP_ENABLED = true
  255.             print('ESP : OFF')
  256.         end
  257.     end
  258. end)
  259.  
  260. MOUSE.KeyDown:connect(function(KEY)
  261.     if KEY == _G.CHANGE_AIM then
  262.         if _G.AIM_AT == 'Head' then
  263.             _G.AIM_AT = 'Torso'
  264.             GUI_AIM_AT.Text = 'AIMING : TORSO'
  265.         elseif _G.AIM_AT == 'Torso' then
  266.             _G.AIM_AT = 'Head'
  267.             GUI_AIM_AT.Text = 'AIMING : HEAD'
  268.         end
  269.     end
  270. end)
  271.  
  272.  
  273. game:GetService('RunService').RenderStepped:connect(function()
  274.     if ENABLED then
  275.         local TARGET = GetNearestPlayerToMouse()
  276.         if (TARGET ~= false) then
  277.             local AIM = TARGET:FindFirstChild(_G.AIM_AT)
  278.             if AIM then
  279.                 CC.CoordinateFrame = CFrame.new(CC.CoordinateFrame.p, AIM.CFrame.p)
  280.             end
  281.             GUI_TARGET.Text = 'AIMBOT : ON'
  282.         else
  283.             GUI_TARGET.Text = 'AIMBOT : OFF'
  284.         end
  285.     end
  286. end)
  287.  
  288. repeat
  289.     wait()
  290.     if ESP_ENABLED == true then
  291.         FIND()
  292.     end
  293. until ESP_ENABLED == false
  294. wait()
  295. _G.FREE_FOR_ALL = true
  296. _G.BIND = 50 -- LEFT CTRL
  297. _G.ESP_BIND = 52 -- LEFT ALT
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement