RedCrazyHunch

Aim Lock (better)

May 4th, 2019
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 13.77 KB | None | 0 0
  1. -- Farewell Infortality.
  2. -- Version: 2.82
  3. -- Instances:
  4. local Aimbot = Instance.new("ScreenGui")
  5. local Main = Instance.new("Frame")
  6. local Frame = Instance.new("Frame")
  7. local P = Instance.new("TextLabel")
  8. local L = Instance.new("TextLabel")
  9. local E = Instance.new("TextLabel")
  10. local SwitchMode = Instance.new("TextLabel")
  11. local ESP = Instance.new("TextLabel")
  12. local Aimlock = Instance.new("TextLabel")
  13. local Activate = Instance.new("TextButton")
  14. local Close = Instance.new("TextButton")
  15. local OpenFrame = Instance.new("Frame")
  16. local Open = Instance.new("TextButton")
  17. --Properties:
  18. Aimbot.Name = "Aimbot"
  19. Aimbot.Parent = game.CoreGui
  20. Aimbot.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
  21.  
  22. Main.Name = "Main"
  23. Main.Parent = Aimbot
  24. Main.BackgroundColor3 = Color3.new(0, 0, 0)
  25. Main.BorderSizePixel = 0
  26. Main.Position = UDim2.new(0.806953073, 0, 0, 0)
  27. Main.Size = UDim2.new(0, 200, 0, 100)
  28. Main.Visible = false
  29. Main.Draggable = true
  30.  
  31. Frame.Parent = Main
  32. Frame.BackgroundColor3 = Color3.new(0.294118, 0.294118, 0.294118)
  33. Frame.BorderSizePixel = 0
  34. Frame.Position = UDim2.new(0.0299999993, 0, 0.0700000003, 0)
  35. Frame.Size = UDim2.new(0, 187, 0, 86)
  36.  
  37. P.Name = "P"
  38. P.Parent = Frame
  39. P.BackgroundColor3 = Color3.new(1, 1, 1)
  40. P.BackgroundTransparency = 1
  41. P.BorderSizePixel = 0
  42. P.Position = UDim2.new(-0.117646992, 0, 0.127906978, 0)
  43. P.Size = UDim2.new(0, 71, 0, 18)
  44. P.Font = Enum.Font.Gotham
  45. P.Text = "P"
  46. P.TextColor3 = Color3.new(0, 0, 0)
  47. P.TextSize = 25
  48.  
  49. L.Name = "L"
  50. L.Parent = Frame
  51. L.BackgroundColor3 = Color3.new(1, 1, 1)
  52. L.BackgroundTransparency = 1
  53. L.BorderSizePixel = 0
  54. L.Position = UDim2.new(-0.117646992, 0, 0.395348847, 0)
  55. L.Size = UDim2.new(0, 71, 0, 18)
  56. L.Font = Enum.Font.Gotham
  57. L.Text = "L"
  58. L.TextColor3 = Color3.new(0, 0, 0)
  59. L.TextSize = 25
  60.  
  61. E.Name = "E"
  62. E.Parent = Frame
  63. E.BackgroundColor3 = Color3.new(1, 1, 1)
  64. E.BackgroundTransparency = 1
  65. E.BorderSizePixel = 0
  66. E.Position = UDim2.new(-0.117646992, 0, 0.674418569, 0)
  67. E.Size = UDim2.new(0, 71, 0, 18)
  68. E.Font = Enum.Font.Gotham
  69. E.Text = "E"
  70. E.TextColor3 = Color3.new(0, 0, 0)
  71. E.TextSize = 25
  72.  
  73. SwitchMode.Name = "Switch Mode"
  74. SwitchMode.Parent = Frame
  75. SwitchMode.BackgroundColor3 = Color3.new(1, 1, 1)
  76. SwitchMode.BackgroundTransparency = 1
  77. SwitchMode.Position = UDim2.new(0.0802139044, 0, 0.139534846, 0)
  78. SwitchMode.Size = UDim2.new(0, 191, 0, 15)
  79. SwitchMode.Font = Enum.Font.SourceSans
  80. SwitchMode.Text = "Switch Team Based Mode"
  81. SwitchMode.TextColor3 = Color3.new(0, 0, 0)
  82. SwitchMode.TextSize = 18
  83.  
  84. ESP.Name = "ESP"
  85. ESP.Parent = Frame
  86. ESP.BackgroundColor3 = Color3.new(1, 1, 1)
  87. ESP.BackgroundTransparency = 1
  88. ESP.Position = UDim2.new(-0.117647059, 0, 0.4069767, 0)
  89. ESP.Size = UDim2.new(0, 176, 0, 15)
  90. ESP.Font = Enum.Font.SourceSans
  91. ESP.Text = "Enable ESP"
  92. ESP.TextColor3 = Color3.new(0, 0, 0)
  93. ESP.TextSize = 18
  94.  
  95. Aimlock.Name = "Aimlock"
  96. Aimlock.Parent = Frame
  97. Aimlock.BackgroundColor3 = Color3.new(1, 1, 1)
  98. Aimlock.BackgroundTransparency = 1
  99. Aimlock.Position = UDim2.new(-0.208556145, 0, 0.709302306, 0)
  100. Aimlock.Size = UDim2.new(0, 193, 0, 15)
  101. Aimlock.Font = Enum.Font.SourceSans
  102. Aimlock.Text = "Aimlock"
  103. Aimlock.TextColor3 = Color3.new(0, 0, 0)
  104. Aimlock.TextSize = 18
  105.  
  106. Activate.Name = "Activate"
  107. Activate.Parent = Main
  108. Activate.BackgroundColor3 = Color3.new(0, 0, 0)
  109. Activate.BorderSizePixel = 0
  110. Activate.Position = UDim2.new(0.694999993, 0, 0.75, 0)
  111. Activate.Size = UDim2.new(0, 54, 0, 18)
  112. Activate.Font = Enum.Font.SciFi
  113. Activate.Text = "Activate"
  114. Activate.TextColor3 = Color3.new(1, 1, 1)
  115. Activate.TextSize = 14
  116. Activate.MouseButton1Down:connect(function()
  117. local plrs = game:GetService("Players")
  118. local TeamBased = true ; local teambasedswitch = "p"
  119. local presskeytoaim = true; local aimkey = "e"
  120. local raycast = false
  121.  
  122. local espupdatetime = 5; autoesp = false
  123.  
  124.  
  125.  
  126. local lockaim = true; local lockangle = 5
  127.  
  128.  
  129.  
  130. --function findwat(folder, what)
  131. --  for i, smth in pairs(folder:GetChildren()) do
  132. --      if string.find(string.lower(tostring(smth)), string.lower(what)) then
  133. --          return smth
  134. --      end
  135. --  end
  136. --end
  137. --
  138. --local plrs = findwat(game, "Players")
  139.  
  140.  
  141.  
  142.  
  143. local Gui = Instance.new("ScreenGui")
  144. local Move = Instance.new("Frame")
  145. local Main = Instance.new("Frame")
  146. local EspStatus = Instance.new("TextLabel")
  147. local st1 = Instance.new("TextLabel")
  148. local st1_2 = Instance.new("TextLabel")
  149. local st1_3 = Instance.new("TextLabel")
  150. local Name = Instance.new("TextLabel")
  151. --Properties:
  152. Gui.Name = "Gui"
  153. Gui.Parent = plrs.LocalPlayer:WaitForChild("PlayerGui")
  154.  
  155. Move.Name = "Move"
  156. Move.Parent = Gui
  157. Move.BackgroundColor3 = Color3.new(0.0431373, 1, 0.0745098)
  158. Move.BackgroundTransparency = 1
  159. Move.BorderSizePixel = 0
  160. Move.Position = UDim2.new(0.005, 0,0.018, 0)
  161. Move.Size = UDim2.new(0.28141585, 0, 0.0320388414, 0)
  162.  
  163. Main.Name = "Main"
  164. Main.Parent = Move
  165. Main.BackgroundColor3 = Color3.new(0.176471, 0.176471, 0.176471)
  166. Main.BackgroundTransparency = 1
  167. Main.Position = UDim2.new(0, 0, 0.995670795, 0)
  168. Main.Size = UDim2.new(1.0000006, 0, 9.79697132, 0)
  169. Main.Draggable = true
  170.  
  171.  
  172. -- Scripts:
  173.  
  174.  
  175. local plrsforaim = {}
  176.  
  177. local lplr = game:GetService("Players").LocalPlayer
  178. Move.Draggable = true
  179. Gui.ResetOnSpawn = false
  180. Gui.Name = "Chat"
  181. Gui.DisplayOrder = 999
  182.  
  183.     Gui.Parent = plrs.LocalPlayer.PlayerGui
  184.  
  185.  
  186. f = {}
  187. local espforlder
  188.  
  189. f.addesp = function()
  190.     --print("ESP ran")
  191.     if espforlder then
  192.     else
  193.         espforlder = Instance.new("Folder")
  194.         espforlder.Parent = game.Workspace.CurrentCamera
  195.     end
  196.     for i, v in pairs(espforlder:GetChildren()) do
  197.         v:Destroy()
  198.     end
  199.     for _, plr in pairs(plrs:GetChildren()) do
  200.         if plr.Character and plr.Character.Humanoid.Health > 0 and plr.Name ~= lplr.Name then
  201.             if TeamBased == true then
  202.                 if plr.Team.Name ~= plrs.LocalPlayer.Team.Name  then
  203.                     local e = espforlder:FindFirstChild(plr.Name)
  204.                     if not e then
  205.                         --print("Added esp for team based")
  206.                         local bill = Instance.new("BillboardGui", espforlder)
  207.                         bill.Name = plr.Name
  208.                         bill.AlwaysOnTop = true
  209.                         bill.Size = UDim2.new(1,0,1,0)
  210.                         bill.Adornee = plr.Character.Head
  211.                         local Frame = Instance.new('Frame',bill)
  212.                         Frame.Active = true
  213.                         Frame.BackgroundColor3 = Color3.new(0/255,255/255,0/255)
  214.                         Frame.BackgroundTransparency = 0
  215.                         Frame.BorderSizePixel = 0
  216.                         Frame.AnchorPoint = Vector2.new(.5, .5)
  217.                         Frame.Position = UDim2.new (0.5,0,0.5,0)
  218.                         Frame.Size = UDim2.new (1,0,1,0)
  219.                         Frame.Rotation = 0
  220.                         plr.Character.Humanoid.Died:Connect(function()
  221.                             bill:Destroy()
  222.                         end)
  223.                     end
  224.                 end
  225.             else
  226.                 local e = espforlder:FindFirstChild(plr.Name)
  227.                 if not e then
  228.                     --print("Added esp")
  229.                     local bill = Instance.new("BillboardGui", espforlder)
  230.                     bill.Name = plr.Name
  231.                     bill.AlwaysOnTop = true
  232.                     bill.Size = UDim2.new(1,0,1,0)
  233.                     bill.Adornee = plr.Character.Head
  234.                     local Frame = Instance.new('Frame',bill)
  235.                     Frame.Active = true
  236.                     Frame.BackgroundColor3 = Color3.new(255/255,255/255,255/255)
  237.                     Frame.BackgroundTransparency = 0
  238.                     Frame.BorderSizePixel = 0
  239.                     Frame.AnchorPoint = Vector2.new(.5, .5)
  240.                     Frame.Position = UDim2.new (0.5,0,0.5,0)
  241.                     Frame.Size = UDim2.new (2,0,2,0)
  242.                     Frame.Rotation = 0
  243.                     plr.Character.Humanoid.Died:Connect(function()
  244.                         bill:Destroy()
  245.                     end)
  246.                 end
  247.             end
  248.            
  249.            
  250.         end
  251.     end
  252. end
  253. local cam = game.Workspace.CurrentCamera
  254.  
  255. local mouse = lplr:GetMouse()
  256. local switch = false
  257. local key = "k"
  258. local aimatpart = nil
  259. mouse.KeyDown:Connect(function(a)
  260.     if a == "t" then
  261.         print("worked1")
  262.         f.addesp()
  263.     elseif a == "u" then
  264.         if raycast == true then
  265.             raycast = false
  266.         else
  267.             raycast = true
  268.         end
  269.     elseif a == "l" then
  270.         if autoesp == false then
  271.             autoesp = true
  272.         else
  273.             autoesp = false
  274.         end
  275.     end
  276.     if a == "j" then
  277.         if mouse.Target then
  278.             mouse.Target:Destroy()
  279.         end
  280.     end
  281.     if a == key then
  282.         if switch == false then
  283.             switch = true
  284.         else
  285.             switch = false
  286.             if aimatpart ~= nil then
  287.                 aimatpart = nil
  288.             end
  289.         end
  290.     elseif a == teambasedswitch then
  291.         if TeamBased == true then
  292.             TeamBased = false
  293.             teambasedstatus.Text = tostring(TeamBased)
  294.         else
  295.             TeamBased = true
  296.             teambasedstatus.Text = tostring(TeamBased)
  297.         end
  298.     elseif a == aimkey then
  299.         if not aimatpart then
  300.             local maxangle = math.rad(20)
  301.             for i, plr in pairs(plrs:GetChildren()) do
  302.                 if plr.Name ~= lplr.Name and plr.Character and plr.Character.Head and plr.Character.Humanoid and plr.Character.Humanoid.Health > 1 then
  303.                     if TeamBased == true then
  304.                         if plr.Team.Name ~= lplr.Team.Name then
  305.                             local an = checkfov(plr.Character.Head)
  306.                             if an < maxangle then
  307.                                 maxangle = an
  308.                                 aimatpart = plr.Character.Head
  309.                             end
  310.                         end
  311.                     else
  312.                         local an = checkfov(plr.Character.Head)
  313.                             if an < maxangle then
  314.                                 maxangle = an
  315.                                 aimatpart = plr.Character.Head
  316.                             end
  317.                             print(plr)
  318.                     end
  319.                     plr.Character.Humanoid.Died:Connect(function()
  320.                         if aimatpart.Parent == plr.Character or aimatpart == nil then
  321.                             aimatpart = nil
  322.                         end
  323.                     end)
  324.                 end
  325.             end
  326.         else
  327.             aimatpart = nil
  328.         end
  329.     end
  330. end)
  331.  
  332. function getfovxyz (p0, p1, deg)
  333.     local x1, y1, z1 = p0:ToOrientation()
  334.     local cf = CFrame.new(p0.p, p1.p)
  335.     local x2, y2, z2 = cf:ToOrientation()
  336.     --local d = math.deg
  337.     if deg then
  338.         --return Vector3.new(d(x1-x2), d(y1-y2), d(z1-z2))
  339.     else
  340.         return Vector3.new((x1-x2), (y1-y2), (z1-z2))
  341.     end
  342. end
  343.  
  344. function getaimbotplrs()
  345.     plrsforaim = {}
  346.     for i, plr in pairs(plrs:GetChildren()) do
  347.         if plr.Character and plr.Character.Humanoid and plr.Character.Humanoid.Health > 0 and plr.Name ~= lplr.Name and plr.Character.Head then
  348.            
  349.             if TeamBased == true then
  350.                 if plr.Team.Name ~= lplr.Team.Name then
  351.                     local cf = CFrame.new(game.Workspace.CurrentCamera.CFrame.p, plr.Character.Head.CFrame.p)
  352.                     local r = Ray.new(cf, cf.LookVector * 10000)
  353.                     local ign = {}
  354.                     for i, v in pairs(plrs.LocalPlayer.Character:GetChildren()) do
  355.                         if v:IsA("BasePart") then
  356.                             table.insert(ign , v)
  357.                         end
  358.                     end
  359.                     local obj = game.Workspace:FindPartOnRayWithIgnoreList(r, ign)
  360.                     if obj.Parent == plr.Character and obj.Parent ~= lplr.Character then
  361.                         table.insert(plrsforaim, obj)
  362.                     end
  363.                 end
  364.             else
  365.                 local cf = CFrame.new(game.Workspace.CurrentCamera.CFrame.p, plr.Character.Head.CFrame.p)
  366.                 local r = Ray.new(cf, cf.LookVector * 10000)
  367.                 local ign = {}
  368.                 for i, v in pairs(plrs.LocalPlayer.Character:GetChildren()) do
  369.                     if v:IsA("BasePart") then
  370.                         table.insert(ign , v)
  371.                     end
  372.                 end
  373.                 local obj = game.Workspace:FindPartOnRayWithIgnoreList(r, ign)
  374.                 if obj.Parent == plr.Character and obj.Parent ~= lplr.Character then
  375.                     table.insert(plrsforaim, obj)
  376.                 end
  377.             end
  378.            
  379.            
  380.         end
  381.     end
  382. end
  383.  
  384. function aimat(part)
  385.     cam.CFrame = CFrame.new(cam.CFrame.p, part.CFrame.p)
  386. end
  387. function checkfov (part)
  388.     local fov = getfovxyz(game.Workspace.CurrentCamera.CFrame, part.CFrame)
  389.     local angle = math.abs(fov.X) + math.abs(fov.Y)
  390.     return angle
  391. end
  392.  
  393. game:GetService("RunService").RenderStepped:Connect(function()
  394.     if aimatpart then
  395.         aimat(aimatpart)
  396.         if aimatpart.Parent == plrs.LocalPlayer.Character then
  397.             aimatpart = nil
  398.         end
  399.     end
  400.    
  401.    
  402. --  if switch == true then
  403. --      local maxangle = 99999
  404. --     
  405. --      --print("Loop")
  406. --      if true and raycast == false then
  407. --          for i, plr in pairs(plrs:GetChildren()) do
  408. --              if plr.Name ~= lplr.Name and plr.Character and plr.Character.Head and plr.Character.Humanoid and plr.Character.Humanoid.Health > 1 then
  409. --                  if TeamBased then
  410. --                      if plr.Team.Name ~= lplr.Team.Name or plr.Team.TeamColor ~= lplr.Team.TeamColor then
  411. --                          local an = checkfov(plr.Character.Head)
  412. --                          if an < maxangle then
  413. --                              maxangle = an
  414. --                              aimatpart = plr.Character.Head
  415. --                              if an < lockangle then
  416. --                                  break
  417. --                              end
  418. --                          end
  419. --                      end
  420. --                  else
  421. --                      local an = checkfov(plr.Character.Head)
  422. --                          if an < maxangle then
  423. --                              maxangle = an
  424. --                              aimatpart = plr.Character.Head
  425. --                              if an < lockangle then
  426. --                                  break
  427. --                              end
  428. --                          end
  429. --                  end
  430. --                 
  431. --                 
  432. --                 
  433. --                 
  434. --              end
  435. --          end
  436. --      elseif raycast == true then
  437. --         
  438. --      end
  439.        
  440.         if raycast == true and switch == false and not aimatpart then
  441.             getaimbotplrs()
  442.             aimatpart = nil
  443.             local maxangle = 999
  444.             for i, v in ipairs(plrsforaim) do
  445.                 if v.Parent ~= lplr.Character then
  446.                     local an = checkfov(v)
  447.                     if an < maxangle and v ~= lplr.Character.Head then
  448.                         maxangle = an
  449.                         aimatpart = v
  450.                         print(v:GetFullName())
  451.                         v.Parent.Humanoid.Died:connect(function()
  452.                             aimatpart = nil
  453.                         end)
  454.                     end
  455.                 end
  456.             end
  457.        
  458.     end
  459. end)
  460. delay(0, function()
  461.     while wait(espupdatetime) do
  462.         if autoesp == true then
  463.             pcall(function()
  464.             f.addesp()
  465.             end)
  466.         end
  467.     end
  468. end)
  469. warn("loaded")
  470. end)
  471.  
  472. OpenFrame.Name = "OpenFrame"
  473. OpenFrame.Parent = Aimbot
  474. OpenFrame.BackgroundColor3 = Color3.new(0, 0, 0)
  475. OpenFrame.BorderSizePixel = 0
  476. OpenFrame.Position = UDim2.new(0.754807711, 0, 0, 0)
  477. OpenFrame.Size = UDim2.new(0, 54, 0, 18)
  478.  
  479. Open.Name = "Open"
  480. Open.Parent = OpenFrame
  481. Open.BackgroundColor3 = Color3.new(1, 1, 1)
  482. Open.BackgroundTransparency = 1
  483. Open.Size = UDim2.new(0, 54, 0, 18)
  484. Open.Font = Enum.Font.SciFi
  485. Open.Text = "Open"
  486. Open.TextColor3 = Color3.new(1, 1, 1)
  487. Open.TextSize = 14
  488. Open.MouseButton1Down:connect(function()
  489. Main.Visible = true
  490. OpenFrame.Visible = false
  491. end)
  492.  
  493. Close.Name = "Close"
  494. Close.Parent = Main
  495. Close.BackgroundColor3 = Color3.new(1, 1, 1)
  496. Close.BackgroundTransparency = 1
  497. Close.Position = UDim2.new(-0.0349999964, 0, 0, 0)
  498. Close.Size = UDim2.new(0, 37, 0, 25)
  499. Close.Font = Enum.Font.SciFi
  500. Close.Text = "X"
  501. Close.TextColor3 = Color3.new(1, 1, 1)
  502. Close.TextSize = 10
  503. Close.MouseButton1Down:connect(function()
  504. OpenFrame.Visible = true
  505. Main.Visible = false
  506. end)
Add Comment
Please, Sign In to add comment