Advertisement
thinhne

Aimlock

Dec 4th, 2022 (edited)
666
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 9.63 KB | None | 0 0
  1. local Settings = {
  2.     rewrittenmain = {
  3.         Enabled = true,
  4.         Key = "q",
  5.         DOT = true,
  6.         AIRSHOT = true,
  7.         NOTIF = true,
  8.         AUTOPRED = false,
  9.         FOV = math.huge,
  10.         RESOVLER = false
  11.     }
  12. }
  13. local SelectedPart = "LowerTorso"
  14. local Prediction = true
  15. local PredictionValue =  0.1433431 --{{ Change 0.1433431 to 0.15465 for the best experience
  16.     local AnchorCount = 0
  17.     local MaxAnchor = 50
  18.  
  19.     local CC = game:GetService"Workspace".CurrentCamera
  20.     local Plr;
  21.     local enabled = false
  22.     local accomidationfactor = 0.1433431
  23.     local mouse = game.Players.LocalPlayer:GetMouse()
  24.     local placemarker = Instance.new("Part", game.Workspace)
  25.  
  26.     function makemarker(Parent, Adornee, Color, Size, Size2)
  27.         local e = Instance.new("BillboardGui", Parent)
  28.         e.Name = "PP"
  29.         e.Adornee = Adornee
  30.         e.Size = UDim2.new(Size, Size2, Size, Size2)
  31.         e.AlwaysOnTop = Settings.rewrittenmain.DOT
  32.         local a = Instance.new("Frame", e)
  33.         if Settings.rewrittenmain.DOT == true then
  34.         a.Size = UDim2.new(1, 0, 1, 0)
  35.         else
  36.         a.Size = UDim2.new(0, 0, 0, 0)
  37.         end
  38.         if Settings.rewrittenmain.DOT == true then
  39.         a.Transparency = 0
  40.         a.BackgroundTransparency = 0
  41.         else
  42.         a.Transparency = 1
  43.         a.BackgroundTransparency = 1
  44.         end
  45.         a.BackgroundColor3 = Color
  46.         local g = Instance.new("UICorner", a)
  47.         if Settings.rewrittenmain.DOT == false then
  48.         g.CornerRadius = UDim.new(0, 0)
  49.         else
  50.         g.CornerRadius = UDim.new(1, 1)
  51.         end
  52.         return(e)
  53.     end
  54.  
  55.    
  56.     local data = game.Players:GetPlayers()
  57.     function noob(player)
  58.         local character
  59.         repeat wait() until player.Character
  60.         local handler = makemarker(guimain, player.Character:WaitForChild(SelectedPart), Color3.fromRGB(107, 184, 255), 0.3, 3)
  61.         handler.Name = player.Name
  62.         player.CharacterAdded:connect(function(Char) handler.Adornee = Char:WaitForChild(SelectedPart) end)
  63.  
  64.  
  65.         spawn(function()
  66.             while wait() do
  67.                 if player.Character then
  68.                 end
  69.             end
  70.         end)
  71.     end
  72.  
  73.     for i = 1, #data do
  74.         if data[i] ~= game.Players.LocalPlayer then
  75.             noob(data[i])
  76.         end
  77.     end
  78.  
  79.     game.Players.PlayerAdded:connect(function(Player)
  80.         noob(Player)
  81.     end)
  82.  
  83.     spawn(function()
  84.         placemarker.Anchored = true
  85.         placemarker.CanCollide = false
  86.         if Settings.rewrittenmain.DOT == true then
  87.         placemarker.Size = Vector3.new(8, 8, 8)
  88.         else
  89.         placemarker.Size = Vector3.new(0, 0, 0)
  90.         end
  91.         placemarker.Transparency = 1
  92.         if Settings.rewrittenmain.DOT then
  93.         makemarker(placemarker, placemarker, Color3.fromRGB(255, 255, 255), 0.40, 0)
  94.         end
  95.     end)
  96.  
  97.     game.Players.LocalPlayer:GetMouse().KeyDown:Connect(function(k)
  98.         if k == Settings.rewrittenmain.Key and Settings.rewrittenmain.Enabled then
  99.             if enabled == true then
  100.                 enabled = false
  101.                 if Settings.rewrittenmain.NOTIF == true then
  102.                     Plr = getClosestPlayerToCursor()
  103.  
  104.             end
  105.             else
  106.                 Plr = getClosestPlayerToCursor()
  107.                 enabled = true
  108.                 if Settings.rewrittenmain.NOTIF == true then
  109.  
  110.  
  111.                 end
  112.             end
  113.         end
  114.     end)
  115.  
  116.  
  117.     function getClosestPlayerToCursor()
  118.         local closestPlayer
  119.         local shortestDistance = Settings.rewrittenmain.FOV
  120.  
  121.         for i, v in pairs(game.Players:GetPlayers()) do
  122.             if v ~= game.Players.LocalPlayer and v.Character and v.Character:FindFirstChild("Humanoid") and v.Character.Humanoid.Health ~= 0 and v.Character:FindFirstChild("HumanoidRootPart") then
  123.                 local pos = CC:WorldToViewportPoint(v.Character.PrimaryPart.Position)
  124.                 local magnitude = (Vector2.new(pos.X, pos.Y) - Vector2.new(mouse.X, mouse.Y)).magnitude
  125.                 if magnitude < shortestDistance then
  126.                     closestPlayer = v
  127.                     shortestDistance = magnitude
  128.                 end
  129.             end
  130.         end
  131.         return closestPlayer
  132.     end
  133.  
  134.     local pingvalue = nil;
  135.     local split = nil;
  136.     local ping = nil;
  137.  
  138.     game:GetService"RunService".Stepped:connect(function()
  139.         if enabled and Plr.Character ~= nil and Plr.Character:FindFirstChild("HumanoidRootPart") then
  140.             placemarker.CFrame = CFrame.new(Plr.Character.HumanoidRootPart.Position+(Plr.Character.HumanoidRootPart.Velocity*accomidationfactor))
  141.         else
  142.             placemarker.CFrame = CFrame.new(0, 9999, 0)
  143.         end
  144.         if Settings.rewrittenmain.AUTOPRED == true then
  145.              pingvalue = game:GetService("Stats").Network.ServerStatsItem["Data Ping"]:GetValueString()
  146.              split = string.split(pingvalue,'(')
  147.              ping = tonumber(split[1])
  148.             if ping < 130 then
  149.                 PredictionValue = 0.151
  150.             elseif ping < 125 then
  151.                 PredictionValue = 0.149
  152.             elseif ping < 110 then
  153.                 PredictionValue = 0.146
  154.             elseif ping < 105 then
  155.                 PredictionValue = 0.138
  156.             elseif ping < 90 then
  157.                 PredictionValue = 0.136
  158.             elseif ping < 80 then
  159.                 PredictionValue = 0.134
  160.             elseif ping < 70 then
  161.                 PredictionValue = 0.131
  162.             elseif ping < 60 then
  163.                 PredictionValue = 0.1229
  164.             elseif ping < 50 then
  165.                 PredictionValue = 0.1225
  166.             elseif ping < 40 then
  167.                 PredictionValue = 0.1256
  168.             end
  169.         end
  170.     end)
  171.  
  172.     local mt = getrawmetatable(game)
  173.     local old = mt.__namecall
  174.     setreadonly(mt, false)
  175.     mt.__namecall = newcclosure(function(...)
  176.         local args = {...}
  177.         if enabled and getnamecallmethod() == "FireServer" and args[2] == "UpdateMousePos" and Settings.rewrittenmain.Enabled and Plr.Character ~= nil then
  178.  
  179.             -- args[3] = Plr.Character.HumanoidRootPart.Position+(Plr.Character.HumanoidRootPart.Velocity*accomidationfactor)
  180.             --[[
  181.             if Settings.rewrittenmain.AIRSHOT == true then
  182.                 if game.Workspace.Players[Plr.Name].Humanoid:GetState() == Enum.HumanoidStateType.Freefall then -- Plr.Character:WaitForChild("Humanoid"):GetState() == Enum.HumanoidStateType.Freefall
  183.                    
  184.                     --// Airshot
  185.                     args[3] = Plr.Character.LeftFoot.Position+(Plr.Character.LeftFoot.Velocity*PredictionValue)
  186.  
  187.                 else
  188.                     args[3] = Plr.Character.HumanoidRootPart.Position+(Plr.Character.HumanoidRootPart.Velocity*PredictionValue)
  189.  
  190.                 end
  191.             else
  192.                     args[3] = Plr.Character.HumanoidRootPart.Position+(Plr.Character.HumanoidRootPart.Velocity*PredictionValue)
  193.             end
  194.             ]]
  195.             if Prediction == true then
  196.                
  197.             args[3] = Plr.Character[SelectedPart].Position+(Plr.Character[SelectedPart].Velocity*PredictionValue)
  198.  
  199.             else
  200.  
  201.             args[3] = Plr.Character[SelectedPart].Position
  202.  
  203.             end
  204.  
  205.             return old(unpack(args))
  206.         end
  207.         return old(...)
  208.     end)
  209.  
  210.     game:GetService("RunService").RenderStepped:Connect(function()
  211.         if Settings.rewrittenmain.RESOVLER == true and Plr.Character ~= nil and enabled and Settings.rewrittenmain.Enabled then
  212.         if Settings.rewrittenmain.AIRSHOT == true and enabled and Plr.Character ~= nil then
  213.            
  214.             if game.Workspace.Players[Plr.Name].Humanoid:GetState() == Enum.HumanoidStateType.Freefall then -- Plr.Character:WaitForChild("Humanoid"):GetState() == Enum.HumanoidStateType.Freefall
  215.                
  216.  
  217.                 --// Anchor Check
  218.  
  219.                 if Plr.Character ~= nil and Plr.Character.HumanoidRootPart.Anchored == true then
  220.                     AnchorCount = AnchorCount + 1
  221.                     if AnchorCount >= MaxAnchor then
  222.                         Prediction = false
  223.                         wait(2)
  224.                         AnchorCount = 0;
  225.                     end
  226.                 else
  227.                     Prediction = true
  228.                     AnchorCount = 0;
  229.                 end
  230.  
  231.                 SelectedPart = "LeftFoot"
  232.  
  233.             else
  234.                 --// Anchor Check
  235.  
  236.                 if Plr.Character ~= nil and Plr.Character.HumanoidRootPart.Anchored == true then
  237.                     AnchorCount = AnchorCount + 1
  238.                     if AnchorCount >= MaxAnchor then
  239.                         Prediction = false
  240.                         wait(2)
  241.                         AnchorCount = 0;
  242.                     end
  243.                 else
  244.                     Prediction = true
  245.                     AnchorCount = 0;
  246.                 end
  247.  
  248.                 SelectedPart = "HumanoidRootPart"
  249.  
  250.             end
  251.             else
  252.  
  253.                 --// Anchor Check
  254.  
  255.                 if Plr.Character ~= nil and Plr.Character.HumanoidRootPart.Anchored == true then
  256.                     AnchorCount = AnchorCount + 1
  257.                     if AnchorCount >= MaxAnchor then
  258.                         Prediction = false
  259.                         wait(2)
  260.                         AnchorCount = 0;
  261.                     end
  262.                 else
  263.                     Prediction = true
  264.                     AnchorCount = 0;
  265.                 end
  266.  
  267.                 SelectedPart = "HumanoidRootPart"
  268.             end
  269.  
  270.         else
  271.                 SelectedPart = "HumanoidRootPart"
  272.         end
  273.     end)
  274.  
Advertisement
Comments
Add Comment
Please, Sign In to add comment
Advertisement