Advertisement
Potato228

AimLock [free] bind e

Sep 4th, 2022
1,252
-1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 9.72 KB | Gaming | 0 1
  1. -- streamable i used in the video
  2.  
  3. local hotkey = 'z'
  4. local mouse = game.Players.LocalPlayer:GetMouse()
  5.  
  6. mouse.KeyDown:Connect(function(key)
  7. if key == hotkey then
  8. if getgenv().ValiantAimHacks.SilentAimEnabled == true then
  9. getgenv().ValiantAimHacks.SilentAimEnabled = false
  10. else
  11. getgenv().ValiantAimHacks.SilentAimEnabled = true
  12. end
  13. end
  14. end)
  15.  
  16. -- // Services
  17. local Players = game:GetService("Players")
  18.  
  19. -- // Vars
  20. local LocalPlayer = Players.LocalPlayer
  21. local accomidationfactor = 0.11
  22.  
  23. -- // Silent Aim Module
  24. local SilentAim = loadstring(game:HttpGet("https://pastebin.com/raw/2f0mGbMP"))()
  25. SilentAim.TeamCheck = false
  26. -- // Metatable vars
  27. local mt = getrawmetatable(game)
  28. local backupindex = mt.__index
  29. setreadonly(mt, false)
  30.  
  31. -- // Check if player is down
  32. SilentAim.checkSilentAim = function()
  33.     local checkA = (SilentAim.SilentAimEnabled == true and SilentAim.Selected ~= LocalPlayer)
  34.     local playerCharacter = SilentAim.Selected.Character
  35.     local daHood = (playerCharacter.BodyEffects["K.O"].Value == false or playerCharacter:FindFirstChild("GRABBING_CONSTRAINT") ~= nil)
  36.  
  37.     return (checkA and daHood)
  38. end
  39.  
  40. -- // Hook
  41. mt.__index = newcclosure(function(t, k)
  42.     if (t:IsA("Mouse") and (k == "Hit")) then
  43.         print(t, k)
  44.         local CPlayer = SilentAim.Selected
  45.         if (SilentAim.checkSilentAim()) then
  46.             if (CPlayer.Character:FindFirstChild("HumanoidRootPart")) then
  47.                 return {p=(CPlayer.Character.HumanoidRootPart.CFrame.p+(CPlayer.Character.HumanoidRootPart.Velocity*accomidationfactor))}
  48.             end
  49.         end
  50.     end
  51.     return backupindex(t, k)
  52. end)
  53.  
  54. -- // Revert
  55. setreadonly(mt, true)
  56.  
  57.  
  58.  
  59.  
  60. __________________________________________________________________________ <--- dont copy that line
  61.  
  62.  
  63. -- cam lock i used in the video
  64. getgenv().OldAimPart = "UpperTorso"
  65. getgenv().AimPart = "UpperTorso"
  66.     getgenv().AimlockKey = "e"
  67.     getgenv().AimRadius = 7.22
  68.     getgenv().ThirdPerson = true
  69.     getgenv().FirstPerson = true
  70.     getgenv().TeamCheck = false
  71.     getgenv().PredictMovement = true
  72.     getgenv().PredictionVelocity = 25
  73.     getgenv().CheckIfJumped = true
  74.     getgenv().Smoothness = true
  75.     getgenv().SmoothnessAmount = 0.0141
  76.  
  77.     local Players, Uis, RService, SGui = game:GetService"Players", game:GetService"UserInputService", game:GetService"RunService", game:GetService"StarterGui";
  78.     local Client, Mouse, Camera, CF, RNew, Vec3, Vec2 = Players.LocalPlayer, Players.LocalPlayer:GetMouse(), workspace.CurrentCamera, CFrame.new, Ray.new, Vector3.new, Vector2.new;
  79.     local Aimlock, MousePressed, CanNotify = true, false, false;
  80.     local AimlockTarget;
  81.     local OldPre;
  82.    
  83.  
  84.    
  85.     getgenv().WorldToViewportPoint = function(P)
  86.         return Camera:WorldToViewportPoint(P)
  87.     end
  88.    
  89.     getgenv().WorldToScreenPoint = function(P)
  90.         return Camera.WorldToScreenPoint(Camera, P)
  91.     end
  92.    
  93.     getgenv().GetObscuringObjects = function(T)
  94.         if T and T:FindFirstChild(getgenv().AimPart) and Client and Client.Character:FindFirstChild("Head") then
  95.             local RayPos = workspace:FindPartOnRay(RNew(
  96.                 T[getgenv().AimPart].Position, Client.Character.Head.Position)
  97.             )
  98.             if RayPos then return RayPos:IsDescendantOf(T) end
  99.         end
  100.     end
  101.    
  102.     getgenv().GetNearestTarget = function()
  103.         local players = {}
  104.         local PLAYER_HOLD  = {}
  105.         local DISTANCES = {}
  106.         for i, v in pairs(Players:GetPlayers()) do
  107.             if v ~= Client then
  108.                 table.insert(players, v)
  109.             end
  110.         end
  111.         for i, v in pairs(players) do
  112.             if v.Character ~= nil then
  113.                 local AIM = v.Character:FindFirstChild("Head")
  114.                 if getgenv().TeamCheck == true and v.Team ~= Client.Team then
  115.                     local DISTANCE = (v.Character:FindFirstChild("Head").Position - game.Workspace.CurrentCamera.CFrame.p).magnitude
  116.                     local RAY = Ray.new(game.Workspace.CurrentCamera.CFrame.p, (Mouse.Hit.p - game.Workspace.CurrentCamera.CFrame.p).unit * DISTANCE)
  117.                     local HIT,POS = game.Workspace:FindPartOnRay(RAY, game.Workspace)
  118.                     local DIFF = math.floor((POS - AIM.Position).magnitude)
  119.                     PLAYER_HOLD[v.Name .. i] = {}
  120.                     PLAYER_HOLD[v.Name .. i].dist= DISTANCE
  121.                     PLAYER_HOLD[v.Name .. i].plr = v
  122.                     PLAYER_HOLD[v.Name .. i].diff = DIFF
  123.                     table.insert(DISTANCES, DIFF)
  124.                 elseif getgenv().TeamCheck == false and v.Team == Client.Team then
  125.                     local DISTANCE = (v.Character:FindFirstChild("Head").Position - game.Workspace.CurrentCamera.CFrame.p).magnitude
  126.                     local RAY = Ray.new(game.Workspace.CurrentCamera.CFrame.p, (Mouse.Hit.p - game.Workspace.CurrentCamera.CFrame.p).unit * DISTANCE)
  127.                     local HIT,POS = game.Workspace:FindPartOnRay(RAY, game.Workspace)
  128.                     local DIFF = math.floor((POS - AIM.Position).magnitude)
  129.                     PLAYER_HOLD[v.Name .. i] = {}
  130.                     PLAYER_HOLD[v.Name .. i].dist= DISTANCE
  131.                     PLAYER_HOLD[v.Name .. i].plr = v
  132.                     PLAYER_HOLD[v.Name .. i].diff = DIFF
  133.                     table.insert(DISTANCES, DIFF)
  134.                 end
  135.             end
  136.         end
  137.        
  138.         if unpack(DISTANCES) == nil then
  139.             return nil
  140.         end
  141.        
  142.         local L_DISTANCE = math.floor(math.min(unpack(DISTANCES)))
  143.         if L_DISTANCE > getgenv().AimRadius then
  144.             return nil
  145.         end
  146.        
  147.         for i, v in pairs(PLAYER_HOLD) do
  148.             if v.diff == L_DISTANCE then
  149.                 return v.plr
  150.             end
  151.         end
  152.         return nil
  153.     end
  154.    
  155.     Mouse.KeyDown:Connect(function(a)
  156.         if not (Uis:GetFocusedTextBox()) then
  157.             if a == AimlockKey and AimlockTarget == nil then
  158.                 pcall(function()
  159.                     if MousePressed ~= true then MousePressed = true end
  160.                     local Target;Target = GetNearestTarget()
  161.                     if Target ~= nil then
  162.                         AimlockTarget = Target
  163.                     end
  164.                 end)
  165.             elseif a == AimlockKey and AimlockTarget ~= nil then
  166.                 if AimlockTarget ~= nil then AimlockTarget = nil end
  167.                 if MousePressed ~= false then
  168.                     MousePressed = false
  169.                 end
  170.             end
  171.         end
  172.     end)
  173.    
  174.     RService.RenderStepped:Connect(function()
  175.         if getgenv().ThirdPerson == true and getgenv().FirstPerson == true then
  176.             if (Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude > 1 or (Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude <= 1 then
  177.                 CanNotify = true
  178.             else
  179.                 CanNotify = false
  180.             end
  181.         elseif getgenv().ThirdPerson == true and getgenv().FirstPerson == false then
  182.             if (Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude > 1 then
  183.                 CanNotify = true
  184.             else
  185.                 CanNotify = false
  186.             end
  187.         elseif getgenv().ThirdPerson == false and getgenv().FirstPerson == true then
  188.             if (Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude <= 1 then
  189.                 CanNotify = true
  190.             else
  191.                 CanNotify = false
  192.             end
  193.         end
  194.         if Aimlock == true and MousePressed == true then
  195.             if AimlockTarget and AimlockTarget.Character and AimlockTarget.Character:FindFirstChild(getgenv().AimPart) then
  196.                 if getgenv().FirstPerson == true then
  197.                     if CanNotify == true then
  198.                         if getgenv().PredictMovement == true then
  199.                             if getgenv().Smoothness == true then
  200.                                 --// The part we're going to lerp/smoothen \\--
  201.                                 local Main = CF(Camera.CFrame.p, AimlockTarget.Character[getgenv().AimPart].Position + AimlockTarget.Character[getgenv().AimPart].Velocity/PredictionVelocity)
  202.                                
  203.                                 --// Making it work \\--
  204.                                 Camera.CFrame = Camera.CFrame:Lerp(Main, getgenv().SmoothnessAmount, Enum.EasingStyle.Elastic, Enum.EasingDirection.InOut)
  205.                             else
  206.                                 Camera.CFrame = CF(Camera.CFrame.p, AimlockTarget.Character[getgenv().AimPart].Position + AimlockTarget.Character[getgenv().AimPart].Velocity/PredictionVelocity)
  207.                             end
  208.                         elseif getgenv().PredictMovement == false then
  209.                             if getgenv().Smoothness == true then
  210.                                 --// The part we're going to lerp/smoothen \\--
  211.                                 local Main = CF(Camera.CFrame.p, AimlockTarget.Character[getgenv().AimPart].Position)
  212.  
  213.                                 --// Making it work \\--
  214.                                 Camera.CFrame = Camera.CFrame:Lerp(Main, getgenv().SmoothnessAmount, Enum.EasingStyle.Elastic, Enum.EasingDirection.InOut)
  215.                             else
  216.                                 Camera.CFrame = CF(Camera.CFrame.p, AimlockTarget.Character[getgenv().AimPart].Position)
  217.                             end
  218.                         end
  219.                     end
  220.                 end
  221.             end
  222.         end
  223.          if CheckIfJumped == true then
  224.        if AimlockTarget.Character.HuDDDDDDDDDDWmanoid.FloorMaterial == Enum.Material.Air then
  225.    
  226.            getgenv().AimPart = "UpperTorso"
  227.        else
  228.          getgenv().AimPart = getgenv().OldAimPart
  229.  
  230.        end
  231.     end
  232. end)
  233.  
  234.  
  235.  
  236.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement