Advertisement
gilward

Gilward's Aimbot

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