MrExploiterIsTheGod

Ez Aimbot

Jul 11th, 2020
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.29 KB | None | 0 0
  1. --[[
  2. EzAimbot apart of EzLibrary
  3. Developed by ToddDev
  4. Skid to your hearts content. That's what it's meant for!
  5. ]]--
  6.  
  7. --// Container
  8.  
  9. local EzAimbot = {}
  10.  
  11. --// Internal
  12.  
  13. local MainLoop = nil
  14. local Camera = workspace.CurrentCamera
  15. local Viewport = Camera.ViewportSize
  16. local Players = game:GetService("Players")
  17. local LocalPlayer = Players.LocalPlayer
  18. local Character = LocalPlayer.Character
  19. local Head = Character.Head
  20. local Mouse = LocalPlayer:GetMouse()
  21. local FOV = nil
  22. local RunService = game:GetService("RunService")
  23. local InputService = game:GetService("UserInputService")
  24. local MousePosition = function()
  25. return Vector2.new(Mouse.X,Mouse.Y)
  26. end
  27. local ClosestPlayer = function(friendlyfire) -- Most of this stuff was ripped right out of my upcoming hub
  28. local MousePos = MousePosition()
  29. local Radius = FOV.Radius
  30. local Closest = math.huge
  31. local Target = nil
  32. local function HandleTeam(player)
  33. local Team = LocalPlayer.Team
  34. local Result = true
  35. if player.Team == Team and friendlyfire then
  36. Result = true
  37. elseif player.Team == Team and friendlyfire == false then
  38. Result = false
  39. else
  40. Result = true
  41. end
  42. return Result
  43. end
  44. for k,v in pairs(Players:GetPlayers()) do
  45. pcall(function()
  46. if HandleTeam(v) then
  47. if v.Character:FindFirstChild("Head") and v ~= LocalPlayer then
  48. local Point,OnScreen = Camera:WorldToScreenPoint(v.Character.Head.Position)
  49. if OnScreen and #Camera:GetPartsObscuringTarget({Head.Position,v.Character.Head.Position},{Character,v.Character}) == 0 then
  50. local Distance = (Vector2.new(Point.X,Point.Y) - MousePosition()).magnitude
  51. if Distance < math.min(Radius,Closest) then
  52. Closest = Distance
  53. Target = v
  54. end
  55. end
  56. end
  57. end
  58. end)
  59. end
  60. return Target
  61. end
  62. local RefreshInternals = function()
  63. Camera = workspace.CurrentCamera
  64. LocalPlayer = Players.LocalPlayer
  65. Character = LocalPlayer.Character
  66. Head = Character.Head
  67. end
  68.  
  69. --// Main functions
  70.  
  71. EzAimbot.Disable = function()
  72. if MainLoop then
  73. MainLoop:Disconnect()
  74. MainLoop = nil
  75. end
  76. if FOV then
  77. FOV:Remove()
  78. end
  79. RefreshInternals()
  80. end
  81.  
  82. EzAimbot.Enable = function(showfov,fovconfig,key,friendlyfire)
  83. assert(typeof(showfov)=="boolean","EzAimbot.Enable | Expected Boolean as argument #1")
  84. assert(typeof(fovconfig)=="table","EzAimbot.Enable | Expected Table as argument #2")
  85. assert(fovconfig["Size"],"EzAimbot.Enable | Expected Size in argument #2")
  86. assert(fovconfig["Sides"],"EzAimbot.Enable | Expected Sides in argument #2")
  87. assert(fovconfig["Color"],"EzAimbot.Enable | Expected Color in argument #2")
  88. assert(type(fovconfig["Size"])=="number","EzAimbot.Enable | Expected Size in argument #2")
  89. assert(type(fovconfig["Sides"])=="number","EzAimbot.Enable | Expected Sides in argument #2")
  90. assert(typeof(fovconfig["Color"])=="Color3","EzAimbot.Enable | Expected Color in argument #2")
  91. assert(type(key)=="string","EzAimbot.Enable | Expected String as argument #3")
  92. assert(type(friendlyfire)=="boolean","EzAimbot.Enable | Expected Boolean as argument #4")
  93. local Size = fovconfig["Size"]
  94. local Sides = fovconfig["Sides"]
  95. local Color = fovconfig["Color"]
  96. if showfov then
  97. FOV = Drawing.new("Circle")
  98. local FOV = FOV
  99. FOV.NumSides = Sides
  100. FOV.Position = MousePosition()
  101. FOV.Radius = Size
  102. FOV.Thickness = 2
  103. FOV.Radius = Size
  104. FOV.Color = Color
  105. FOV.Visible = true
  106. end
  107. MainLoop = RunService.RenderStepped:Connect(function()
  108. if FOV then
  109. FOV.Position = MousePosition()
  110. end
  111. if InputService:IsKeyDown(Enum.KeyCode[key]) then
  112. local ClosestPlayer = ClosestPlayer(friendlyfire)
  113. if ClosestPlayer then
  114. Camera.CFrame = CFrame.new(Camera.CFrame.p,ClosestPlayer.Character.Head.CFrame.p)
  115. end
  116. RefreshInternals()
  117. end
  118. end)
  119. end
  120.  
  121. return EzAimbot
Add Comment
Please, Sign In to add comment