Advertisement
Guest User

wdawee

a guest
Jun 19th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.92 KB | None | 0 0
  1. print("Aim-key is V.")
  2.  
  3. ENABLED = false
  4. PLAYER = game.Players.LocalPlayer
  5. MOUSE = PLAYER:GetMouse()
  6. CC = game.Workspace.CurrentCamera
  7. _G.FREE_FOR_ALL = true
  8. _G.BIND = 118
  9. _G.AIM_AT = 'Head'
  10. local player = game.Players.LocalPlayer
  11. local esp = false
  12. local track = false
  13.  
  14.  
  15. function GetNearestPlayerToMouse()
  16. local PLAYERS = {}
  17. local PLAYER_HOLD = {}
  18. local DISTANCES = {}
  19. for i, v in pairs(game.Players:GetPlayers()) do
  20. if v ~= PLAYER then
  21. table.insert(PLAYERS, v)
  22. end
  23. end
  24. for i, v in pairs(PLAYERS) do
  25. if _G.FREE_FOR_ALL == false then
  26. if v and (v.Character) ~= nil and v.TeamColor ~= PLAYER.TeamColor then
  27. local AIM = v.Character:FindFirstChild(_G.AIM_AT)
  28. if AIM ~= nil then
  29. local DISTANCE = (AIM.Position - game.Workspace.CurrentCamera.CoordinateFrame.p).magnitude
  30. local RAY = Ray.new(game.Workspace.CurrentCamera.CoordinateFrame.p, (MOUSE.Hit.p - CC.CoordinateFrame.p).unit * DISTANCE)
  31. local HIT,POS = game.Workspace:FindPartOnRay(RAY, game.Workspace)
  32. local DIFF = math.floor((POS - AIM.Position).magnitude)
  33. PLAYER_HOLD[v.Name .. i] = {}
  34. PLAYER_HOLD[v.Name .. i].dist = DISTANCE
  35. PLAYER_HOLD[v.Name .. i].plr = v
  36. PLAYER_HOLD[v.Name .. i].diff = DIFF
  37. table.insert(DISTANCES, DIFF)
  38. end
  39. end
  40. elseif _G.FREE_FOR_ALL == true then
  41. local AIM = v.Character:FindFirstChild(_G.AIM_AT)
  42. if AIM ~= nil then
  43. local DISTANCE = (AIM.Position - game.Workspace.CurrentCamera.CoordinateFrame.p).magnitude
  44. local RAY = Ray.new(game.Workspace.CurrentCamera.CoordinateFrame.p, (MOUSE.Hit.p - CC.CoordinateFrame.p).unit * DISTANCE)
  45. local HIT,POS = game.Workspace:FindPartOnRay(RAY, game.Workspace)
  46. local DIFF = math.floor((POS - AIM.Position).magnitude)
  47. PLAYER_HOLD[v.Name .. i] = {}
  48. PLAYER_HOLD[v.Name .. i].dist = DISTANCE
  49. PLAYER_HOLD[v.Name .. i].plr = v
  50. PLAYER_HOLD[v.Name .. i].diff = DIFF
  51. table.insert(DISTANCES, DIFF)
  52. end
  53. end
  54. end
  55.  
  56. if unpack(DISTANCES) == nil then
  57. return false
  58. end
  59.  
  60. local L_DISTANCE = math.floor(math.min(unpack(DISTANCES)))
  61. if L_DISTANCE > 20 then
  62. return false
  63. end
  64.  
  65. for i, v in pairs(PLAYER_HOLD) do
  66. if v.diff == L_DISTANCE then
  67. return v.plr
  68. end
  69. end
  70. return false
  71. end
  72.  
  73. local TRACK = false
  74.  
  75.  
  76. MOUSE.KeyDown:connect(function(KEY)
  77. KEY = KEY:lower():byte()
  78. if KEY == _G.BIND then
  79. ENABLED = true
  80. end
  81. end)
  82. MOUSE.KeyUp:connect(function(KEY)
  83. KEY = KEY:lower():byte()
  84. if KEY == _G.BIND then
  85. ENABLED = false
  86. end
  87. end)
  88.  
  89. game:GetService('RunService').RenderStepped:connect(function()
  90. if ENABLED then
  91. local TARGET = GetNearestPlayerToMouse()
  92. if TARGET.Name == "Whitelist kid here" or TARGET.Name == "second whitelist kid here" then
  93. else
  94.  
  95. if (TARGET ~= false) then
  96. local AIM = TARGET.Character:FindFirstChild(_G.AIM_AT)
  97. if AIM then
  98. CC.CoordinateFrame = CFrame.new(CC.CoordinateFrame.p, AIM.CFrame.p)
  99. end
  100. end
  101. end
  102. end
  103. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement