Advertisement
FuZionPlayz

Aimbot

Jun 29th, 2018
2,262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.92 KB | None | 0 0
  1. PLAYER = game.Players.LocalPlayer
  2. MOUSE = PLAYER:GetMouse()
  3. CC = game.Workspace.CurrentCamera
  4.  
  5. ENABLED = false
  6.  
  7. _G.FREE_FOR_ALL = true
  8.  
  9. _G.BIND = 50
  10. _G.CHANGE_AIM = 'q'
  11.  
  12. _G.AIM_AT = 'Head'
  13.  
  14. wait(1)
  15.  
  16. function GetNearestPlayerToMouse()
  17. local PLAYERS = {}
  18. local PLAYER_HOLD = {}
  19. local DISTANCES = {}
  20. for i, v in pairs(game.Players:GetPlayers()) do
  21. if v ~= PLAYER then
  22. table.insert(PLAYERS, v)
  23. end
  24. end
  25. for i, v in pairs(PLAYERS) do
  26. if _G.FREE_FOR_ALL == false then
  27. if v and (v.Character) ~= nil and v.TeamColor ~= PLAYER.TeamColor then
  28. local AIM = v.Character:FindFirstChild(_G.AIM_AT)
  29. if AIM ~= nil then
  30. local DISTANCE = (AIM.Position - game.Workspace.CurrentCamera.CoordinateFrame.p).magnitude
  31. local RAY = Ray.new(game.Workspace.CurrentCamera.CoordinateFrame.p, (MOUSE.Hit.p - CC.CoordinateFrame.p).unit * DISTANCE)
  32. local HIT,POS = game.Workspace:FindPartOnRay(RAY, game.Workspace)
  33. local DIFF = math.floor((POS - AIM.Position).magnitude)
  34. PLAYER_HOLD[v.Name .. i] = {}
  35. PLAYER_HOLD[v.Name .. i].dist = DISTANCE
  36. PLAYER_HOLD[v.Name .. i].plr = v
  37. PLAYER_HOLD[v.Name .. i].diff = DIFF
  38. table.insert(DISTANCES, DIFF)
  39. end
  40. end
  41. elseif _G.FREE_FOR_ALL == true then
  42. local AIM = v.Character:FindFirstChild(_G.AIM_AT)
  43. if AIM ~= nil then
  44. local DISTANCE = (AIM.Position - game.Workspace.CurrentCamera.CoordinateFrame.p).magnitude
  45. local RAY = Ray.new(game.Workspace.CurrentCamera.CoordinateFrame.p, (MOUSE.Hit.p - CC.CoordinateFrame.p).unit * DISTANCE)
  46. local HIT,POS = game.Workspace:FindPartOnRay(RAY, game.Workspace)
  47. local DIFF = math.floor((POS - AIM.Position).magnitude)
  48. PLAYER_HOLD[v.Name .. i] = {}
  49. PLAYER_HOLD[v.Name .. i].dist = DISTANCE
  50. PLAYER_HOLD[v.Name .. i].plr = v
  51. PLAYER_HOLD[v.Name .. i].diff = DIFF
  52. table.insert(DISTANCES, DIFF)
  53. end
  54. end
  55. end
  56.  
  57. if unpack(DISTANCES) == nil then
  58. return false
  59. end
  60.  
  61. local L_DISTANCE = math.floor(math.min(unpack(DISTANCES)))
  62. if L_DISTANCE > 20 then
  63. return false
  64. end
  65.  
  66. for i, v in pairs(PLAYER_HOLD) do
  67. if v.diff == L_DISTANCE then
  68. return v.plr
  69. end
  70. end
  71. return false
  72. end
  73.  
  74. local TRACK = false
  75.  
  76. function FIND()
  77. CLEAR()
  78. TRACK = true
  79. spawn(function()
  80. while wait() do
  81. if TRACK then
  82. CLEAR()
  83. for i,v in pairs(game.Players:GetChildren()) do
  84. if v.Character and v.Character:FindFirstChild('Head') then
  85. if _G.FREE_FOR_ALL == false then
  86. if v.TeamColor ~= PLAYER.TeamColor then
  87. if v.Character:FindFirstChild('Head') then
  88. CREATE(v.Character.Head, true)
  89. end
  90. end
  91. else
  92. if v.Character:FindFirstChild('Head') then
  93. CREATE(v.Character.Head, true)
  94. end
  95. end
  96. end
  97. end
  98. end
  99. end
  100. wait(1)
  101. end)
  102. end
  103.  
  104. MOUSE.KeyDown:connect(function(KEY)
  105. KEY = KEY:lower():byte()
  106. if KEY == _G.BIND then
  107. ENABLED = true
  108. end
  109. end)
  110.  
  111. MOUSE.KeyUp:connect(function(KEY)
  112. KEY = KEY:lower():byte()
  113. if KEY == _G.BIND then
  114. ENABLED = false
  115. end
  116. end)
  117.  
  118. MOUSE.KeyDown:connect(function(KEY)
  119. if KEY == _G.CHANGE_AIM then
  120. if _G.AIM_AT == 'Head' then
  121. _G.AIM_AT = 'Torso'
  122. GUI_AIM_AT.Text = 'AIMING : TORSO'
  123. elseif _G.AIM_AT == 'Torso' then
  124. _G.AIM_AT = 'Head'
  125. GUI_AIM_AT.Text = 'AIMING : HEAD'
  126. end
  127. end
  128. end)
  129.  
  130. game:GetService('RunService').RenderStepped:connect(function()
  131. if ENABLED then
  132. local TARGET = GetNearestPlayerToMouse()
  133. if (TARGET ~= false) then
  134. local AIM = TARGET.Character:FindFirstChild(_G.AIM_AT)
  135. if AIM then
  136. CC.CoordinateFrame = CFrame.new(CC.CoordinateFrame.p, AIM.CFrame.p)
  137. end
  138. GUI_TARGET.Text = 'AIMBOT : '.. TARGET.Name:sub(1, 5)
  139. else
  140. GUI_TARGET.Text = 'AIMBOT : OFF'
  141. end
  142. end
  143. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement