Advertisement
Pokeyy

Aimbot

Sep 3rd, 2022
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.24 KB | None | 0 0
  1. PLAYER = game.Players.LocalPlayer
  2. MOUSE = PLAYER:GetMouse()
  3. CC = game.Workspace.CurrentCamera
  4.  
  5. ENABLED = true
  6. ESP_ENABLED = true
  7.  
  8. _G.FREE_FOR_ALL = true
  9.  
  10. _G.ESP_BIND = 52
  11. _G.CHANGE_AIM = 'q'
  12.  
  13. _G.AIM_AT = 'Head'
  14.  
  15. wait(1)
  16.  
  17. function GetNearestPlayerToMouse()
  18. local PLAYERS = {}
  19. local PLAYER_HOLD = {}
  20. local DISTANCES = {}
  21. for i, v in pairs(game.Players:GetPlayers()) do
  22. if v ~= PLAYER then
  23. table.insert(PLAYERS, v)
  24. end
  25. end
  26. for i, v in pairs(PLAYERS) do
  27. if _G.FREE_FOR_ALL == false then
  28. if v and (v.Character) ~= nil and v.TeamColor ~= PLAYER.TeamColor then
  29. local AIM = v.Character:FindFirstChild(_G.AIM_AT)
  30. if AIM ~= nil then
  31. local DISTANCE = (AIM.Position - game.Workspace.CurrentCamera.CoordinateFrame.p).magnitude
  32. local RAY = Ray.new(game.Workspace.CurrentCamera.CoordinateFrame.p, (MOUSE.Hit.p - CC.CoordinateFrame.p).unit * DISTANCE)
  33. local HIT,POS = game.Workspace:FindPartOnRay(RAY, game.Workspace)
  34. local DIFF = math.floor((POS - AIM.Position).magnitude)
  35. PLAYER_HOLD[v.Name .. i] = {}
  36. PLAYER_HOLD[v.Name .. i].dist = DISTANCE
  37. PLAYER_HOLD[v.Name .. i].plr = v
  38. PLAYER_HOLD[v.Name .. i].diff = DIFF
  39. table.insert(DISTANCES, DIFF)
  40. end
  41. end
  42. elseif _G.FREE_FOR_ALL == true then
  43. local AIM = v.Character:FindFirstChild(_G.AIM_AT)
  44. if AIM ~= nil then
  45. local DISTANCE = (AIM.Position - game.Workspace.CurrentCamera.CoordinateFrame.p).magnitude
  46. local RAY = Ray.new(game.Workspace.CurrentCamera.CoordinateFrame.p, (MOUSE.Hit.p - CC.CoordinateFrame.p).unit * DISTANCE)
  47. local HIT,POS = game.Workspace:FindPartOnRay(RAY, game.Workspace)
  48. local DIFF = math.floor((POS - AIM.Position).magnitude)
  49. PLAYER_HOLD[v.Name .. i] = {}
  50. PLAYER_HOLD[v.Name .. i].dist = DISTANCE
  51. PLAYER_HOLD[v.Name .. i].plr = v
  52. PLAYER_HOLD[v.Name .. i].diff = DIFF
  53. table.insert(DISTANCES, DIFF)
  54. end
  55. end
  56. end
  57.  
  58. if unpack(DISTANCES) == nil then
  59. return false
  60. end
  61.  
  62. local L_DISTANCE = math.floor(math.min(unpack(DISTANCES)))
  63. if L_DISTANCE > 20 then
  64. return false
  65. end
  66.  
  67. for i, v in pairs(PLAYER_HOLD) do
  68. if v.diff == L_DISTANCE then
  69. return v.plr
  70. end
  71. end
  72. return false
  73. end
  74.  
  75. GUI_MAIN = Instance.new('ScreenGui', game.CoreGui)
  76. GUI_TARGET = Instance.new('TextLabel', GUI_MAIN)
  77. GUI_AIM_AT = Instance.new('TextLabel', GUI_MAIN)
  78.  
  79. GUI_MAIN.Name = 'AIMBOT'
  80.  
  81. GUI_TARGET.Size = UDim2.new(0,200,0,30)
  82. GUI_TARGET.BackgroundTransparency = 0.5
  83. GUI_TARGET.BackgroundColor = BrickColor.new('Fossil')
  84. GUI_TARGET.BorderSizePixel = 0
  85. GUI_TARGET.Position = UDim2.new(0.5,-100,0,0)
  86. GUI_TARGET.Text = 'AIMBOT : OFF'
  87. GUI_TARGET.TextColor3 = Color3.new(1,1,1)
  88. GUI_TARGET.TextStrokeTransparency = 1
  89. GUI_TARGET.TextWrapped = true
  90. GUI_TARGET.FontSize = 'Size24'
  91. GUI_TARGET.Font = 'SourceSansBold'
  92.  
  93. GUI_AIM_AT.Size = UDim2.new(0,200,0,20)
  94. GUI_AIM_AT.BackgroundTransparency = 0.5
  95. GUI_AIM_AT.BackgroundColor = BrickColor.new('Fossil')
  96. GUI_AIM_AT.BorderSizePixel = 0
  97. GUI_AIM_AT.Position = UDim2.new(0.5,-100,0,30)
  98. GUI_AIM_AT.Text = 'AIMING : HEAD'
  99. GUI_AIM_AT.TextColor3 = Color3.new(1,1,1)
  100. GUI_AIM_AT.TextStrokeTransparency = 1
  101. GUI_AIM_AT.TextWrapped = true
  102. GUI_AIM_AT.FontSize = 'Size18'
  103. GUI_AIM_AT.Font = 'SourceSansBold'
  104.  
  105. local TRACK = false
  106.  
  107. function CREATE(BASE, TEAM)
  108. local ESP_MAIN = Instance.new('BillboardGui', PLAYER.PlayerGui)
  109. local ESP_DOT = Instance.new('Frame', ESP_MAIN)
  110. local ESP_NAME = Instance.new('TextLabel', ESP_MAIN)
  111.  
  112. ESP_MAIN.Name = 'ESP'
  113. ESP_MAIN.Adornee = BASE
  114. ESP_MAIN.AlwaysOnTop = true
  115. ESP_MAIN.ExtentsOffset = Vector3.new(0, 1, 0)
  116. ESP_MAIN.Size = UDim2.new(0, 5, 0, 5)
  117.  
  118. ESP_DOT.Name = 'DOT'
  119. ESP_DOT.BackgroundColor = BrickColor.new('Bright red')
  120. ESP_DOT.BackgroundTransparency = 0.3
  121. ESP_DOT.BorderSizePixel = 0
  122. ESP_DOT.Position = UDim2.new(-0.5, 0, -0.5, 0)
  123. ESP_DOT.Size = UDim2.new(2, 0, 2, 0)
  124. ESP_DOT.Visible = true
  125. ESP_DOT.ZIndex = 10
  126.  
  127. ESP_NAME.Name = 'NAME'
  128. ESP_NAME.BackgroundColor3 = Color3.new(255, 255, 255)
  129. ESP_NAME.BackgroundTransparency = 1
  130. ESP_NAME.BorderSizePixel = 0
  131. ESP_NAME.Position = UDim2.new(0, 0, 0, -40)
  132. ESP_NAME.Size = UDim2.new(1, 0, 10, 0)
  133. ESP_NAME.Visible = true
  134. ESP_NAME.ZIndex = 10
  135. ESP_NAME.Font = 'ArialBold'
  136. ESP_NAME.FontSize = 'Size14'
  137. ESP_NAME.Text = BASE.Parent.Name:upper()
  138. ESP_NAME.TextColor = BrickColor.new('Bright red')
  139. end
  140.  
  141. function CLEAR()
  142. for _,v in pairs(PLAYER.PlayerGui:children()) do
  143. if v.Name == 'ESP' and v:IsA('BillboardGui') then
  144. v:Destroy()
  145. end
  146. end
  147. end
  148.  
  149. function FIND()
  150. CLEAR()
  151. TRACK = true
  152. spawn(function()
  153. while wait() do
  154. if TRACK then
  155. CLEAR()
  156. for i,v in pairs(game.Players:GetChildren()) do
  157. if v.Character and v.Character:FindFirstChild('Head') then
  158. if _G.FREE_FOR_ALL == false then
  159. if v.TeamColor ~= PLAYER.TeamColor then
  160. if v.Character:FindFirstChild('Head') then
  161. CREATE(v.Character.Head, true)
  162. end
  163. end
  164. else
  165. if v.Character:FindFirstChild('Head') then
  166. CREATE(v.Character.Head, true)
  167. end
  168. end
  169. end
  170. end
  171. end
  172. end
  173. wait(1)
  174. end)
  175. end
  176.  
  177. MOUSE.Button2Down:connect(function()
  178. ENABLED = true
  179. end)
  180.  
  181. MOUSE.Button2Up:connect(function()
  182. ENABLED = false
  183. end)
  184.  
  185. MOUSE.KeyDown:connect(function(KEY)
  186. KEY = KEY:lower():byte()
  187. if KEY == _G.ESP_BIND then
  188. if ESP_ENABLED == false then
  189. FIND()
  190. ESP_ENABLED = true
  191. print('ESP : ON')
  192. elseif ESP_ENABLED == true then
  193. wait()
  194. CLEAR()
  195. TRACK = false
  196. ESP_ENABLED = false
  197. print('ESP : OFF')
  198. end
  199. end
  200. end)
  201.  
  202. MOUSE.KeyDown:connect(function(KEY)
  203. if KEY == _G.CHANGE_AIM then
  204. if _G.AIM_AT == 'Head' then
  205. _G.AIM_AT = 'Torso'
  206. GUI_AIM_AT.Text = 'AIMING : TORSO'
  207. elseif _G.AIM_AT == 'Torso' then
  208. _G.AIM_AT = 'Head'
  209. GUI_AIM_AT.Text = 'AIMING : HEAD'
  210. end
  211. end
  212. end)
  213.  
  214. game:GetService('RunService').RenderStepped:connect(function()
  215. if ENABLED then
  216. local TARGET = GetNearestPlayerToMouse()
  217. if (TARGET ~= false) then
  218. local AIM = TARGET.Character:FindFirstChild(_G.AIM_AT)
  219. if AIM then
  220. CC.CoordinateFrame = CFrame.new(CC.CoordinateFrame.p, AIM.CFrame.p)
  221. end
  222. GUI_TARGET.Text = 'AIMBOT : '.. TARGET.Name:sub(1, 5)
  223. else
  224. GUI_TARGET.Text = 'AIMBOT : OFF'
  225. end
  226. end
  227. end)
  228.  
  229. repeat
  230. wait()
  231. if ESP_ENABLED == true then
  232. FIND()
  233. end
  234. until ESP_ENABLED == false
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement