vtrvsted

priv lock

Sep 16th, 2022
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 9.04 KB | None | 0 0
  1. -- modified by lxs --
  2.  
  3.  
  4. getgenv().Enabled = true
  5. getgenv().Aimlockkey = "q"
  6. getgenv().Prediction = 0.11529944882
  7. getgenv().Aimpart = "HumanoidRootPart"
  8. getgenv().Notifications = true
  9. getgenv().Color = Color3.fromRGB(153, 50, 204)
  10. getgenv().FOV = false
  11. getgenv().Notifications = true
  12. getgenv().Colorr = Color3.fromRGB(153, 50, 204)
  13. getgenv().Transparency = 1
  14. getgenv().Thickness = 3.5
  15.  
  16.  
  17. local CurrentCamera = game:GetService("Workspace").CurrentCamera
  18. local Inset = game:GetService("GuiService"):GetGuiInset().Y
  19. local RunService = game:GetService("RunService")
  20.  
  21. local Mouse = game.Players.LocalPlayer:GetMouse()
  22. local LocalPlayer = game.Players.LocalPlayer
  23.  
  24. local Line = Drawing.new("Line")
  25. local Circle = Drawing.new("Circle")
  26.  
  27. local Plr
  28.  
  29. Mouse.KeyDown:Connect(function(KeyPressed)
  30.     if KeyPressed == (getgenv().Aimlockkey) then
  31.         if getgenv().Enabled == true then
  32.             getgenv().Enabled = false
  33.             if getgenv().Notifications == true then
  34.                 Plr = FindClosestPlayer()
  35.                 game.StarterGui:SetCore("SendNotification", {
  36.                     Title = "Private",
  37.                     Text = "Unlocked"
  38.                 })
  39.             end
  40.         else
  41.             Plr = FindClosestPlayer()
  42.             getgenv().Enabled = true
  43.             if getgenv().Notifications == true then
  44.                 game.StarterGui:SetCore("SendNotification", {
  45.                     Title = "Private",
  46.                     Text = "Locked On :  " .. tostring(Plr.Character.Humanoid.DisplayName)
  47.                 })
  48.             end
  49.         end
  50.     end
  51. end)
  52.  
  53. function FindClosestPlayer()
  54.     local ClosestDistance, ClosestPlayer = math.huge, nil;
  55.     for _, Player in next, game:GetService("Players"):GetPlayers() do
  56.         local ISNTKNOCKED = Player.Character:WaitForChild("BodyEffects")["K.O"].Value ~= true
  57.         local ISNTGRABBED = Player.Character:FindFirstChild("GRABBING_COINSTRAINT") == nil
  58.  
  59.         if Player ~= LocalPlayer then
  60.             local Character = Player.Character
  61.             if Character and Character.Humanoid.Health > 1 and ISNTKNOCKED and ISNTGRABBED then
  62.                 local Position, IsVisibleOnViewPort = CurrentCamera:WorldToViewportPoint(Character.HumanoidRootPart
  63.                                                                                              .Position)
  64.                 if IsVisibleOnViewPort then
  65.                     local Distance = (Vector2.new(Mouse.X, Mouse.Y) - Vector2.new(Position.X, Position.Y)).Magnitude
  66.                     if Distance < ClosestDistance then
  67.                         ClosestPlayer = Player
  68.                         ClosestDistance = Distance
  69.                     end
  70.                 end
  71.             end
  72.         end
  73.     end
  74.     return ClosestPlayer, ClosestDistance
  75. end
  76.  
  77. RunService.Heartbeat:connect(function()
  78.     if getgenv().Enabled == true then
  79.         local Vector = CurrentCamera:WorldToViewportPoint(Plr.Character[getgenv().Aimpart].Position +
  80.                                                               (Plr.Character[getgenv().Aimpart].Velocity*Prediction))
  81.         Line.Color = getgenv().Colorr
  82.         Line.Transparency = getgenv().Transparency
  83.         Line.Thickness = getgenv().Thickness
  84.         Line.From = Vector2.new(Mouse.X, Mouse.Y + Inset)
  85.         Line.To = Vector2.new(Vector.X, Vector.Y)
  86.         Line.Visible = true
  87.         Circle.Position = Vector2.new(Mouse.X, Mouse.Y + Inset)
  88.         Circle.Visible = getgenv().FOV
  89.         Circle.Thickness = 1.5
  90.         Circle.Thickness = 2
  91.         Circle.Radius = 60
  92.         Circle.Color = getgenv().Color
  93.  
  94.     else
  95.         Line.Visible = false
  96.         Circle.Visible = false
  97.     end
  98. end)
  99.  
  100.  
  101. local rawmetatable = getrawmetatable(game)
  102. local old = rawmetatable.__namecall
  103. setreadonly(rawmetatable, false)
  104. rawmetatable.__namecall = newcclosure(function(...)
  105.     local args = {...}
  106.     if getgenv().Enabled and getnamecallmethod() == "FireServer" and args[2] == "UpdateMousePos" then
  107.         args[3] = Plr.Character[getgenv().Aimpart].Position+(Plr.Character[getgenv().Aimpart].Velocity*Prediction)
  108.         return old(unpack(args))
  109.     end
  110.     return old(...)
  111. end)
  112.  
  113.  
  114.  
  115. --[[
  116. ████████ ██   ██ ██    ██ ███████ ██   ██ ██    ██
  117.    ██    ██   ██ ██    ██ ██      ██  ██   ██  ██  
  118.    ██    ███████ ██    ██ ███████ █████     ████  
  119.    ██    ██   ██ ██    ██      ██ ██  ██     ██    
  120.    ██    ██   ██  ██████  ███████ ██   ██    ██                                              
  121. ]]
  122. local Settings = {
  123.     AimLock = {
  124.         Enabled = true,
  125.         Aimlockkey = "q",
  126.         Prediction = 0.11567724521,
  127.         Aimpart = 'HumanoidRootPart',
  128.         Notifications = false
  129.     },
  130.     Settings = {
  131.         Thickness = 3.5,
  132.         Transparency = 1,
  133.         Color = Color3.fromRGB(153, 50, 204),
  134.         FOV = false
  135.     }
  136.  
  137. }
  138.  
  139. local CurrentCamera = game:GetService("Workspace").CurrentCamera
  140. local Inset = game:GetService("GuiService"):GetGuiInset().Y
  141. local RunService = game:GetService("RunService")
  142.  
  143. local Mouse = game.Players.LocalPlayer:GetMouse()
  144. local LocalPlayer = game.Players.LocalPlayer
  145.  
  146. local Line = Drawing.new("Line")
  147. local Circle = Drawing.new("Circle")
  148.  
  149. local Plr
  150.  
  151. Mouse.KeyDown:Connect(function(KeyPressed)
  152.     if KeyPressed == (Settings.AimLock.Aimlockkey) then
  153.         if Settings.AimLock.Enabled == true then
  154.             Settings.AimLock.Enabled = false
  155.             if Settings.AimLock.Notifications == true then
  156.                 Plr = FindClosestPlayer()
  157.                 game.StarterGui:SetCore("SendNotification", {
  158.                     Title = "Private",
  159.                     Text = "Unlocked"
  160.                 })
  161.             end
  162.         else
  163.             Plr = FindClosestPlayer()
  164.             Settings.AimLock.Enabled = true
  165.             if Settings.AimLock.Notifications == true then
  166.                 game.StarterGui:SetCore("SendNotification", {
  167.                     Title = "Private",
  168.                     Text = "Locked On :  " .. tostring(Plr.Character.Humanoid.DisplayName)
  169.                 })
  170.             end
  171.         end
  172.     end
  173. end)
  174.  
  175. function FindClosestPlayer()
  176.     local ClosestDistance, ClosestPlayer = math.huge, nil;
  177.     for _, Player in next, game:GetService("Players"):GetPlayers() do
  178.         local ISNTKNOCKED = Player.Character:WaitForChild("BodyEffects")["K.O"].Value ~= true
  179.         local ISNTGRABBED = Player.Character:FindFirstChild("GRABBING_COINSTRAINT") == nil
  180.  
  181.         if Player ~= LocalPlayer then
  182.             local Character = Player.Character
  183.             if Character and Character.Humanoid.Health > 1 and ISNTKNOCKED and ISNTGRABBED then
  184.                 local Position, IsVisibleOnViewPort = CurrentCamera:WorldToViewportPoint(Character.HumanoidRootPart
  185.                                                                                              .Position)
  186.                 if IsVisibleOnViewPort then
  187.                     local Distance = (Vector2.new(Mouse.X, Mouse.Y) - Vector2.new(Position.X, Position.Y)).Magnitude
  188.                     if Distance < ClosestDistance then
  189.                         ClosestPlayer = Player
  190.                         ClosestDistance = Distance
  191.                     end
  192.                 end
  193.             end
  194.         end
  195.     end
  196.     return ClosestPlayer, ClosestDistance
  197. end
  198.  
  199. RunService.Heartbeat:connect(function()
  200.     if Settings.AimLock.Enabled == true then
  201.         local Vector = CurrentCamera:WorldToViewportPoint(Plr.Character[Settings.AimLock.Aimpart].Position +
  202.                                                               (Plr.Character[Settings.AimLock.Aimpart].Velocity *
  203.                                                               Settings.AimLock.Prediction))
  204.         Line.Color = Settings.Settings.Color
  205.         Line.Transparency = Settings.Settings .Transparency
  206.         Line.Thickness = Settings.Settings .Thickness
  207.         Line.From = Vector2.new(Mouse.X, Mouse.Y + Inset)
  208.         Line.To = Vector2.new(Vector.X, Vector.Y)
  209.         Line.Visible = true
  210.         Circle.Position = Vector2.new(Mouse.X, Mouse.Y + Inset)
  211.         Circle.Visible = Settings.Settings.FOV
  212.         Circle.Thickness = 1.5
  213.         Circle.Thickness = 2
  214.         Circle.Radius = 60
  215.         Circle.Color = Settings.Settings.Color
  216.     elseif Settings.AimLock.FOV == true then
  217.         Circle.Visible = true
  218.     else
  219.         Circle.Visible = false
  220.         Line.Visible = false
  221.     end
  222. end)
  223.  
  224. local rawmetatable = getrawmetatable(game)
  225. local old = rawmetatable.__namecall
  226. setreadonly(rawmetatable, false)
  227. rawmetatable.__namecall = newcclosure(function(...)
  228.     local args = {...}
  229.     if Settings.AimLock.Enabled and getnamecallmethod() == "FireServer" and args[2] == "UpdateMousePos" then
  230.         args[3] = Plr.Character[Settings.AimLock.Aimpart].Position+(Plr.Character[Settings.AimLock.Aimpart].Velocity*Settings.AimLock.Prediction)
  231.         return old(unpack(args))
  232.     end
  233.     return old(...)
  234. end)
Add Comment
Please, Sign In to add comment