Advertisement
_Thanh_Thy_Cute_

ROBLOX FREE UNIVERSAL AIMBOT & ESP - PF & MORE SUPPORTED!

Aug 18th, 2021
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 22.48 KB | None | 0 0
  1. local drawing_new = Drawing.new
  2. local vector2_new = Vector2.new
  3. local vector3_new = Vector3.new
  4. local cframe_new = CFrame.new
  5. local cframe_angles = CFrame.Angles
  6. local color3_new = Color3.new
  7. local color3_hsv = Color3.fromHSV
  8. local math_floor = math.floor
  9. local raycast_params_new = RaycastParams.new
  10. local enum_rft_blk = Enum.RaycastFilterType.Blacklist
  11.  
  12. local white = color3_new(255, 255, 255)
  13. local green = color3_new(0, 255, 0)
  14.  
  15. local players = game:GetService("Players")
  16. local run_service = game:GetService("RunService")
  17. local workspace = game:GetService("Workspace")
  18. local uis = game:GetService("UserInputService")
  19. local rep_storage = game:GetService("ReplicatedStorage")
  20.  
  21. local frame_wait = run_service.RenderStepped
  22.  
  23. local local_player = players.LocalPlayer
  24. local mouse = local_player:GetMouse()
  25. local dummy_part = Instance.new("Part", nil)
  26.  
  27. local camera = workspace:FindFirstChildOfClass("Camera")
  28. local screen_size = camera.ViewportSize
  29. local center_screen = vector2_new((screen_size.X / 2), (screen_size.Y / 2))
  30.  
  31. --<- allowed modify ->--
  32.  
  33. local _aimsp_settings; _aimsp_settings = {
  34.  
  35. -- aimbot settings
  36. use_aimbot = true,
  37. use_wallcheck = true,
  38. team_check = true,
  39. loop_all_humanoids = false, -- will allow aimbot to everything that has a humanoid, likely *VERY* laggy
  40. max_dist = 9e9, -- 9e9 = very big
  41. allow_toggle = {
  42. allow = false, -- turning this to false will make the aimbot toggle on right mouse button
  43. key = Enum.KeyCode.Z;
  44. },
  45. prefer = {
  46. looking_at_you = false, -- buggy
  47. closest_to_center_screen = false, -- stable
  48. closest_to_you = true, -- stable
  49. },
  50. toggle_hud_key = Enum.KeyCode.P,
  51. smoothness = 3, -- anything over 5 = aim assist, 1 = lock on (using 1 might get u banned)
  52. fov_size = 150; -- 150-450 = preferred
  53.  
  54. -- esp settings
  55. use_esp = true,
  56. esp_toggle_key = Enum.KeyCode.O,
  57. rainbow_speed = 5,
  58. use_rainbow = true,
  59. tracers = true,
  60. box = true,
  61. name = true,
  62. dist = true,
  63. health = true; -- might not work on some games
  64. }
  65.  
  66. --<- allowed modify ->--
  67.  
  68. if getgenv().aimsp_settings then
  69. getgenv().aimsp_settings = _aimsp_settings;
  70. return
  71. end
  72. getgenv().aimsp_settings = _aimsp_settings
  73.  
  74. local objects; objects = {
  75. fov = nil,
  76. text = nil,
  77. chams = {},
  78. tracers = {},
  79. quads = {},
  80. labels = {},
  81. look_at = {
  82. tracer = nil,
  83. point = nil;
  84. };
  85. }
  86.  
  87. local debounces; debounces = {
  88. start_aim = false,
  89. custom_players = false,
  90. spoofs_hum_health = false;
  91. }
  92.  
  93. local utility; utility = {
  94. get_rainbow = function()
  95. return color3_hsv((tick() % aimsp_settings.rainbow_speed / aimsp_settings.rainbow_speed), 1, 1)
  96. end,
  97.  
  98. get_part_corners = function(part)
  99. local size = part.Size * vector3_new(1, 1.5, 0)
  100.  
  101. return {
  102. top_right = (part.CFrame * cframe_new(-size.X, -size.Y, 0)).Position,
  103. bottom_right = (part.CFrame * cframe_new(-size.X, size.Y, 0)).Position,
  104. top_left = (part.CFrame * cframe_new(size.X, -size.Y, 0)).Position,
  105. bottom_left = (part.CFrame * cframe_new(size.X, size.Y, 0)).Position,
  106. }
  107. end,
  108.  
  109. run_player_check = function()
  110. local plrs = players:GetChildren()
  111.  
  112. for idx, val in pairs(objects.tracers) do
  113. if not plrs[idx] then
  114. utility.remove_esp(idx)
  115. end
  116. end
  117. end,
  118.  
  119. remove_esp = function(name)
  120. utility.update_drawing(objects.tracers, name, {
  121. Visible = false,
  122. instance = "Line";
  123. })
  124.  
  125. utility.update_drawing(objects.quads, name, {
  126. Visible = false,
  127. instance = "Quad";
  128. })
  129.  
  130. utility.update_drawing(objects.labels, name, {
  131. Visible = false,
  132. instance = "Text";
  133. })
  134. end,
  135.  
  136. update = function(str)
  137. if objects.fov.Visible then
  138. objects.text.Text = str
  139. objects.text.Visible = true
  140.  
  141. wait(1)
  142.  
  143. objects.text.Visible = false
  144. end
  145. end,
  146.  
  147. is_inside_fov = function(point)
  148. return (point.x - objects.fov.Position.X) ^ 2 + (point.y - objects.fov.Position.Y) ^ 2 <= objects.fov.Radius ^ 2
  149. end,
  150.  
  151. to_screen = function(point)
  152. local screen_pos, in_screen = camera:WorldToViewportPoint(point)
  153.  
  154. return (in_screen and vector2_new(screen_pos.X, screen_pos.Y)) or -1
  155. end,
  156.  
  157. is_part_visible = function(origin_part, part)
  158. if not aimsp_settings.use_wallcheck then
  159. return true
  160. end
  161.  
  162. local function run_cast(origin_pos)
  163. local raycast_params = raycast_params_new()
  164. raycast_params.FilterType = enum_rft_blk
  165. raycast_params.FilterDescendantsInstances = {origin_part.Parent}
  166. raycast_params.IgnoreWater = true
  167.  
  168. local raycast_result = workspace:Raycast(origin_pos, (part.Position - origin_pos).Unit * aimsp_settings.max_dist, raycast_params)
  169.  
  170. return ((raycast_result and raycast_result.Instance) or dummy_part):IsDescendantOf(part.Parent)
  171. end
  172.  
  173. local head_pos = (origin_part.Position + (origin_part.CFrame.UpVector * 2) + (origin_part.CFrame.LookVector))
  174.  
  175. local cast_table = {
  176. origin_part.CFrame.UpVector * 2,
  177. -origin_part.CFrame.UpVector * 2,
  178. origin_part.CFrame.RightVector * 2,
  179. -origin_part.CFrame.RightVector * 2,
  180. vector3_new(0, 0, 0);
  181. }
  182.  
  183. for idx, val in pairs(cast_table) do
  184. if run_cast(head_pos + val) == true then
  185. return true
  186. end
  187. end
  188.  
  189. return false
  190. end,
  191.  
  192. is_dead = function(char)
  193. if debounces.spoofs_hum_health then
  194. local torso = char:FindFirstChild("UpperTorso") or char:FindFirstChild("Torso")
  195. if torso and #(torso:GetChildren()) < 10 then
  196. return true
  197. end
  198. else
  199. local hum = char:FindFirstChild("Humanoid")
  200. if hum and hum.Health == 0 then
  201. return true
  202. end
  203. end
  204.  
  205. return false
  206. end,
  207.  
  208. update_drawing = function(tbl, child, val)
  209. if not tbl[child] then
  210. tbl[child] = utility.new_drawing(val.instance)(val)
  211. end
  212.  
  213. for idx, val in pairs(val) do
  214. if idx ~= "instance" then
  215. tbl[child][idx] = val
  216. end
  217. end
  218.  
  219. return tbl[child]
  220. end,
  221.  
  222. new_drawing = function(classname)
  223. return function(tbl)
  224. local draw = drawing_new(classname)
  225.  
  226. for idx, val in pairs(tbl) do
  227. if idx ~= "instance" then
  228. draw[idx] = val
  229. end
  230. end
  231.  
  232. return draw
  233. end
  234. end
  235. }
  236.  
  237. objects.text = utility.new_drawing("Text"){
  238. Transparency = 1,
  239. Visible = false,
  240. Center = true,
  241. Size = 24,
  242. Color = white,
  243. Position = vector2_new(screen_size.X - 100, 36);
  244. }
  245.  
  246. objects.fov = utility.new_drawing("Circle"){
  247. Thickness = 1,
  248. Transparency = 1,
  249. Visible = true,
  250. Color = white,
  251. Position = center_screen,
  252. Radius = aimsp_settings.fov_size;
  253. }
  254.  
  255. players.PlayerRemoving:Connect(function(plr)
  256. utility.remove_esp(plr.Name)
  257. end)
  258.  
  259. uis.InputBegan:Connect(function(key, gmp)
  260. if gmp then return end
  261.  
  262. if key.KeyCode == aimsp_settings.allow_toggle.key and aimsp_settings.allow_toggle.allow then
  263. debounces.start_aim = not debounces.start_aim
  264.  
  265. utility.update("toggled aimbot: " .. tostring(debounces.start_aim))
  266. elseif key.KeyCode == aimsp_settings.toggle_hud_key then
  267. objects.fov.Visible = not objects.fov.Visible
  268. elseif key.KeyCode == aimsp_settings.esp_toggle_key then
  269. aimsp_settings.use_esp = not aimsp_settings.use_esp
  270.  
  271. utility.update("toggled esp: " .. tostring(aimsp_settings.use_esp))
  272. end
  273. end)
  274.  
  275. if not aimsp_settings.allow_toggle.allow then
  276. mouse.Button2Down:Connect(function()
  277. debounces.start_aim = true
  278. end)
  279.  
  280. mouse.Button2Up:Connect(function()
  281. debounces.start_aim = false
  282. end)
  283. end
  284.  
  285. function delay()
  286. frame_wait:Wait()
  287. --[[
  288. if you are lagging, replace this comment with the line below
  289. frame_wait:Wait()
  290. ]]
  291. return true
  292. end
  293.  
  294. local get_players; -- create custom function for every game so that it doesnt check placeid every frame
  295.  
  296. if aimsp_settings.loop_all_humanoids then -- self explanitory
  297. get_players = function()
  298. local instance_table = {}
  299.  
  300. for idx, val in pairs(workspace:GetDescendants()) do
  301. if val:IsA("Model") and val:FindFirstChildOfClass("Humanoid") then
  302. instance_table[#instance_table + 1] = val
  303. end
  304. end
  305.  
  306. return instance_table
  307. end
  308. elseif game.PlaceId == 18164449 then -- base wars
  309. debounces.spoofs_hum_health = true
  310. elseif game.PlaceId == 292439477 then -- phantom forces
  311. debounces.custom_players = true
  312.  
  313. get_players = function()
  314. local local_team = local_player.Character.Parent -- your character is not nil
  315.  
  316. local get_team;
  317.  
  318. if local_team then
  319. if aimsp_settings.team_check then
  320. if local_team.Name == "Phantoms" then
  321. get_team = "Ghosts"
  322. else
  323. get_team = "Phantoms"
  324. end
  325.  
  326. return local_team.Parent[get_team]:GetChildren()
  327. else
  328. local instance_table = {}
  329.  
  330. for idx, val in pairs(local_team.Parent.Phantoms:GetChildren()) do
  331. if val:IsA("Model") then
  332. instance_table[#instance_table + 1] = val
  333. end
  334. end
  335.  
  336. for idx, val in pairs(local_team.Parent.Ghosts:GetChildren()) do
  337. if val:IsA("Model") then
  338. instance_table[#instance_table + 1] = val
  339. end
  340. end
  341.  
  342. return instance_table -- return both teams
  343. end
  344. end
  345.  
  346. return {} -- player is likely dead, return empty table so the mouse doesnt go apeshit
  347. end
  348. --[[
  349. elseif game.PlaceId == 3233893879 then -- bad business
  350.  
  351. local TS = require(rep_storage:WaitForChild("TS"))
  352. local net_module
  353.  
  354. for idx, val in pairs(rep_storage:GetChildren()) do
  355. local children = val:GetChildren()
  356. if val.Name == " " and #children ~= 1 then
  357. for _idx, _val in pairs(children) do
  358. local module = require(_val)
  359. if module.Fire then
  360. net_module = module -- found it
  361. end
  362. end
  363. end
  364. end
  365.  
  366. get_players = function()
  367.  
  368. end
  369.  
  370. return {}
  371. ]]
  372. else -- normal players
  373. get_players = function()
  374. return players:GetChildren()
  375. end
  376. end
  377.  
  378. coroutine.wrap(function()
  379. while delay() do
  380. local func, result = pcall(function()
  381. utility.update_drawing(objects, "fov", {
  382. Radius = aimsp_settings.fov_size,
  383. Color = (aimsp_settings.use_rainbow and utility.get_rainbow()) or white,
  384. instance = "Circle";
  385. })
  386.  
  387. utility.run_player_check()
  388.  
  389. local closest_player = nil
  390. local dist = aimsp_settings.max_dist
  391.  
  392. for idx, plr in pairs(get_players()) do -- continue skips current index
  393. local plr_char = ((aimsp_settings.loop_all_humanoids or debounces.custom_players) and plr) or plr.Character
  394. if plr == local_player then continue; end
  395. if plr_char == nil then continue; end
  396.  
  397. if debounces.custom_players then -- teamcheck for games with custom chars
  398. if plr_char.Parent == local_player.Character.Parent then continue; end
  399. end
  400.  
  401. if aimsp_settings.team_check and not aimsp_settings.loop_all_humanoids and not debounces.custom_players then
  402. if plr.Team then
  403. if plr.TeamColor == local_player.TeamColor then continue; end
  404. if plr.Team == local_player.Team then continue; end
  405. end
  406. end
  407.  
  408. if not utility.is_dead(plr_char) then
  409. local plr_screen = utility.to_screen(plr_char.HumanoidRootPart.Position + (plr_char.HumanoidRootPart.CFrame.UpVector * 2)) -- emulate head pos
  410.  
  411. if plr_screen ~= -1 then
  412. local mag = (plr_char.HumanoidRootPart.Position - local_player.Character.HumanoidRootPart.Position).Magnitude
  413.  
  414. if aimsp_settings.use_esp then
  415. local col = (aimsp_settings.use_rainbow and utility.get_rainbow()) or white
  416.  
  417. if aimsp_settings.tracers then
  418. utility.update_drawing(objects.tracers, plr_char:GetDebugId(), {
  419. Visible = objects.fov.Visible,
  420. Thickness = 1,
  421. Color = (aimsp_settings.use_rainbow and utility.get_rainbow()) or color3_new(255 / mag, mag / 255, 0),
  422. To = plr_screen,
  423. From = vector2_new(screen_size.X / 2, screen_size.Y - 36),
  424. instance = "Line";
  425. })
  426. end
  427.  
  428. if aimsp_settings.box then
  429. local corners = utility.get_part_corners(plr_char.HumanoidRootPart)
  430.  
  431. local point_a_scr = utility.to_screen(corners.top_left)
  432. local point_b_scr = utility.to_screen(corners.top_right)
  433. local point_c_scr = utility.to_screen(corners.bottom_right)
  434. local point_d_scr = utility.to_screen(corners.bottom_left)
  435.  
  436. if (point_a_scr ~= -1) and (point_b_scr ~= -1) and (point_c_scr ~= -1) and (point_d_scr ~= -1) then
  437. utility.update_drawing(objects.quads, plr_char:GetDebugId(), {
  438. Visible = objects.fov.Visible,
  439. Thickness = 1,
  440. Color = col,
  441. PointA = point_a_scr,
  442. PointB = point_b_scr,
  443. PointC = point_c_scr,
  444. PointD = point_d_scr,
  445. instance = "Quad";
  446. })
  447. end
  448. end
  449.  
  450. local plr_info = ""
  451.  
  452. if aimsp_settings.name then
  453. plr_info = plr_info .. (plr.Name .. "\n")
  454. end
  455. if aimsp_settings.dist then
  456. plr_info = plr_info .. (tostring(math_floor(mag)) .. " Studs Away\n")
  457. end
  458. if aimsp_settings.health then
  459. local hum = plr_char:FindFirstChildOfClass("Humanoid")
  460.  
  461. plr_info = (hum and plr_info .. ("[" .. tostring(hum.Health) .. "/" .. tostring(hum.MaxHealth) .. "]" )) or plr_info
  462. end
  463.  
  464. if plr_info ~= "" then
  465. local cam_mag = (camera.CFrame.Position - plr_char.HumanoidRootPart.CFrame.Position).Magnitude / 20
  466.  
  467. local scr_pos = utility.to_screen(
  468. plr_char.HumanoidRootPart.Position +
  469. vector3_new(0, 4, 0) +
  470. (plr_char.HumanoidRootPart.CFrame.UpVector * cam_mag)
  471. )
  472.  
  473. if scr_pos ~= -1 then
  474. utility.update_drawing(objects.labels, plr_char:GetDebugId(), {
  475. Visible = objects.fov.Visible,
  476. Color = col,
  477. Position = scr_pos,
  478. Text = plr_info,
  479. Center = true,
  480. instance = "Text";
  481. })
  482. else
  483. utility.update_drawing(objects.labels, plr_char:GetDebugId(), {
  484. Visible = false,
  485. instance = "Text";
  486. })
  487. end
  488. end
  489. else
  490. utility.remove_esp(plr_char:GetDebugId())
  491. end
  492.  
  493. if aimsp_settings.prefer.looking_at_you then
  494. local look_vector = plr_char.HumanoidRootPart.Position + (plr_char.HumanoidRootPart.CFrame.LookVector * mag)
  495.  
  496. local look_vector_lp_head_dist = (look_vector - local_player.Character.HumanoidRootPart.Position).Magnitude
  497. if look_vector_lp_head_dist < dist and utility.is_inside_fov(plr_screen) then
  498. dist = look_vector_lp_head_dist
  499. closest_player = plr_char
  500. end
  501. elseif aimsp_settings.prefer.closest_to_center_screen then
  502. local plr_scr_dist = (center_screen - plr_screen).Magnitude
  503. if plr_scr_dist < dist then
  504. dist = plr_scr_dist
  505. closest_player = plr_char
  506. end
  507. elseif aimsp_settings.prefer.closest_to_you then
  508. local plr_dist = (plr_char.HumanoidRootPart.Position - local_player.Character.HumanoidRootPart.Position).Magnitude
  509. if plr_dist < dist then
  510. dist = plr_dist
  511. closest_player = plr_char
  512. end
  513. end
  514. else
  515. utility.remove_esp(plr_char:GetDebugId())
  516. end
  517. else
  518. utility.remove_esp(plr_char:GetDebugId())
  519. end
  520. end
  521.  
  522. local visible_parts = {}
  523. local last
  524.  
  525. if closest_player and aimsp_settings.use_aimbot then
  526. for idx, part in pairs(closest_player:GetChildren()) do
  527. if part:IsA("BasePart") then
  528. local screen_pos = utility.to_screen(part.Position)
  529.  
  530. if screen_pos ~= -1 then
  531. if utility.is_inside_fov(screen_pos) and utility.is_part_visible(local_player.Character.HumanoidRootPart, part) then
  532. last = {
  533. scr_pos = screen_pos,
  534. obj = part;
  535. };
  536. visible_parts[part.Name] = last
  537. end
  538. end
  539. end
  540. end
  541.  
  542. if visible_parts["Head"] then
  543. visible_parts[0] = visible_parts["Head"]
  544. elseif visible_parts["UpperTorso"] or visible_parts["Torso"] then
  545. visible_parts[0] = visible_parts["UpperTorso"] or visible_parts["Torso"]
  546. end
  547.  
  548. local lock_part = visible_parts[0] or last
  549.  
  550. if lock_part then
  551. local scale = (lock_part.obj.Size.Y / 2)
  552.  
  553. local top = utility.to_screen((lock_part.obj.CFrame * cframe_new(0, scale, 0)).Position);
  554. local bottom = utility.to_screen((lock_part.obj.CFrame * cframe_new(0, -scale, 0)).Position);
  555. local radius = -(top - bottom).y;
  556.  
  557. utility.update_drawing(objects.look_at, "point", {
  558. Transparency = 1,
  559. Thickness = 1,
  560. Radius = radius / 2,
  561. Visible = objects.fov.Visible,
  562. Color = (debounces.start_aim and green) or white,
  563. Position = lock_part.scr_pos,
  564. instance = "Circle";
  565. })
  566.  
  567. if debounces.start_aim then
  568. utility.update_drawing(objects.look_at, "tracer", {
  569. Transparency = 1,
  570. Thickness = 1,
  571. Visible = objects.fov.Visible,
  572. Color = green,
  573. From = center_screen,
  574. To = lock_part.scr_pos,
  575. instance = "Line";
  576. })
  577.  
  578. mousemoverel((lock_part.scr_pos.X - mouse.X) / aimsp_settings.smoothness, (lock_part.scr_pos.Y - (mouse.Y + 36)) / aimsp_settings.smoothness)
  579. else
  580. utility.update_drawing(objects.look_at, "tracer", {
  581. Visible = false,
  582. instance = "Line";
  583. })
  584. end
  585. else
  586. utility.update_drawing(objects.look_at, "point", {
  587. Visible = false,
  588. instance = "Circle";
  589. })
  590.  
  591. utility.update_drawing(objects.look_at, "tracer", {
  592. Visible = false,
  593. instance = "Line";
  594. })
  595. end
  596. end
  597. end)
  598. if not func then --[[warn(result)]] end
  599. end
  600. end)()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement