Dr3s1k

Roblox aimlock to combat warriors and da hood neither

Feb 13th, 2023
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.64 KB | Gaming | 0 0
  1. local Area = game:GetService("Workspace")
  2. local RunService = game:GetService("RunService")
  3. local UIS = game:GetService("UserInputService")
  4. local Players = game:GetService("Players")
  5. local LocalPlayer = Players.LocalPlayer
  6. local MyCharacter = LocalPlayer.Character
  7. local MyRoot = MyCharacter:FindFirstChild("HumanoidRootPart")
  8. local MyHumanoid = MyCharacter:FindFirstChild("Humanoid")
  9. local Mouse = LocalPlayer:GetMouse()
  10. local MyView = Area.CurrentCamera
  11. local MyTeamColor = LocalPlayer.TeamColor
  12. local HoldingM2 = false
  13. local Active = false
  14. local Lock = false
  15. local Epitaph = .190 -- Prediction
  16. local HeadOffset = Vector3.new(0, .1, 0)
  17.  
  18. _G.TeamCheck = false
  19. _G.AimPart = "Head"
  20. _G.Sensitivity = 0
  21. _G.CircleSides = 30
  22. _G.CircleColor = Color3.fromRGB(255, 0, 130)
  23. _G.CircleTransparency = 0.35
  24. _G.CircleRadius = 65
  25. _G.CircleFilled = false
  26. _G.CircleVisible = false
  27. _G.CircleThickness = 1
  28.  
  29. local FOVCircle = Drawing.new("Circle")
  30. FOVCircle.Position = Vector2.new(MyView.ViewportSize.X / 2, MyView.ViewportSize.Y / 2)
  31. FOVCircle.Radius = _G.CircleRadius
  32. FOVCircle.Filled = _G.CircleFilled
  33. FOVCircle.Color = _G.CircleColor
  34. FOVCircle.Visible = _G.CircleVisible
  35. FOVCircle.Transparency = _G.CircleTransparency
  36. FOVCircle.NumSides = _G.CircleSides
  37. FOVCircle.Thickness = _G.CircleThickness
  38.  
  39. local function CursorLock()
  40. UIS.MouseBehavior = Enum.MouseBehavior.LockCenter
  41. end
  42. local function UnLockCursor()
  43. HoldingM2 = false Active = false Lock = false
  44. UIS.MouseBehavior = Enum.MouseBehavior.Default
  45. end
  46. function FindNearestPlayer()
  47. local dist = math.huge
  48. local Target = nil
  49. for _, v in pairs(Players:GetPlayers()) do
  50. if v ~= LocalPlayer and v.Character:FindFirstChild("Humanoid") and v.Character:FindFirstChild("Humanoid").Health > 0 and v.Character:FindFirstChild("HumanoidRootPart") and v then
  51. local TheirCharacter = v.Character
  52. local CharacterRoot, Visible = MyView:WorldToViewportPoint(TheirCharacter[_G.AimPart].Position)
  53. if Visible then
  54. local RealMag = (Vector2.new(Mouse.X, Mouse.Y) - Vector2.new(CharacterRoot.X, CharacterRoot.Y)).Magnitude
  55. if RealMag < dist and RealMag < FOVCircle.Radius then
  56. dist = RealMag
  57. Target = TheirCharacter
  58. end
  59. end
  60. end
  61. end
  62. return Target
  63. end
  64.  
  65. UIS.InputBegan:Connect(function(Input)
  66. if Input.UserInputType == Enum.UserInputType.MouseButton2 then
  67. HoldingM2 = true
  68. Active = true
  69. Lock = true
  70. if Active then
  71. local The_Enemy = FindNearestPlayer()
  72. while HoldingM2 do task.wait(.000001)
  73. if Lock and The_Enemy ~= nil then
  74. local Future = The_Enemy.HumanoidRootPart.CFrame + (The_Enemy.HumanoidRootPart.Velocity * Epitaph + HeadOffset)
  75. MyView.CFrame = CFrame.lookAt(MyView.CFrame.Position, Future.Position)
  76. CursorLock()
  77. end
  78. end
  79. end
  80. end
  81. end)
  82. UIS.InputEnded:Connect(function(Input)
  83. if Input.UserInputType == Enum.UserInputType.MouseButton2 then
  84. UnLockCursor()
  85. end
  86. end)
  87.  
  88. game.StarterGui:SetCore("SendNotification", {Title = "ZWare", Text = "Success, aimlock loaded.", Duration = 4,})
Add Comment
Please, Sign In to add comment