Advertisement
Guest User

Aimbot + ESP

a guest
Jul 20th, 2019
7,332
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.68 KB | None | 0 0
  1. print("Aimbot = C, ESP = Alt")
  2.  
  3. --[[
  4. AimHot, made by Herrtt#3868
  5. Press H to start the aimbot.
  6. Press right ALT to enable ESP.
  7. type /e -help if you need info about the aimbot/esp.
  8. --]]
  9.  
  10. _G.FRIEND_LIST = {"ROBLOX","builderman"} --Add players you want to ignore
  11.  
  12. _G.IGNORE_TEAM = true
  13. _G.START_AIMBOT = Enum.KeyCode.C
  14. _G.MAX_DIST = 5000
  15. _G.TARGET_PART = "Head"
  16.  
  17. _G.START_ESP = Enum.KeyCode.RightAlt
  18. _G.PREFIX = "/e " --If you want a space between the command and pref, you need to type a space! Ex: /ehelp . /e help
  19.  
  20.  
  21.  
  22. local startTime = tick()
  23. local AIMBOT = false
  24. local EspEnabled = false
  25.  
  26. local Players = game:GetService("Players")
  27. local StarterGui = game:GetService("StarterGui")
  28. local CoreGui = game:GetService("CoreGui")
  29. local UIS = game:GetService("UserInputService")
  30. local RunService = game:GetService("RunService")
  31.  
  32. local plr = Players.LocalPlayer
  33. local camera = workspace.CurrentCamera
  34. local mouse = plr:GetMouse()
  35. local newray = Ray.new
  36.  
  37. local function RandomCharacters(length)
  38. local STR = ''
  39.  
  40. for i = 1, length do
  41. STR = STR .. string.char(math.random(65,90))
  42. end
  43.  
  44. return STR
  45. end
  46. local faces = {
  47. "Back",
  48. "Bottom",
  49. "Front",
  50. "Left",
  51. "Right",
  52. "Top"
  53. }
  54. local EspObjects = Instance.new("Folder")
  55. EspObjects.Parent = CoreGui
  56. EspObjects.Name = RandomCharacters(8)
  57.  
  58. local function SendMessage(txt,title,dur,size,color)
  59. print(txt)
  60. StarterGui:SetCore("ChatMakeSystemMessage",{
  61. Text = txt,
  62. Color = color,
  63. FontSize = size
  64. })
  65. StarterGui:SetCore("SendNotification",{
  66. Title = title,
  67. Text = txt,
  68. Duration = dur
  69. })
  70. end
  71. local function ChangeColor(player, color)
  72. if EspObjects:FindFirstChild(player) then
  73. for i,v in pairs(EspObjects:FindFirstChild(player):GetChildren()) do
  74. if v:IsA("SurfaceGui") then
  75. for _,x in pairs(v:GetChildren()) do
  76. if x:IsA("Frame") then
  77. x.BackgroundColor3 = color
  78. end
  79. end
  80. elseif v:IsA("BillboardGui") then
  81. for _,x in pairs(v:GetChildren()) do
  82. if x:IsA("TextLabel") then
  83. x.TextColor = color
  84. end
  85. end
  86. end
  87. end
  88. end
  89. end
  90. local function GetClosestPlayer(returnPlr,ignoreList)
  91. ignoreList = _G.FRIEND_LIST
  92. returnPlr = returnPlr or false
  93.  
  94. local ignoreTeam = _G.IGNORE_TEAM
  95. local maxdist = _G.MAX_DIST
  96. local targetpart = _G.TARGET_PART
  97.  
  98. if ignoreTeam == true then
  99. if #game:GetService("Teams"):GetChildren() <= 1 then
  100. ignoreTeam = false
  101. end
  102. if plr.Neutral == true then
  103. ignoreTeam = false
  104. end
  105. end
  106.  
  107. local temp1 = (maxdist)
  108. local FoundPlr
  109. local FoundPart
  110.  
  111. local Table = game.Players:GetPlayers()
  112. for _,v in pairs(Table) do
  113. local skip = false
  114. for _,i in pairs(ignoreList) do
  115. if i:lower() == v.Name:lower() then
  116. skip = true
  117. end
  118. end
  119. if ignoreTeam == true then
  120. if v.Team == plr.Team then
  121. skip = true
  122. end
  123. end
  124. if v.Character == nil or v.Character:FindFirstChild(targetpart) == nil then
  125. skip = true
  126. end
  127.  
  128. if skip == false then
  129. if (temp1 ~= nil and v.Character:FindFirstChild(targetpart) and plr.Character ~= nil and plr.Character:FindFirstChild(targetpart)) then
  130. if temp1 > (plr.Character.Head.Position - v.Character:FindFirstChild(targetpart).Position).magnitude then
  131. local vChar = v.Character
  132. if vChar:FindFirstChild("Humanoid") then
  133. local vHuman = vChar:FindFirstChild("Humanoid")
  134. if vHuman.Health > 0 then
  135. local dist = (plr.Character.Head.Position - vChar:FindFirstChild(targetpart).Position).magnitude
  136. if dist <= maxdist then
  137. local ray = newray(plr.Character.Head.CFrame.p, (vChar:FindFirstChild(targetpart).CFrame.p - plr.Character.Head.CFrame.p).unit * _G.MAX_DIST)
  138. local hitPart,position = workspace:FindPartOnRay(ray,plr.Character)
  139.  
  140. if hitPart then
  141. if hitPart:IsDescendantOf(vChar) then
  142. temp1 = dist
  143. FoundPlr = v
  144. FoundPart = vChar:FindFirstChild(targetpart)
  145. end
  146. end
  147. end
  148. end
  149. end
  150. end
  151. end
  152. end
  153. end
  154. if returnPlr == false then
  155. return FoundPart
  156. elseif returnPlr == true then
  157. return FoundPlr
  158. end
  159. end
  160. local function CreateEspBox(pObj, color)
  161. if (pObj:IsA("Part") and pObj.Parent:IsA("Model") and pObj.Parent ~= workspace) then
  162. for i,v in pairs(EspObjects:GetChildren()) do
  163. if v.Name == pObj.Parent.Name then
  164. return nil
  165. end
  166. end
  167. local newFlder = Instance.new("Folder")
  168. newFlder.Parent = EspObjects
  169. newFlder.Name = pObj.Parent.Name
  170.  
  171. for i,v in pairs(faces) do
  172. local surfGui = Instance.new("SurfaceGui")
  173. surfGui.AlwaysOnTop = true
  174. surfGui.Adornee = pObj
  175. surfGui.Face = v
  176.  
  177. local frme = Instance.new("Frame")
  178. frme.Size = UDim2.new(1,0,1,0)
  179. frme.BackgroundColor3 = color
  180. frme.BackgroundTransparency = .5
  181. frme.BorderSizePixel = 0
  182. frme.Parent = surfGui
  183.  
  184. surfGui.Parent = newFlder
  185. end
  186. local bbGui = Instance.new("BillboardGui")
  187. bbGui.Adornee = pObj
  188. bbGui.Size = UDim2.new(5.5,0,1.75,0)
  189. bbGui.ExtentsOffset = Vector3.new(0,2.5,0)
  190. bbGui.AlwaysOnTop = true
  191. local txtLab = Instance.new("TextLabel")
  192. txtLab.Text = pObj.Parent.Name
  193. txtLab.TextColor3 = color
  194. txtLab.TextScaled = false
  195. txtLab.TextSize = 17
  196. txtLab.Size = UDim2.new(1,0,1,0)
  197. txtLab.BackgroundTransparency = 1
  198. txtLab.BorderSizePixel = 0
  199. txtLab.Parent = bbGui
  200. bbGui.Parent = newFlder
  201.  
  202. local objPar = Instance.new("ObjectValue")
  203. objPar.Value = pObj
  204. objPar.Parent = newFlder
  205. objPar.Name = "pObj"
  206.  
  207. return newFlder
  208. end
  209. return nil
  210. end
  211. local function ClearEsp()
  212. EspObjects:ClearAllChildren()
  213. end
  214. local function ConnectEsp(player)
  215. local func1
  216. local func2
  217. if player.Character ~= nil and player.Character:FindFirstChild("Head") then
  218. if plr.Team == nil or player.Team == nil or plr.Neutral == true or player.Neutral == true then
  219. local fldr = CreateEspBox(player.Character:FindFirstChild("Head"), Color3.fromRGB(255,0,0))
  220. if fldr ~= nil then
  221. local func3
  222. func3 = fldr.pObj.Changed:Connect(function()
  223. if fldr.pObj.Value == nil then
  224. if EspObjects:FindFirstChild(player.Name) then
  225. EspObjects:FindFirstChild(player.Name):Destroy()
  226. end
  227. func3:Disconnect()
  228. end
  229. end)
  230. end
  231. elseif plr.Team == player.Team then
  232. CreateEspBox(player.Character:FindFirstChild("Head"), Color3.fromRGB(0,255,0))
  233. elseif plr.Team ~= player.Team then
  234. CreateEspBox(player.Character:FindFirstChild("Head"), Color3.fromRGB(255,0,0))
  235. end
  236. end
  237. func1 = player.CharacterAdded:Connect(function(char)
  238. wait(1)
  239. if player.Character ~= nil then
  240. func2 = player.Character:WaitForChild("Humanoid").Died:Connect(function()
  241. if EspObjects:FindFirstChild(player.Name) then
  242. EspObjects:FindFirstChild(player.Name):Destroy()
  243. end
  244. end)
  245. end
  246. if EspEnabled == true then
  247. if plr.Team == nil or player.Team == nil or plr.Neutral == true or player.Neutral == true then
  248. CreateEspBox(char:FindFirstChild("Head"), Color3.fromRGB(255,0,0))
  249. elseif plr.Team == player.Team then
  250. CreateEspBox(char:FindFirstChild("Head"), Color3.fromRGB(0,255,0))
  251. elseif plr.Team ~= player.Team then
  252. CreateEspBox(char:FindFirstChild("Head"), Color3.fromRGB(255,0,0))
  253. end
  254. else
  255. if EspObjects:FindFirstChild(player.Name) then
  256. EspObjects:FindFirstChild(player.Name):Destroy()
  257. end
  258. func2:Disconnect()
  259. func1:Disconnect()
  260. end
  261. end)
  262. if player.Character ~= nil then
  263. func2 = player.Character:WaitForChild("Humanoid").Died:Connect(function()
  264. if EspObjects:FindFirstChild(player.Name) then
  265. EspObjects:FindFirstChild(player.Name):Destroy()
  266. end
  267. end)
  268. end
  269. return
  270. end
  271. local function EnableEsp()
  272. if EspEnabled == true then
  273. for i,v in pairs(Players:GetPlayers()) do
  274. if v ~= plr then
  275. ConnectEsp(v)
  276. end
  277. end
  278. end
  279. end
  280. Players.PlayerAdded:Connect(function(player)
  281. if EspEnabled == true then
  282. ConnectEsp(player)
  283. end
  284. end)
  285. Players.PlayerRemoving:Connect(function(player)
  286. if EspObjects:FindFirstChild(player.Name) then
  287. EspObjects:FindFirstChild(player.Name):Destroy()
  288. end
  289. end)
  290. UIS.InputBegan:Connect(function(KEY, gpe)
  291. if gpe then return end;
  292. if KEY.KeyCode == _G.START_AIMBOT then
  293. if AIMBOT == false then
  294. AIMBOT = true
  295. SendMessage("Aimbot enabled.",
  296. "AimHot has been enabled.",
  297. 3,
  298. Enum.FontSize.Size28,
  299. Color3.fromRGB(200,50,50)
  300. )
  301. elseif AIMBOT == true then
  302. AIMBOT = false
  303. SendMessage("Aimbot disabled.",
  304. "AimHot has been disabled.",
  305. 3,
  306. Enum.FontSize.Size28,
  307. Color3.fromRGB(200,50,50)
  308. )
  309. end
  310. end
  311. if KEY.KeyCode == _G.START_ESP then
  312. if EspEnabled == false then
  313. SendMessage("ESP has been enabled.",
  314. "ESP enabled;",
  315. 3,
  316. Enum.FontSize.Size28,
  317. Color3.fromRGB(200,50,50)
  318. )
  319. EspEnabled = true
  320. EnableEsp()
  321. while EspEnabled == true do
  322. ClearEsp()
  323. EnableEsp()
  324. wait(1)
  325. end
  326. elseif EspEnabled == true then
  327. SendMessage("ESP has been disabled.",
  328. "ESP disabled;",
  329. 3,
  330. Enum.FontSize.Size28,
  331. Color3.fromRGB(200,50,50)
  332. )
  333. EspEnabled = false
  334. ClearEsp()
  335. end
  336. end
  337. end)
  338.  
  339. RunService.RenderStepped:Connect(function()
  340. if (AIMBOT == true and plr.Character ~= nil and plr.Character:FindFirstChild("Humanoid") and plr.Character.Humanoid.Health > 0) then
  341. local closestPart = GetClosestPlayer(false,{})
  342. if closestPart ~= nil then
  343. camera.CoordinateFrame = CFrame.new(camera.CoordinateFrame.p, closestPart.CFrame.p)
  344. if _G.AUTO_TRIGGER == true then
  345. mouse1click()
  346. end
  347. end
  348. end
  349. end)
  350. _G.AIMHOT_SECRETKEY = "dF10qLMn" --Not kind of secret but..
  351.  
  352. local helptxt = (
  353. "AimHot loaded. Time taken: ".. tick()-startTime .."\n"..
  354. "AimHot made by Herrtt#3868." .."\n"..
  355. " Command prefix are: "..(_G.PREFIX) .."\n"..
  356. " Commands are;" .."\n"..
  357. " <prefix>maxdist <number> (counted in studs)" .."\n"..
  358. " <prefix>ignoreteam <bool> (true/false)" .."\n"..
  359. " <prefix>targetpart <string> (Head, Torso etc.)" .."\n"..
  360. " <prefix>addfriend <plrname> (ROBLOX, etc.)" .."\n"..
  361. " <prefix>removefriend <plrname> (ROBLOX, etc.)" .."\n"..
  362. " <prefix>changepref <newprefix>" .."\n"..
  363. " <prefix>friends" .."\n"..
  364. " <prefix>help" .."\n"..
  365. " /e reset (will set all settings to regular.)" .."\n"..
  366. " Have fun!"
  367. )
  368.  
  369. plr.Chatted:Connect(function(msg)
  370. local pref = _G.PREFIX
  371. if type(pref) ~= "string" then
  372. print("Prefix must be a string!")
  373. end
  374.  
  375. if string.sub(msg,1,8+pref:len()) == pref.."maxdist " then
  376. local maxdist = tonumber(string.sub(msg,9,msg:len()))
  377. if type(maxdist) == "number" then
  378. _G.MAX_DIST = maxdist
  379. SendMessage("Changed maxdist to; "..(tostring(maxdist)),
  380. "Setting Changed;",
  381. 3,
  382. Enum.FontSize.Size28,
  383. Color3.fromRGB(200,50,50)
  384. )
  385. end
  386. end
  387. if string.sub(msg,1,11+pref:len()) == pref.."ignoreteam " then
  388. local setting = string.sub(msg,12,msg:len()):lower()
  389. print(setting)
  390. if setting == "true" or "false" then
  391. _G.IGNORE_TEAM = setting
  392.  
  393. SendMessage("Changed ignoreteam to; "..(tostring(setting)),
  394. "Setting Changed;",
  395. 3,
  396. Enum.FontSize.Size28,
  397. Color3.fromRGB(200,50,50)
  398. )
  399. end
  400. end
  401. if string.sub(msg,1,11+pref:len()) == pref.."targetpart " then
  402. local setting = string.sub(msg,12,msg:len())
  403. if type(setting) == "string" then
  404. _G.TARGET_PART = setting
  405.  
  406. SendMessage("Changed targetpart to; "..(tostring(setting)),
  407. "Setting Changed;",
  408. 3,
  409. Enum.FontSize.Size28,
  410. Color3.fromRGB(200,50,50)
  411. )
  412. end
  413. end
  414. if string.sub(msg,1,13+pref:len()) == pref.."removefriend " then
  415. local setting = string.sub(msg,14,msg:len())
  416. if type(setting) == "string" then
  417. for i,v in pairs(_G.FRIEND_LIST) do
  418. if v:lower() == setting:lower() then
  419. table.remove(_G.FRIEND_LIST,i)
  420. end
  421. end
  422. SendMessage("Removed player from friend list; "..(tostring(setting)),
  423. "Friend removed;",
  424. 3,
  425. Enum.FontSize.Size28,
  426. Color3.fromRGB(200,50,50)
  427. )
  428. end
  429. end
  430. if string.sub(msg,1,10+pref:len()) == pref.."addfriend " then
  431. local setting = string.sub(msg,11,msg:len())
  432. if type(setting) == "string" then
  433. for i,v in pairs(_G.FRIEND_LIST) do
  434. if v == setting:lower() then
  435. return
  436. end
  437. end
  438. table.insert(_G.FRIEND_LIST,setting:lower())
  439. SendMessage("Added player to friend list; "..(tostring(setting)),
  440. "Friend added;",
  441. 3,
  442. Enum.FontSize.Size28,
  443. Color3.fromRGB(200,50,50)
  444. )
  445. end
  446. end
  447. if string.sub(msg,1,7+pref:len()) == pref.."friends" then
  448. local friends = ""
  449. for i,v in pairs(_G.FRIEND_LIST) do
  450. if i == 1 then
  451. friends = v
  452. else
  453. friends = friends..", "..v
  454. end
  455. end
  456. SendMessage("Your friends are; " .."\n".. friends,
  457. "Your friends;",
  458. 3,
  459. Enum.FontSize.Size28,
  460. Color3.fromRGB(200,50,50)
  461. )
  462. end
  463. if string.sub(msg,1,11+pref:len()) == pref.."changepref " then
  464. local setting = string.sub(msg,12+pref:len(),msg:len())
  465. if type(setting) == "string" then
  466. _G.PREFIX = setting
  467. SendMessage("Changed prefix to; "..setting,
  468. "Setting changed;",
  469. 3,
  470. Enum.FontSize.Size28,
  471. Color3.fromRGB(200,50,50)
  472. )
  473. end
  474. end
  475. if string.sub(msg,1,4+pref:len()) == pref.."help" then
  476. SendMessage(helptxt,
  477. "AimHot by Herrtt#3868;",
  478. 3,
  479. Enum.FontSize.Size28,
  480. Color3.fromRGB(200,50,50)
  481. )
  482. end
  483. if msg == "/e reset" then
  484. _G.FRIEND_LIST = {"ROBLOX","builderman"}
  485.  
  486. _G.IGNORE_TEAM = true
  487. _G.START_AIMBOT = Enum.KeyCode.C
  488. _G.MAX_DIST = 5000
  489. _G.TARGET_PART = "Head"
  490. _G.PREFIX = "/e "
  491.  
  492. SendMessage("All settings are set back to regular.",
  493. "Settings reseted.",
  494. Enum.FontSize.Size28,
  495. Color3.fromRGB(200,50,50)
  496. )
  497. end
  498. end)
  499.  
  500. SendMessage(helptxt,
  501. "AimHot by Herrtt#3868;",
  502. 3,
  503. Enum.FontSize.Size28,
  504. Color3.fromRGB(200,50,50)
  505. )
  506. _G.AIMHOT_VERSION = "4.0"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement