Advertisement
milesm0ricon

op silent aim/lock (q to enable)

Jun 28th, 2022
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.90 KB | None | 0 0
  1. getgenv().Key = Enum.KeyCode.Q
  2. getgenv().Prediction = 0.11627
  3. getgenv().Partz = "LowerTorso" -- LowerTorso, HumanoidRootPart,Head,UpperTorso
  4. getgenv().Color = Color3.fromRGB(133, 103, 247)
  5. getgenv().Filled = false
  6. getgenv().Radius = 20
  7. getgenv().Thickness = 2
  8.  
  9. local Locking = false
  10. local CurrentCamera = game:GetService("Workspace").CurrentCamera
  11. local Inset = game:GetService("GuiService"):GetGuiInset().Y
  12. local RunService = game:GetService("RunService")
  13.  
  14. local Mouse = game.Players.LocalPlayer:GetMouse()
  15. local LocalPlayer = game.Players.LocalPlayer
  16.  
  17. local Circle = Drawing.new("Circle")
  18.  
  19. Circle.Position = Vector2.new(Mouse.X, Mouse.Y + Inset)
  20. Circle.Visible = false
  21. Circle.Thickness = getgenv().Thickness
  22. Circle.Radius = getgenv().Radius
  23. Circle.Color = getgenv().Color
  24. Circle.Filled = getgenv().Filled
  25.  
  26. game:GetService("UserInputService").InputBegan:Connect(function(keygo,ok)
  27. if (not ok) then
  28. if (keygo.KeyCode == getgenv().Key) then
  29. Locking = not Locking
  30. if Locking then
  31. Plr = getClosestPlayerToCursor()
  32. elseif not Locking then
  33.  
  34.  
  35.  
  36. end
  37. end
  38. end
  39. end)
  40. function getClosestPlayerToCursor()
  41. local closestPlayer
  42. local shortestDistance = math.huge
  43.  
  44. for i, v in pairs(game.Players:GetPlayers()) do
  45. if v ~= game.Players.LocalPlayer and v.Character and v.Character:FindFirstChild("Humanoid") and v.Character.Humanoid.Health ~= 0 and v.Character:FindFirstChild("LowerTorso") then
  46. local pos = game:GetService"Workspace".CurrentCamera:WorldToViewportPoint(v.Character.PrimaryPart.Position)
  47. local magnitude = (Vector2.new(pos.X, pos.Y) - Vector2.new( game.Players.LocalPlayer:GetMouse().X, game.Players.LocalPlayer:GetMouse().Y)).magnitude
  48. if magnitude < shortestDistance then
  49. closestPlayer = v
  50. shortestDistance = magnitude
  51. end
  52. end
  53. end
  54. return closestPlayer
  55. end
  56.  
  57. local rawmetatable = getrawmetatable(game)
  58. local old = rawmetatable.__namecall
  59. setreadonly(rawmetatable, false)
  60. rawmetatable.__namecall = newcclosure(function(...)
  61. local args = {...}
  62. if Locking and getnamecallmethod() == "FireServer" and args[2] == "GetMousePos" then
  63. args[3] = Plr.Character[getgenv().Partz].Position+(Plr.Character[getgenv().Partz].Velocity*Prediction)
  64. return old(unpack(args))
  65. end
  66. return old(...)
  67. end)
  68.  
  69.  
  70. game.RunService.Stepped:Connect(function()
  71. if Plr ~= nil and Locking then
  72. local Vector, OnScreen = workspace.CurrentCamera:worldToViewportPoint(Plr.Character[getgenv().Partz].Position+(Plr.Character[getgenv().Partz].Velocity*Prediction))
  73. if OnScreen then
  74. Circle.Visible = true
  75. Circle.Position = Vector2.new(Vector.X,Vector.Y)
  76. end
  77. elseif not Locking then
  78. Circle.Visible = false
  79. end
  80.  
  81. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement