yoitzErrorYT

universal aimbot Lua

Jun 16th, 2023
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 36.09 KB | None | 0 0
  1. local Space = game:GetService("Workspace")
  2. local Players = game:GetService("Players")
  3. local Player = game:GetService("Players").LocalPlayer
  4. local Mouse = Player:GetMouse()
  5. local Camera = Space.CurrentCamera
  6.  
  7. local RS = game:GetService("RunService")
  8. local UIS = game:GetService("UserInputService")
  9.  
  10. --LUA CACHED FUNCTIONS
  11. local clamp = math.clamp
  12. local round = math.round
  13. local abs = math.abs
  14. local huge = math.huge
  15. local random = math.random
  16. local floor = math.floor
  17. local rad = math.rad
  18.  
  19. local match = string.match
  20. local sub = string.sub
  21.  
  22. local V3 = Vector3.new
  23. local V3 = Vector2.new
  24. local u2 = UDim2.new
  25. local CF = CFrame.new
  26. local RGB = Color3.fromRGB
  27. local tween = TweenInfo.new
  28.  
  29. local DRAWING = Drawing.new
  30.  
  31. local ESP_API = {}
  32. ESP_API.NewText = function(info)
  33.     local t = DRAWING("Text")
  34.     t.Visible = info.Visible or false
  35.     t.Transparency = info.Transparency or 1
  36.     t.Color = info.Color or RGB(0,0,0)
  37.  
  38.     t.Text = info.Text or ""
  39.     t.Size = info.Size or 14
  40.     t.Center = info.Center or false
  41.     t.Outline = info.Outline or false
  42.     t.OutlineColor = info.OutlineColor or RGB(0,0,0)
  43.     t.Font = info.Font or 3
  44.  
  45.     return t
  46. end
  47.  
  48. ESP_API.NewLine = function(info)
  49.     local l = DRAWING("Line")
  50.     l.Visible = info.Visible or false
  51.     l.Transparency = info.Transparency or 1
  52.     l.Color = info.Color or RGB(0,0,0)
  53.  
  54.     l.Thickness = info.Thickness or 1
  55.     return l
  56. end
  57.  
  58. ESP_API.NewSquare = function(info)
  59.     local q = DRAWING("Square")
  60.     q.Visible = info.Visible or false
  61.     q.Transparency = info.Transparency or 1
  62.     q.Color = info.Color or RGB(0,0,0)  
  63.  
  64.     q.Thickness = info.Thickness or 1
  65.     q.Filled = info.Filled or false
  66.     return q
  67. end
  68.  
  69. ESP_API.NewCircle = function(info)
  70.     local c = DRAWING("Circle")
  71.     c.Visible = info.Visible or false
  72.     c.Transparency = info.Transparency or 1
  73.     c.Color = info.Color or RGB(0,0,0)  
  74.  
  75.     c.Thickness = info.Thickness or 1
  76.     c.NumSides = info.NumSides or 50
  77.     c.Radius = info.Radius or 100
  78.     c.Filled = info.Filled or false
  79.     return c
  80. end
  81.  
  82. local Library = loadstring(game:HttpGet("https://raw.githubusercontent.com/Blissful4992/NAVY-RCX-UI/main/src.lua"))()
  83.  
  84. local DESTROY = false
  85.  
  86. local RCX = {
  87.     ESP = {
  88.         Toggle = true;
  89.  
  90.         Info = false;
  91.         Max_Info_Distance = 100;
  92.         Hover_Info = false;
  93.  
  94.         Names = false;
  95.         Health = false;
  96.         Distance = false;
  97.  
  98.         Boxes = false;
  99.         Boxes_Mode = "Corners";
  100.         Boxes_Distance = 100;
  101.         Health_Bar = false;
  102.         Health_Bar_Distance = 100;
  103.  
  104.         Color = {R = 255, G = 255, B = 0};
  105.  
  106.         Show_Target = false;
  107.         Target_Color = {R = 255, G = 255, B = 255};
  108.  
  109.         Team_Check = false;
  110.         Team_Color = {R = 255, G = 255, B = 0};
  111.         Enemy_Color = {R = 255, G = 0, B = 0};
  112.  
  113.         View_Tracer = false;
  114.         View_Tracer_Length = 10;
  115.         View_Tracer_Distance = 100;
  116.     };
  117.  
  118.     AIMBOT = {
  119.         Toggle = false;
  120.         Bone = "Head";
  121.         Smoothness = 0.5;
  122.  
  123.         Distance_Type = "Mouse";
  124.         Aim_Key = "Q";
  125.         Aim_Mode = "Key";
  126.  
  127.         Team_Check = false;
  128.  
  129.         FOV = false;
  130.         FOV_Radius = 50;
  131.         FOV_Color = {R = 255, G = 255, B = 0};
  132.     };
  133.  
  134.     UI = {
  135.         UI_Toggle_Key = "End";
  136.         Save_Settings_Key = "Home";
  137.         Window_Size = {X = 750, Y = 550}
  138.     };
  139. }
  140.  
  141. local HttpService = game:GetService("HttpService")
  142. local RCXFile = "coolprohax.dat"
  143.  
  144. local function LoadRCX()
  145.     local u, Result = pcall(readfile, RCXFile)
  146.     if u then
  147.         local x, Table = pcall(HttpService.JSONDecode, HttpService, Result)
  148.         if x then
  149.             for i, v in pairs(Table) do
  150.                 if RCX[i] ~= nil then
  151.                     RCX[i] = v
  152.                     pcall(RCX[i], v)
  153.                 end
  154.             end
  155.         end
  156.     end
  157. end
  158.  
  159. LoadRCX()
  160.  
  161. local RCX_Window = Library.NewWindow("Cool Pro Hax", {window_size = V3(RCX.UI.Window_Size.X, RCX.UI.Window_Size.Y), window_size_func = function(new_ui_size)
  162.     RCX.UI.Window_Size = {X = new_ui_size.X, Y = new_ui_size.Y}
  163. end, scalable = true, exit_func = function()
  164.     DESTROY = true
  165. end})
  166.  
  167. -- ESP
  168. local ESP_Page = RCX_Window.NewPage("Visuals")
  169.  
  170. -- MAIN
  171. local MAIN_ESP_Category = ESP_Page.NewCategory("Main")
  172.  
  173. MAIN_ESP_Category.NewToggle("Master Switch", function(bool)
  174.     RCX.ESP.Toggle = bool
  175. end, {default = RCX.ESP.Toggle})
  176.  
  177. do
  178.     local temp = RCX.ESP.Color
  179.     MAIN_ESP_Category.NewColorpicker("Color", function(col)
  180.         RCX.ESP.Color = {R = col.R*255, G = col.G*255, B = col.B*255}
  181.     end, {default = RGB(temp.R, temp.G, temp.B)})
  182. end
  183.  
  184. MAIN_ESP_Category.NewToggle("Team Check", function(bool)
  185.     RCX.ESP.Team_Check = bool
  186. end, {default = RCX.ESP.Team_Check})
  187.  
  188. do
  189.     local temp = RCX.ESP.Team_Color
  190.     MAIN_ESP_Category.NewColorpicker("Team", function(col)
  191.         RCX.ESP.Team_Color = {R = col.R*255, G = col.G*255, B = col.B*255}
  192.     end, {default = RGB(temp.R, temp.G, temp.B)})
  193. end
  194.  
  195. do
  196.     local temp = RCX.ESP.Enemy_Color
  197.     MAIN_ESP_Category.NewColorpicker("Enemies", function(col)
  198.         RCX.ESP.Enemy_Color = {R = col.R*255, G = col.G*255, B = col.B*255}
  199.     end, {default = RGB(temp.R, temp.G, temp.B)})
  200. end
  201.  
  202. MAIN_ESP_Category.NewToggle("Show Target", function(bool)
  203.     RCX.ESP.Show_Target = bool
  204. end, {default = RCX.ESP.Show_Target})
  205.  
  206. do
  207.     local temp = RCX.ESP.Target_Color
  208.     MAIN_ESP_Category.NewColorpicker("Target", function(col)
  209.         RCX.ESP.Target_Color = {R = col.R*255, G = col.G*255, B = col.B*255}
  210.     end, {default = RGB(temp.R, temp.G, temp.B)})
  211. end
  212.  
  213. -- NAMES
  214. local PLR_INFO_Category = ESP_Page.NewCategory("Player Info")
  215.  
  216. PLR_INFO_Category.NewToggle("Toggle", function(bool)
  217.     RCX.ESP.Info = bool
  218. end, {default = RCX.ESP.Info})
  219.  
  220. PLR_INFO_Category.NewSlider("Max Info Distance", function(newvalue)
  221.     RCX.ESP.Max_Info_Distance = newvalue
  222. end, {default = RCX.ESP.Max_Info_Distance, min = 50, max = 5000, decimals = 0, suffix = " studs"})
  223.  
  224. PLR_INFO_Category.NewToggle("Hover Only", function(bool)
  225.     RCX.ESP.Hover_Info = bool
  226. end, {default = RCX.ESP.Hover_Info})
  227.  
  228. PLR_INFO_Category.NewToggle("Names", function(bool)
  229.     RCX.ESP.Names = bool
  230. end, {default = RCX.ESP.Names})
  231.  
  232. PLR_INFO_Category.NewToggle("Health", function(bool)
  233.     RCX.ESP.Health = bool
  234. end, {default = RCX.ESP.Health})
  235.  
  236. PLR_INFO_Category.NewToggle("Distance", function(bool)
  237.     RCX.ESP.Distance = bool
  238. end, {default = RCX.ESP.Distance})
  239.  
  240. -- BOXES
  241. local BOXES_Category = ESP_Page.NewCategory("Boxes")
  242.  
  243. BOXES_Category.NewToggle("Toggle", function(bool)
  244.     RCX.ESP.Boxes = bool
  245. end, {default = RCX.ESP.Boxes})
  246.  
  247. do
  248.     local default_option
  249.     local list = {
  250.         "Corners";
  251.         "Outline";
  252.     }
  253.     for i = 1, #list do
  254.         local v = list[i]
  255.         if v == RCX.ESP.Boxes_Mode then
  256.             default_option = i
  257.         end
  258.     end
  259.     BOXES_Category.NewDropdown("Box Type", function(option)
  260.         RCX.ESP.Boxes_Mode = option
  261.     end, {options = list, default = default_option})
  262. end
  263.  
  264. BOXES_Category.NewSlider("Max Box Distance", function(newvalue)
  265.     RCX.ESP.Boxes_Distance = newvalue
  266. end, {default = RCX.ESP.Boxes_Distance, min = 50, max = 5000, decimals = 0, suffix = " studs"})
  267.  
  268. BOXES_Category.NewToggle("Health Bar", function(bool)
  269.     RCX.ESP.Health_Bar = bool
  270. end, {default = RCX.ESP.Health_Bar})
  271.  
  272. BOXES_Category.NewSlider("Max Bar Distance", function(newvalue)
  273.     RCX.ESP.Health_Bar_Distance = newvalue
  274. end, {default = RCX.ESP.Health_Bar_Distance, min = 50, max = 5000, decimals = 0, suffix = " studs"})
  275.  
  276. -- VIEW TRACER
  277. local VIEW_TRACER_Category = ESP_Page.NewCategory("View Tracers")
  278.  
  279. VIEW_TRACER_Category.NewToggle("Toggle", function(bool)
  280.     RCX.ESP.View_Tracer = bool
  281. end, {default = RCX.ESP.View_Tracer})
  282.  
  283. VIEW_TRACER_Category.NewSlider("Length", function(newvalue)
  284.     RCX.ESP.View_Tracer_Length = newvalue
  285. end, {default = RCX.ESP.View_Tracer_Length, min = 1, max = 50, decimals = 0, suffix = " studs"})
  286.  
  287. VIEW_TRACER_Category.NewSlider("Max Tracer Distance", function(newvalue)
  288.     RCX.ESP.View_Tracer_Distance = newvalue
  289. end, {default = RCX.ESP.View_Tracer_Distance, min = 50, max = 5000, decimals = 0, suffix = " studs"})
  290.  
  291. -- AIMBOT
  292. local AIMBOT_Page = RCX_Window.NewPage("Aimbot")
  293.  
  294. local MAIN_AIMBOT_Category = AIMBOT_Page.NewCategory("Main")
  295.  
  296. MAIN_AIMBOT_Category.NewToggle("Toggle", function(bool)
  297.     RCX.AIMBOT.Toggle = bool
  298. end, {default = RCX.AIMBOT.Toggle})
  299.  
  300. do
  301.     local default_option
  302.     local list = {
  303.         "Key";
  304.         "Mouse";
  305.     }
  306.     for i = 1, #list do
  307.         local v = list[i]
  308.         if v == RCX.AIMBOT.Aim_Mode then
  309.             default_option = i
  310.         end
  311.     end
  312.     MAIN_AIMBOT_Category.NewDropdown("Aim Mode", function(option)
  313.         RCX.AIMBOT.Aim_Mode = option
  314.     end, {options = list, default = default_option})
  315. end
  316.  
  317. MAIN_AIMBOT_Category.NewKeybind("Aim Key", function()end, function(new)
  318.     RCX.AIMBOT.Aim_Key = sub(tostring(new), 14, #tostring(new))
  319. end, {default = Enum.KeyCode[RCX.AIMBOT.Aim_Key]})
  320.  
  321. MAIN_AIMBOT_Category.NewSlider("Smoothness", function(newvalue)
  322.     RCX.AIMBOT.Smoothness = newvalue
  323. end, {default = RCX.AIMBOT.Smoothness, min = 0.01, max = 1, decimals = 2, suffix = " factor"})
  324.  
  325. do
  326.     local default_option
  327.     local list =  {
  328.         "Head";
  329.         "Neck";
  330.         "Torso";
  331.         "Feet";
  332.         "Random";
  333.     }
  334.     for i = 1, #list do
  335.         local v = list[i]
  336.         if v == RCX.AIMBOT.Bone then
  337.             default_option = i
  338.         end
  339.     end
  340.     MAIN_AIMBOT_Category.NewDropdown("Bone", function(option)
  341.         RCX.AIMBOT.Bone = option
  342.     end, {options = list, default = default_option})
  343. end
  344.  
  345. do
  346.     local default_option
  347.     local list =  {
  348.         "Mouse";
  349.         "Character";
  350.     }
  351.     for i = 1, #list do
  352.         local v = list[i]
  353.         if v == RCX.AIMBOT.Distance_Type then
  354.             default_option = i
  355.         end
  356.     end
  357.     MAIN_AIMBOT_Category.NewDropdown("Aim Mode", function(option)
  358.         RCX.AIMBOT.Distance_Type = option
  359.     end, {options = list, default = default_option})
  360. end
  361.  
  362. MAIN_AIMBOT_Category.NewToggle("Team Check", function(bool)
  363.     RCX.AIMBOT.Team_Check = bool
  364. end, {default = RCX.AIMBOT.Team_Check})
  365.  
  366. local FOV_Category = AIMBOT_Page.NewCategory("FOV")
  367.  
  368. FOV_Category.NewToggle("Toggle", function(bool)
  369.     RCX.AIMBOT.FOV = bool
  370. end, {default = RCX.AIMBOT.FOV})
  371.  
  372. FOV_Category.NewSlider("Radius", function(newvalue)
  373.     RCX.AIMBOT.FOV_Radius = newvalue
  374. end, {default = RCX.AIMBOT.FOV_Radius, min = 0, max = 500, decimals = 0, suffix = " px"})
  375.  
  376. do
  377.     local temp = RCX.AIMBOT.FOV_Color
  378.     FOV_Category.NewColorpicker("Color", function(col)
  379.         RCX.AIMBOT.FOV_Color = {R = col.R*255, G = col.G*255, B = col.B*255}
  380.     end, {default = RGB(temp.R, temp.G, temp.B)})
  381. end
  382.  
  383. -- SETTINGS
  384. local SETTINGS_Page = RCX_Window.NewPage("Settings")
  385.  
  386. local MAIN_SETTINGS_Category = SETTINGS_Page.NewCategory("Main")
  387.  
  388. MAIN_SETTINGS_Category.NewKeybind("Hide Key", function()
  389.     RCX_Window.Hide()
  390. end, function(new)
  391.     RCX.UI.UI_Toggle_Key = sub(tostring(new), 14, #tostring(new))
  392. end, {default = Enum.KeyCode[RCX.UI.UI_Toggle_Key]})
  393.  
  394. MAIN_SETTINGS_Category.NewButton("Save Settings", function()
  395.     writefile(RCXFile, game:GetService("HttpService"):JSONEncode(RCX))
  396. end)
  397.  
  398. MAIN_SETTINGS_Category.NewKeybind("Save Settings Keybind", function()
  399.     writefile(RCXFile, game:GetService("HttpService"):JSONEncode(RCX))
  400. end, function(new)
  401.     RCX.UI.Save_Settings_Key = sub(tostring(new), 14, #tostring(new))
  402. end, {default = Enum.KeyCode[RCX.UI.Save_Settings_Key]})
  403.  
  404. -- SCRIPT
  405. local LerpColorModule = loadstring(game:HttpGet("https://pastebin.com/raw/wRnsJeid"))()
  406. local HealthBarLerp = LerpColorModule:Lerp(RGB(255, 0, 0), RGB(0, 255, 0))
  407.  
  408. local Selected_Player = nil
  409. local inset = game:GetService("GuiService"):GetGuiInset()
  410.  
  411. -- DETECT STUCTURE
  412. local Character_Folder = Space
  413. local Player_Characters = {}
  414.  
  415. do
  416.     local t = Space:GetDescendants()
  417.     for i = 1, #t do
  418.         local v = t[i]
  419.         if v:IsA("Model") and Players:FindFirstChild(v.Name) and (v:FindFirstChild("HumanoidRootPart") or v.PrimaryPart ~= nil) then
  420.             Character_Folder = v.Parent
  421.         end
  422.     end
  423. end
  424.  
  425. warn("Found Character Folder: "..Character_Folder.Name)
  426.  
  427. local function ResetStructure()
  428.     Player_Characters = {}
  429.  
  430.     local temp = {}
  431.     do
  432.         local t = Players:GetChildren()
  433.         for i = 1, #t do
  434.             local v = t[i]
  435.             temp[v.Name] = v.Name
  436.         end
  437.     end
  438.  
  439.     local t = Character_Folder:GetChildren()
  440.     for i = 1, #t do
  441.         local v = t[i]
  442.         if temp[v.Name] ~= nil then
  443.             Player_Characters[v.Name] = v
  444.         end
  445.     end
  446. end
  447.  
  448. coroutine.wrap(function()
  449.     coroutine.wrap(ResetStructure)()
  450.     while wait(5) do
  451.         if DESTROY then
  452.             coroutine.yield()
  453.         else
  454.             coroutine.wrap(ResetStructure)()
  455.         end
  456.     end
  457. end)()
  458.  
  459. -- ESP PLAYERS
  460. ESP_API.AddPlayer = function(plr_name)
  461.     repeat wait() until Player_Characters[plr_name] ~= nil and Player_Characters[plr_name]:FindFirstChildOfClass("Humanoid")
  462.  
  463.     local INFO = ESP_API.NewText({})
  464.     INFO.Center = true
  465.  
  466.     local Bar = ESP_API.NewLine({Color = RGB(10, 10, 10), Thickness = 3, Transparency = 0.4})
  467.  
  468.     local Health_Bar = ESP_API.NewLine({Color = RGB(0, 255, 0), Thickness = 1})
  469.  
  470.     local Box_Lines = {}
  471.     for i = 1, 8 do
  472.         Box_Lines[i] = ESP_API.NewLine({})
  473.     end
  474.  
  475.     local viewTracer = ESP_API.NewLine({Color = RGB(0, 255, 0), Thickness = 1})
  476.  
  477.     local function Box_Vis(state, mode)
  478.         if state == false then
  479.             for i = 1, 8 do
  480.                 Box_Lines[i].Visible = false
  481.             end
  482.         elseif state and mode == 1 then
  483.             for i = 1, 4 do
  484.                 Box_Lines[i].Visible = true
  485.             end
  486.             for i = 5, 8 do
  487.                 Box_Lines[i].Visible = false
  488.             end
  489.         elseif state and mode == 2 then
  490.             for i = 1, 8 do
  491.                 Box_Lines[i].Visible = true
  492.             end
  493.         end
  494.     end
  495.  
  496.     local function Destroy_ESP()
  497.         INFO:Remove()
  498.         Bar:Remove()
  499.         Health_Bar:Remove()
  500.         viewTracer:Remove()
  501.         for i = 1, #Box_Lines do
  502.             Box_Lines[i]:Remove()
  503.         end
  504.     end
  505.  
  506.     local function Lines_Color(col)
  507.         viewTracer.Color = col
  508.         for i = 1, #Box_Lines do
  509.             Box_Lines[i].Color = col
  510.         end
  511.     end
  512.  
  513.     local function Update_ESP()
  514.         local prevhealth = nil
  515.         local Character = nil
  516.  
  517.         local hide_name = Enum.HumanoidDisplayDistanceType.None
  518.         local show_name = Enum.HumanoidDisplayDistanceType.Viewer
  519.  
  520.         local connection; connection = RS.RenderStepped:Connect(function()
  521.             if DESTROY then
  522.                 Destroy_ESP()
  523.                 connection:Disconnect()
  524.             else
  525.                 Character = Player_Characters[plr_name]
  526.  
  527.                 if RCX.ESP.Toggle and Player.Character and Character and Character:FindFirstChildOfClass("Humanoid") and Character:FindFirstChildOfClass("Humanoid").Health > 0 then
  528.                     local localrootpart = Player.Character:FindFirstChild("HumanoidRootPart") or Player.Character.PrimaryPart
  529.                     local root_part = Character:FindFirstChild("HumanoidRootPart") or Character.PrimaryPart
  530.                     local hum = Character:FindFirstChildOfClass("Humanoid")
  531.                     if localrootpart and root_part then
  532.                         local dist = (root_part.Position - localrootpart.Position).magnitude
  533.  
  534.                         Camera = Space.CurrentCamera
  535.                         local root_pos, onscreen = Camera:WorldToViewportPoint(root_part.Position)
  536.  
  537.                         if RCX.ESP.View_Tracer and dist < RCX.ESP.View_Tracer_Distance and Character:FindFirstChild("Head") then
  538.                             local Head = Character.Head
  539.  
  540.                             local headpos, vis = Camera:WorldToViewportPoint(Head.Position)
  541.                             if vis then
  542.                                 local dirpos = Camera:WorldToViewportPoint((Head.CFrame*CF(0,0,-RCX.ESP.View_Tracer_Length)).p)
  543.  
  544.                                 viewTracer.From = V3(headpos.X, headpos.Y)
  545.                                 viewTracer.To = V3(dirpos.X, dirpos.Y)
  546.  
  547.                                 viewTracer.Visible = true
  548.                             else
  549.                                 viewTracer.Visible = false
  550.                             end
  551.                         else
  552.                             viewTracer.Visible = false
  553.                         end
  554.  
  555.                         if onscreen then
  556.                             -- TEAM CHECK
  557.                             local Current_Color
  558.                             if RCX.ESP.Team_Check and Players:FindFirstChild(plr_name):IsA("Player") and Player:IsA("Player") then
  559.                                 if Players:FindFirstChild(plr_name).TeamColor == Player.TeamColor then
  560.                                     Current_Color = RCX.ESP.Team_Color
  561.                                 else
  562.                                     Current_Color = RCX.ESP.Enemy_Color
  563.                                 end
  564.                             else
  565.                                 Current_Color = RCX.ESP.Color
  566.                             end
  567.  
  568.                             INFO.Color = RGB(Current_Color.R, Current_Color.G, Current_Color.B)
  569.  
  570.                             if RCX.AIMBOT.Toggle and RCX.ESP.Show_Target and Selected_Player ~= nil and plr_name == Selected_Player.Name then
  571.                                 Current_Color = RCX.ESP.Target_Color
  572.                             end
  573.  
  574.                             Current_Color = RGB(Current_Color.R, Current_Color.G, Current_Color.B)
  575.  
  576.                             Lines_Color(Current_Color)
  577.  
  578.                             local ratio = 2500/root_pos.Z
  579.  
  580.                             local newsize_x = ratio/2
  581.                             local newsize_y = ratio * 1.75 / 2
  582.                            
  583.                             local root_x = root_pos.X
  584.                             local root_y = root_pos.Y
  585.  
  586.                             -- BOXES
  587.                             if RCX.ESP.Boxes and dist < RCX.ESP.Boxes_Distance then
  588.                                 local box_mode = RCX.ESP.Boxes_Mode
  589.  
  590.                                 local TL = V3(root_x-newsize_x, root_y-newsize_y)
  591.                                 local TR = V3(root_x+newsize_x, root_y-newsize_y)
  592.                                 local BL = V3(root_x-newsize_x, root_y+newsize_y)
  593.                                 local BR = V3(root_x+newsize_x, root_y+newsize_y)
  594.  
  595.                                 if RCX.ESP.Health_Bar and dist < RCX.ESP.Health_Bar_Distance then
  596.                                     local Hum_Health = hum.Health
  597.                                     local Hum_MaxHealth = hum.MaxHealth
  598.  
  599.                                     local offsetX = clamp(round(200/root_pos.Z), 4, 8)
  600.  
  601.                                     local Right = root_x + newsize_x
  602.                                     local Top = root_y - newsize_y
  603.                                     local Bottom = root_y + newsize_y
  604.  
  605.                                     local barPos = Right + offsetX
  606.  
  607.                                     Bar.From = V3(barPos, Top)
  608.                                     Bar.To = V3(barPos, Bottom)
  609.  
  610.                                     local HealthRatio = Hum_Health / Hum_MaxHealth
  611.                                     local Length = abs((Bottom - 1) - (Top + 1))
  612.                                        
  613.                                     local HealthLength = Length * HealthRatio
  614.                                     Health_Bar.From = V3(barPos, Bottom - 1 - HealthLength)
  615.                                     Health_Bar.To = V3(barPos, Bottom - 1)
  616.  
  617.                                     if Hum_Health ~= prevhealth then
  618.                                         Health_Bar.Color = HealthBarLerp(HealthRatio)
  619.                                         prevhealth = Hum_Health
  620.                                     end
  621.  
  622.                                     Health_Bar.Visible = true
  623.                                     Bar.Visible = true
  624.                                 else
  625.                                     Health_Bar.Visible = false
  626.                                     Bar.Visible = false
  627.                                 end
  628.  
  629.                                 if box_mode == "Corners" then
  630.                                     local Dir1 = V3(ratio/4, 0)
  631.                                     local Dir2 = V3(0, ratio/4)
  632.  
  633.                                     -- 1
  634.                                     Box_Lines[1].From = TL
  635.                                     Box_Lines[1].To = TL + Dir1
  636.  
  637.                                     Box_Lines[2].From = TL
  638.                                     Box_Lines[2].To = TL + Dir2
  639.  
  640.                                     -- 2
  641.                                     Box_Lines[3].From = TR
  642.                                     Box_Lines[3].To = TR - Dir1
  643.  
  644.                                     Box_Lines[4].From = TR
  645.                                     Box_Lines[4].To = TR + Dir2
  646.  
  647.                                     -- 3
  648.                                     Box_Lines[5].From = BL
  649.                                     Box_Lines[5].To = BL + Dir1
  650.  
  651.                                     Box_Lines[6].From = BL
  652.                                     Box_Lines[6].To = BL - Dir2
  653.  
  654.                                     -- 4
  655.                                     Box_Lines[7].From = BR
  656.                                     Box_Lines[7].To = BR - Dir1
  657.  
  658.                                     Box_Lines[8].From = BR
  659.                                     Box_Lines[8].To = BR - Dir2
  660.  
  661.                                     if Box_Lines[8].Visible == false or Box_Lines[1].Visible == false then
  662.                                         Box_Vis(true, 2)
  663.                                     end
  664.                                 else
  665.                                     -- 1
  666.                                     Box_Lines[1].From = TR
  667.                                     Box_Lines[1].To = TL
  668.  
  669.                                     Box_Lines[2].From = TL
  670.                                     Box_Lines[2].To = BL
  671.  
  672.                                     -- 2
  673.                                     Box_Lines[3].From = BL
  674.                                     Box_Lines[3].To = BR
  675.  
  676.                                     Box_Lines[4].From = BR
  677.                                     Box_Lines[4].To = TR
  678.  
  679.                                     if Box_Lines[8].Visible == true or Box_Lines[1].Visible == false then
  680.                                         Box_Vis(true, 1)
  681.                                     end
  682.                                 end
  683.                             else
  684.                                 Health_Bar.Visible = false
  685.                                 Bar.Visible = false
  686.                                 Box_Vis(false)
  687.                             end
  688.  
  689.                             if RCX.ESP.Info then
  690.                                 local function show_info()
  691.                                     if dist ~= nil and dist < RCX.ESP.Max_Info_Distance  then
  692.                                         INFO.Position = V3(root_x, root_y-newsize_y-INFO.TextBounds.Y)
  693.                                         INFO.Text = ""
  694.  
  695.                                         hum.DisplayDistanceType = hide_name
  696.  
  697.                                         if RCX.ESP.Names then
  698.                                             INFO.Text = plr_name
  699.                                         end
  700.  
  701.                                         if RCX.ESP.Health then
  702.                                             INFO.Text = tostring(round(hum.Health/hum.MaxHealth*100)).."% ".. INFO.Text
  703.                                         end
  704.  
  705.                                         if RCX.ESP.Distance then
  706.                                             INFO.Text = INFO.Text.." ("..tostring(round(dist))..")"
  707.                                         end        
  708.                                        
  709.                                         INFO.Visible = true
  710.                                     else
  711.                                         INFO.Visible = false
  712.                                     end
  713.                                 end
  714.  
  715.                                 if RCX.ESP.Hover_Info then
  716.                                     if (V3(Mouse.X, Mouse.Y + inset.Y) - V3(root_x, root_y)).magnitude < clamp(ratio*1.25, 5, huge) then
  717.                                         show_info()
  718.                                     else
  719.                                         INFO.Visible = false
  720.                                     end
  721.                                 else
  722.                                     show_info()
  723.                                 end
  724.                             else
  725.                                 INFO.Visible = false
  726.                                 hum.DisplayDistanceType = show_name
  727.                             end
  728.                         else
  729.                             Box_Vis(false)
  730.                             INFO.Visible = false
  731.                             Health_Bar.Visible = false
  732.                             Bar.Visible = false
  733.                             hum.DisplayDistanceType = show_name
  734.                         end
  735.                     else
  736.                         Box_Vis(false)
  737.                         INFO.Visible = false
  738.                         Health_Bar.Visible = false
  739.                         Bar.Visible = false
  740.                         viewTracer.Visible = false
  741.                         hum.DisplayDistanceType = show_name
  742.                     end
  743.                 else    
  744.                     Box_Vis(false)
  745.                     INFO.Visible = false
  746.                     Health_Bar.Visible = false
  747.                     Bar.Visible = false
  748.                     viewTracer.Visible = false
  749.                     if Players:FindFirstChild(plr_name) == nil then
  750.                         Destroy_ESP()
  751.                         connection:Disconnect()
  752.                     end
  753.                 end
  754.             end
  755.         end)
  756.     end
  757.     coroutine.wrap(Update_ESP)()
  758. end
  759.  
  760. do
  761.     local t = Players:GetChildren()
  762.     for i = 1, #t do
  763.         local v = t[i]
  764.         if v.Name ~= Player.Name then
  765.             coroutine.wrap(ESP_API.AddPlayer)(v.Name)
  766.         end
  767.     end
  768. end
  769.  
  770. Players.ChildAdded:Connect(function(v)
  771.     ResetStructure()
  772.  
  773.     coroutine.wrap(ESP_API.AddPlayer)(v.Name)
  774. end)
  775.  
  776. -- AIMBOT PLAYERS
  777.  
  778. local Aiming = false
  779. local random_part
  780.  
  781. local aim_c_1
  782. aim_c_1 = UIS.InputBegan:Connect(function(input)
  783.     if DESTROY then
  784.         aim_c_1:Disconnect()
  785.     elseif RCX.AIMBOT.Aim_Mode == "Key" and input.UserInputType == Enum.UserInputType.Keyboard and input.KeyCode == Enum.KeyCode[RCX.AIMBOT.Aim_Key] then
  786.         random_part = random(1, 3)
  787.         Aiming = true
  788.     elseif RCX.AIMBOT.Aim_Mode == "Mouse" and input.UserInputType == Enum.UserInputType.MouseButton2 then
  789.         random_part = random(1, 3)
  790.         Aiming = true
  791.     end
  792. end)
  793.  
  794. local aim_c_2
  795. aim_c_2 = UIS.InputEnded:Connect(function(input)
  796.     if DESTROY then
  797.         aim_c_1:Disconnect()
  798.         Aiming = false
  799.     elseif RCX.AIMBOT.Aim_Mode == "Key" and input.UserInputType == Enum.UserInputType.Keyboard and input.KeyCode == Enum.KeyCode[RCX.AIMBOT.Aim_Key] then
  800.         random_part = 0
  801.         Aiming = false
  802.     elseif RCX.AIMBOT.Aim_Mode == "Mouse" and input.UserInputType == Enum.UserInputType.MouseButton2 then
  803.         random_part = 0
  804.         Aiming = false
  805.     end
  806. end)
  807.  
  808. local FOV = DRAWING("Circle")
  809. FOV.Visible = false
  810. FOV.Color = RGB(RCX.AIMBOT.FOV_Color.R, RCX.AIMBOT.FOV_Color.G, RCX.AIMBOT.FOV_Color.B)
  811. FOV.Position = V3(0, 0)
  812. FOV.Transparency = 0.6
  813. FOV.NumSides = 75
  814. FOV.Radius = RCX.AIMBOT.FOV_Radius
  815. FOV.Filled = false
  816. FOV.Thickness = 1
  817.  
  818. local function SameTeam(plr_name)
  819.     local plr = Players:FindFirstChild(plr_name)
  820.     local deb = false
  821.     if plr ~= nil and RCX.AIMBOT.Team_Check and plr:IsA("Player") and Player:IsA("Player") then
  822.         if plr.TeamColor == Player.TeamColor then
  823.             deb = true
  824.         else
  825.             deb = false
  826.         end
  827.     else
  828.         deb = false
  829.     end
  830.     return deb
  831. end
  832.  
  833. local function GetClosest()
  834.     Camera = Space.CurrentCamera
  835.     local min = huge
  836.     local closest = nil
  837.     if RCX.AIMBOT.Distance_Type == "Mouse" then
  838.         for i, v in pairs(Player_Characters) do
  839.             local Character = v
  840.  
  841.             if v.Name ~= Player.Name and Character ~= nil and Character:FindFirstChildOfClass("Humanoid") and Character:FindFirstChildOfClass("Humanoid").Health > 0 and (Character:FindFirstChild("HumanoidRootPart") or Character.PrimaryPart ~= nil) and SameTeam(v.Name) == false then
  842.                 local rootpart = Character:FindFirstChild("HumanoidRootPart") or Character.PrimaryPart
  843.                 local pos, vis
  844.                 local part = RCX.AIMBOT.Bone
  845.                 if part == "Head" and Character:FindFirstChild("Head") then
  846.                     pos, vis = Camera:WorldToViewportPoint(Character.Head.Position)
  847.                 elseif part == "Neck" and Character:FindFirstChild("Head") then
  848.                     pos, vis = Camera:WorldToViewportPoint(Character.Head.Position - V3(0, Character.Head.Size.Y/2, 0))
  849.                 elseif part == "Torso" then
  850.                     pos, vis = Camera:WorldToViewportPoint(rootpart.Position)
  851.                 elseif part == "Feet" then
  852.                     pos, vis = Camera:WorldToViewportPoint(rootpart.Position - V3(0, 2.5, 0))
  853.                 elseif part == "Random" then
  854.                     if random_part == 1 and Character:FindFirstChild("Head") then
  855.                         pos, vis = Camera:WorldToViewportPoint(Character.Head.Position)
  856.                     elseif random_part == 2 then
  857.                         pos, vis = Camera:WorldToViewportPoint(rootpart.Position)
  858.                     elseif random_part == 3 then
  859.                         pos, vis = Camera:WorldToViewportPoint(rootpart.Position - V3(0, 2.5, 0))
  860.                     else
  861.                         pos, vis = Camera:WorldToViewportPoint(rootpart.Position)
  862.                     end
  863.                 else
  864.                     pos, vis = Camera:WorldToViewportPoint(rootpart.Position)
  865.                 end
  866.                 local dist = (V3(Mouse.X+inset.X, Mouse.Y+inset.Y) - V3(pos.X, pos.Y)).magnitude
  867.                 if vis then
  868.                     local d = (V3(pos.X, pos.Y) - FOV.Position).magnitude
  869.                     if d <= FOV.Radius and dist < min then
  870.                         min = dist
  871.                         closest = v
  872.                     end
  873.                 end
  874.             end
  875.         end
  876.     elseif RCX.AIMBOT.Distance_Type == "Character" then
  877.         for i, v in pairs(Player_Characters) do
  878.             local Character = v
  879.  
  880.             if v.Name ~= Player.Name and Character ~= nil and Character:FindFirstChildOfClass("Humanoid") and Character:FindFirstChildOfClass("Humanoid").Health > 0 and (Character:FindFirstChild("HumanoidRootPart") or Character.PrimaryPart ~= nil) and SameTeam(v.Name) == false then
  881.                 local rootpart = Character:FindFirstChild("HumanoidRootPart") or Character.PrimaryPart
  882.                 local localrootpart = Player.Character:FindFirstChild("HumanoidRootPart") or Player.Character.PrimaryPart
  883.                 local dist = (localrootpart.Position - rootpart.Position).magnitude
  884.                 local pos, vis
  885.                 local part = RCX.AIMBOT.Bone
  886.                 if part == "Head" and Character:FindFirstChild("Head") then
  887.                     pos, vis = Camera:WorldToViewportPoint(Character.Head.Position)
  888.                 elseif part == "Neck" and Character:FindFirstChild("Head") then
  889.                     pos, vis = Camera:WorldToViewportPoint(Character.Head.Position - V3(0, Character.Head.Size.Y/2, 0))
  890.                 elseif part == "Torso" then
  891.                     pos, vis = Camera:WorldToViewportPoint(rootpart.Position)
  892.                 elseif part == "Feet" then
  893.                     pos, vis = Camera:WorldToViewportPoint(rootpart.Position - V3(0, 2.5, 0))
  894.                 elseif part == "Random" then
  895.                     if random_part == 1 and Character:FindFirstChild("Head") then
  896.                         pos, vis = Camera:WorldToViewportPoint(Character.Head.Position)
  897.                     elseif random_part == 2 then
  898.                         pos, vis = Camera:WorldToViewportPoint(rootpart.Position)
  899.                     elseif random_part == 3 then
  900.                         pos, vis = Camera:WorldToViewportPoint(rootpart.Position - V3(0, 2.5, 0))
  901.                     else
  902.                         pos, vis = Camera:WorldToViewportPoint(rootpart.Position)
  903.                     end
  904.                 else
  905.                     pos, vis = Camera:WorldToViewportPoint(rootpart.Position)
  906.                 end
  907.                 if vis then
  908.                     local d = (V3(pos.X, pos.Y) - FOV.Position).magnitude
  909.                     if d <= FOV.Radius and dist < min then
  910.                         min = dist
  911.                         closest = v
  912.                     end
  913.                 end
  914.             end
  915.         end
  916.     end
  917.     return closest
  918. end
  919.  
  920. coroutine.wrap(function()
  921.     local c_selected
  922.     c_selected = RS.RenderStepped:Connect(function()
  923.         if DESTROY then
  924.             c_selected:Disconnect()
  925.         else
  926.             Selected_Player = GetClosest()
  927.         end
  928.     end)
  929. end)()
  930.  
  931. local inset = game:GetService("GuiService"):GetGuiInset()
  932.  
  933. local function Aimbot_Start()
  934.     local c
  935.     c = RS.RenderStepped:Connect(function()
  936.         Camera = Space.CurrentCamera
  937.         if DESTROY then
  938.             FOV:Remove()
  939.             c:Disconnect()
  940.         elseif RCX.AIMBOT.Toggle then
  941.            
  942.             if RCX.AIMBOT.FOV then
  943.                 FOV.Radius = RCX.AIMBOT.FOV_Radius
  944.                 FOV.Thickness = 1
  945.                 local fov_col = RCX.AIMBOT.FOV_Color
  946.                 FOV.Color = RGB(fov_col.R, fov_col.G, fov_col.B)
  947.    
  948.                 FOV.Position = V3(Mouse.X, Mouse.Y + 36)
  949.                 FOV.Visible = true
  950.             else
  951.                 FOV.Radius = 2000
  952.    
  953.                 FOV.Position = Camera.ViewportSize / 2
  954.                 FOV.Visible = false
  955.             end
  956.  
  957.             if Aiming and Selected_Player ~= nil then
  958.                 local rootpart = Selected_Player:FindFirstChild("HumanoidRootPart") or Selected_Player.PrimaryPart
  959.                 local Character = Selected_Player
  960.                 local pos
  961.                 local part = RCX.AIMBOT.Bone
  962.                 if part == "Head" and Character:FindFirstChild("Head") then
  963.                     pos = Camera:WorldToViewportPoint(Character.Head.Position)
  964.                 elseif part == "Neck" and Character:FindFirstChild("Head") then
  965.                     pos = Camera:WorldToViewportPoint(Character.Head.Position - V3(0, Character.Head.Size.Y/2, 0))
  966.                 elseif part == "Torso" then
  967.                     pos = Camera:WorldToViewportPoint(rootpart.Position)
  968.                 elseif part == "Feet" then
  969.                     pos = Camera:WorldToViewportPoint(rootpart.Position - V3(0, 2.5, 0))
  970.                 elseif part == "Random" then
  971.                     if random_part == 1 and Character:FindFirstChild("Head") then
  972.                         pos = Camera:WorldToViewportPoint(Character.Head.Position)
  973.                     elseif random_part == 2 then
  974.                         pos = Camera:WorldToViewportPoint(rootpart.Position)
  975.                     elseif random_part == 3 then
  976.                         pos = Camera:WorldToViewportPoint(rootpart.Position - V3(0, 2.5, 0))
  977.                     else
  978.                         pos = Camera:WorldToViewportPoint(rootpart.Position)
  979.                     end
  980.                 else
  981.                     pos = Camera:WorldToViewportPoint(rootpart.Position)
  982.                 end
  983.                 local sens = clamp(1-RCX.AIMBOT.Smoothness, 0.01, 1)/1.5
  984.                 mousemoverel((pos.X - Mouse.X) * sens, (pos.Y - Mouse.Y - inset.Y) * sens)
  985.             end
  986.         elseif RCX.AIMBOT.Toggle == false then
  987.             FOV.Visible = false
  988.         end
  989.     end)
  990. end
  991. coroutine.wrap(Aimbot_Start)()
Tags: lua
Add Comment
Please, Sign In to add comment