Advertisement
Noobzy11

Aimbot

Feb 17th, 2019
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.21 KB | None | 0 0
  1. local cam = game.workspace.CurrentCamera
  2. local Targets = {}
  3. local Distances = {}
  4. local lpr = game.Players.LocalPlayer
  5. local mouse = lpr:GetMouse()
  6. local Target = ""
  7. local target = nil
  8.  
  9. game:GetService("RunService").RenderStepped:connect(function()
  10.     if game.Players.LocalPlayer.Character then
  11.         for c,d in pairs(Targets) do
  12.             table.remove(Targets,c)
  13.         end
  14.  
  15.         for k,j in pairs(Distances) do
  16.             table.remove(Distances,k)
  17.         end
  18.  
  19.         for i,v in next, game.Players:GetChildren() do
  20.             if v.Name ~= game.Players.LocalPlayer.Name then
  21.                 local Distance = (game.Players.LocalPlayer.Character.HumanoidRootPart.Position-v.Character.HumanoidRootPart.Position).magnitude
  22.                 table.insert(Targets,{v.Name,Distance})
  23.                 table.insert(Distances,Distance)
  24.             end
  25.         end
  26.  
  27.         for _,t in next, Targets do
  28.             if t[2] == math.min(unpack(Distances)) then
  29.                 Target = t[1]
  30.             end
  31.         end
  32.         if game.Players:FindFirstChild(Target) then
  33.             target = game.Players:FindFirstChild(Target)
  34.         end
  35.     end
  36.     if mousedown == true then
  37.         cam.CoordinateFrame = CFrame.new(cam.Focus.p,target.Character.Head.Position)
  38.     end
  39. end)
  40.  
  41. mouse.Button2Down:connect(function()
  42. if mousedown == true then
  43.     mousedown = false
  44. else
  45.     mousedown = true
  46. end
  47. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement