medo9198

ESB

Mar 6th, 2022
15
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 27.57 KB | None | 0 0
  1. -- Unnamed ESP
  2.  
  3. assert(Drawing, 'exploit not supported')
  4.  
  5. local UserInputService = game:GetService'UserInputService';
  6. local HttpService = game:GetService'HttpService';
  7. local GUIService = game:GetService'GuiService';
  8. local RunService = game:GetService'RunService';
  9. local Players = game:GetService'Players';
  10. local LocalPlayer = Players.LocalPlayer;
  11. local Camera = workspace.CurrentCamera
  12. local Mouse = LocalPlayer:GetMouse();
  13. local Menu = {};
  14. local MouseHeld = false;
  15. local LastRefresh = 0;
  16. local OptionsFile = 'IC3_ESP_SETTINGS.dat';
  17. local Binding = false;
  18. local BindedKey = nil;
  19. local OIndex = 0;
  20. local LineBox = {};
  21. local UIButtons = {};
  22. local Sliders = {};
  23. local Dragging = false;
  24. local DraggingUI = false;
  25. local DragOffset = Vector2.new();
  26. local DraggingWhat = nil;
  27. local OldData = {};
  28. local IgnoreList = {};
  29. local Red = Color3.new(1, 0, 0);
  30. local Green = Color3.new(0, 1, 0);
  31. local MenuLoaded = false;
  32.  
  33. shared.MenuDrawingData = shared.MenuDrawingData or { Instances = {} };
  34. shared.PlayerData = shared.PlayerData or {};
  35. shared.RSName = shared.RSName or ('UnnamedESP_by_ic3-' .. HttpService:GenerateGUID(false));
  36.  
  37. local GetDataName = shared.RSName .. '-GetData';
  38. local UpdateName = shared.RSName .. '-Update';
  39.  
  40. local Debounce = setmetatable({}, {
  41. __index = function(t, i)
  42. return rawget(t, i) or false
  43. end;
  44. });
  45.  
  46. pcall(function() shared.InputBeganCon:disconnect() end);
  47. pcall(function() shared.InputEndedCon:disconnect() end);
  48.  
  49. function GetMouseLocation()
  50. return UserInputService:GetMouseLocation();
  51. end
  52.  
  53. function MouseHoveringOver(Values)
  54. local X1, Y1, X2, Y2 = Values[1], Values[2], Values[3], Values[4]
  55. local MLocation = GetMouseLocation();
  56. return (MLocation.x >= X1 and MLocation.x <= (X1 + (X2 - X1))) and (MLocation.y >= Y1 and MLocation.y <= (Y1 + (Y2 - Y1)));
  57. end
  58.  
  59. function GetTableData(t) -- basically table.foreach i dont even know why i made this
  60. if typeof(t) ~= 'table' then return end
  61. return setmetatable(t, {
  62. __call = function(t, func)
  63. if typeof(func) ~= 'function' then return end;
  64. for i, v in pairs(t) do
  65. pcall(func, i, v);
  66. end
  67. end;
  68. });
  69. end
  70. local function Format(format, ...)
  71. return string.format(format, ...);
  72. end
  73. function CalculateValue(Min, Max, Percent)
  74. return Min + math.floor(((Max - Min) * Percent) + .5);
  75. end
  76.  
  77. local Options = setmetatable({}, {
  78. __call = function(t, ...)
  79. local Arguments = {...};
  80. local Name = Arguments[1];
  81. OIndex = OIndex + 1; -- (typeof(Arguments[3]) == 'boolean' and 1 or 0);
  82. rawset(t, Name, setmetatable({
  83. Name = Arguments[1];
  84. Text = Arguments[2];
  85. Value = Arguments[3];
  86. DefaultValue = Arguments[3];
  87. AllArgs = Arguments;
  88. Index = OIndex;
  89. }, {
  90. __call = function(t, v)
  91. if typeof(t.Value) == 'function' then
  92. t.Value();
  93. elseif typeof(t.Value) == 'EnumItem' then
  94. local BT = Menu:GetInstance(Format('%s_BindText', t.Name));
  95. Binding = true;
  96. local Val = 0
  97. while Binding do
  98. wait();
  99. Val = (Val + 1) % 17;
  100. BT.Text = Val <= 8 and '|' or '';
  101. end
  102. t.Value = BindedKey;
  103. BT.Text = tostring(t.Value):match'%w+%.%w+%.(.+)';
  104. BT.Position = t.BasePosition + Vector2.new(t.BaseSize.X - BT.TextBounds.X - 20, -10);
  105. else
  106. local NewValue = v;
  107. if NewValue == nil then NewValue = not t.Value; end
  108. rawset(t, 'Value', NewValue);
  109. if Arguments[2] ~= nil then
  110. if typeof(Arguments[3]) == 'number' then
  111. local AMT = Menu:GetInstance(Format('%s_AmountText', t.Name));
  112. AMT.Text = tostring(t.Value);
  113. AMT.Position = t.BasePosition + Vector2.new(t.BaseSize.X - AMT.TextBounds.X - 10, -10);
  114. else
  115. local Inner = Menu:GetInstance(Format('%s_InnerCircle', t.Name));
  116. Inner.Visible = t.Value;
  117. end
  118. end
  119. end
  120. end;
  121. }));
  122. end;
  123. })
  124.  
  125. function Load()
  126. local _, Result = pcall(readfile, OptionsFile);
  127. if _ then -- extremely ugly code yea i know but i dont care p.s. i hate pcall
  128. local _, Table = pcall(HttpService.JSONDecode, HttpService, Result);
  129. if _ then
  130. for i, v in pairs(Table) do
  131. if Options[i] ~= nil and Options[i].Value ~= nil and (typeof(Options[i].Value) == 'boolean' or typeof(Options[i].Value) == 'number') then
  132. Options[i].Value = v.Value;
  133. pcall(Options[i], v.Value);
  134. end
  135. end
  136. end
  137. end
  138. end
  139.  
  140. Options('Enabled', 'ESP Enabled', true);
  141. Options('ShowTeam', 'Show Team', false);
  142. Options('ShowName', 'Show Names', true);
  143. Options('ShowDistance', 'Show Distance', true);
  144. Options('ShowHealth', 'Show Health', true);
  145. Options('ShowBoxes', 'Show Boxes', true);
  146. Options('ShowTracers', 'Show Tracers', true);
  147. Options('ShowDot', 'Show Head Dot', false);
  148. Options('VisCheck', 'Visibility Check', false);
  149. Options('Crosshair', 'Crosshair', false);
  150. Options('TextOutline', 'Text Outline', true);
  151. Options('TextSize', 'Text Size', syn and 18 or 14, 10, 24); -- cuz synapse fonts look weird???
  152. Options('MaxDistance', 'Max Distance', 2500, 100, 5000);
  153. Options('RefreshRate', 'Refresh Rate (ms)', 5, 1, 200);
  154. Options('MenuKey', 'Menu Key', Enum.KeyCode.F4, 1);
  155. Options('ResetSettings', 'Reset Settings', function()
  156. for i, v in pairs(Options) do
  157. if Options[i] ~= nil and Options[i].Value ~= nil and Options[i].Text ~= nil and (typeof(Options[i].Value) == 'boolean' or typeof(Options[i].Value) == 'number') then
  158. Options[i](Options[i].DefaultValue);
  159. end
  160. end
  161. end, 4);
  162. Options('LoadSettings', 'Load Settings', Load, 3);
  163. Options('SaveSettings', 'Save Settings', function()
  164. writefile(OptionsFile, HttpService:JSONEncode(Options));
  165. end, 2)
  166. -- Options.SaveSettings.Value();
  167.  
  168. Load();
  169.  
  170. Options('MenuOpen', nil, true);
  171.  
  172. local function Set(t, i, v)
  173. t[i] = v;
  174. end
  175. local function Combine(...)
  176. local Output = {};
  177. for i, v in pairs{...} do
  178. if typeof(v) == 'table' then
  179. table.foreach(v, function(i, v)
  180. Output[i] = v;
  181. end)
  182. end
  183. end
  184. return Output
  185. end
  186. function IsStringEmpty(String)
  187. if type(String) == 'string' then
  188. return String:match'^%s+$' ~= nil or #String == 0 or String == '' or false;
  189. end
  190. return false
  191. end
  192.  
  193. function NewDrawing(InstanceName)
  194. local Instance = Drawing.new(InstanceName);
  195. return (function(Properties)
  196. for i, v in pairs(Properties) do
  197. pcall(Set, Instance, i, v);
  198. end
  199. return Instance;
  200. end)
  201. end
  202.  
  203. function Menu:AddMenuInstace(Name, Instance)
  204. if shared.MenuDrawingData.Instances[Name] ~= nil then
  205. shared.MenuDrawingData.Instances[Name]:Remove();
  206. end
  207. shared.MenuDrawingData.Instances[Name] = Instance;
  208. return Instance;
  209. end
  210. function Menu:UpdateMenuInstance(Name)
  211. local Instance = shared.MenuDrawingData.Instances[Name];
  212. if Instance ~= nil then
  213. return (function(Properties)
  214. for i, v in pairs(Properties) do
  215. -- print(Format('%s %s -> %s', Name, tostring(i), tostring(v)));
  216. pcall(Set, Instance, i, v);
  217. end
  218. return Instance;
  219. end)
  220. end
  221. end
  222. function Menu:GetInstance(Name)
  223. return shared.MenuDrawingData.Instances[Name];
  224. end
  225.  
  226. function LineBox:Create(Properties)
  227. local Box = { Visible = true }; -- prevent errors not really though dont worry bout the Visible = true thing
  228.  
  229. local Properties = Combine({
  230. Transparency = 1;
  231. Thickness = 1;
  232. Visible = true;
  233. }, Properties);
  234.  
  235. Box['TopLeft'] = NewDrawing'Line'(Properties);
  236. Box['TopRight'] = NewDrawing'Line'(Properties);
  237. Box['BottomLeft'] = NewDrawing'Line'(Properties);
  238. Box['BottomRight'] = NewDrawing'Line'(Properties);
  239.  
  240. function Box:Update(CF, Size, Color, Properties)
  241. if not CF or not Size then return end
  242.  
  243. local TLPos, Visible1 = Camera:WorldToViewportPoint((CF * CFrame.new( Size.X, Size.Y, 0)).p);
  244. local TRPos, Visible2 = Camera:WorldToViewportPoint((CF * CFrame.new(-Size.X, Size.Y, 0)).p);
  245. local BLPos, Visible3 = Camera:WorldToViewportPoint((CF * CFrame.new( Size.X, -Size.Y, 0)).p);
  246. local BRPos, Visible4 = Camera:WorldToViewportPoint((CF * CFrame.new(-Size.X, -Size.Y, 0)).p);
  247. -- ## BEGIN UGLY CODE
  248. if Visible1 then
  249. Box['TopLeft'].Visible = true;
  250. Box['TopLeft'].Color = Color;
  251. Box['TopLeft'].From = Vector2.new(TLPos.X, TLPos.Y);
  252. Box['TopLeft'].To = Vector2.new(TRPos.X, TRPos.Y);
  253. else
  254. Box['TopLeft'].Visible = false;
  255. end
  256. if Visible2 then
  257. Box['TopRight'].Visible = true;
  258. Box['TopRight'].Color = Color;
  259. Box['TopRight'].From = Vector2.new(TRPos.X, TRPos.Y);
  260. Box['TopRight'].To = Vector2.new(BRPos.X, BRPos.Y);
  261. else
  262. Box['TopRight'].Visible = false;
  263. end
  264. if Visible3 then
  265. Box['BottomLeft'].Visible = true;
  266. Box['BottomLeft'].Color = Color;
  267. Box['BottomLeft'].From = Vector2.new(BLPos.X, BLPos.Y);
  268. Box['BottomLeft'].To = Vector2.new(TLPos.X, TLPos.Y);
  269. else
  270. Box['BottomLeft'].Visible = false;
  271. end
  272. if Visible4 then
  273. Box['BottomRight'].Visible = true;
  274. Box['BottomRight'].Color = Color;
  275. Box['BottomRight'].From = Vector2.new(BRPos.X, BRPos.Y);
  276. Box['BottomRight'].To = Vector2.new(BLPos.X, BLPos.Y);
  277. else
  278. Box['BottomRight'].Visible = false;
  279. end
  280. -- ## END UGLY CODE
  281. if Properties then
  282. GetTableData(Properties)(function(i, v)
  283. pcall(Set, Box['TopLeft'], i, v);
  284. pcall(Set, Box['TopRight'], i, v);
  285. pcall(Set, Box['BottomLeft'], i, v);
  286. pcall(Set, Box['BottomRight'], i, v);
  287. end)
  288. end
  289. end
  290. function Box:SetVisible(bool)
  291. pcall(Set, Box['TopLeft'], 'Visible', bool);
  292. pcall(Set, Box['TopRight'], 'Visible', bool);
  293. pcall(Set, Box['BottomLeft'], 'Visible', bool);
  294. pcall(Set, Box['BottomRight'], 'Visible', bool);
  295. end
  296. function Box:Remove()
  297. self:SetVisible(false);
  298. Box['TopLeft']:Remove();
  299. Box['TopRight']:Remove();
  300. Box['BottomLeft']:Remove();
  301. Box['BottomRight']:Remove();
  302. end
  303.  
  304. return Box;
  305. end
  306.  
  307. function CreateMenu(NewPosition) -- Create Menu
  308. local function FromHex(HEX)
  309. HEX = HEX:gsub('#', '');
  310. return Color3.fromRGB(tonumber('0x' .. HEX:sub(1, 2)), tonumber('0x' .. HEX:sub(3, 4)), tonumber('0x' .. HEX:sub(5, 6)));
  311. end
  312.  
  313. local Colors = {
  314. Primary = {
  315. Main = FromHex'424242';
  316. Light = FromHex'6d6d6d';
  317. Dark = FromHex'1b1b1b';
  318. };
  319. Secondary = {
  320. Main = FromHex'e0e0e0';
  321. Light = FromHex'ffffff';
  322. Dark = FromHex'aeaeae';
  323. };
  324. };
  325.  
  326. MenuLoaded = false;
  327.  
  328. GetTableData(UIButtons)(function(i, v)
  329. v.Instance.Visible = false;
  330. v.Instance:Remove();
  331. end)
  332. GetTableData(Sliders)(function(i, v)
  333. v.Instance.Visible = false;
  334. v.Instance:Remove();
  335. end)
  336.  
  337. UIButtons = {};
  338. Sliders = {};
  339.  
  340. local BaseSize = Vector2.new(300, 580);
  341. local BasePosition = NewPosition or Vector2.new(Camera.ViewportSize.X / 8 - (BaseSize.X / 2), Camera.ViewportSize.Y / 2 - (BaseSize.Y / 2));
  342.  
  343. Menu:AddMenuInstace('CrosshairX', NewDrawing'Line'{
  344. Visible = false;
  345. Color = Color3.new(0, 1, 0);
  346. Transparency = 1;
  347. Thickness = 1;
  348. });
  349. Menu:AddMenuInstace('CrosshairY', NewDrawing'Line'{
  350. Visible = false;
  351. Color = Color3.new(0, 1, 0);
  352. Transparency = 1;
  353. Thickness = 1;
  354. });
  355.  
  356. delay(.025, function() -- since zindex doesnt exist
  357. Menu:AddMenuInstace('Main', NewDrawing'Square'{
  358. Size = BaseSize;
  359. Position = BasePosition;
  360. Filled = false;
  361. Color = Colors.Primary.Main;
  362. Thickness = 3;
  363. Visible = true;
  364. });
  365. end);
  366. Menu:AddMenuInstace('TopBar', NewDrawing'Square'{
  367. Position = BasePosition;
  368. Size = Vector2.new(BaseSize.X, 25);
  369. Color = Colors.Primary.Dark;
  370. Filled = true;
  371. Visible = true;
  372. });
  373. Menu:AddMenuInstace('TopBarTwo', NewDrawing'Square'{
  374. Position = BasePosition + Vector2.new(0, 25);
  375. Size = Vector2.new(BaseSize.X, 60);
  376. Color = Colors.Primary.Main;
  377. Filled = true;
  378. Visible = true;
  379. });
  380. Menu:AddMenuInstace('TopBarText', NewDrawing'Text'{
  381. Size = 25;
  382. Position = shared.MenuDrawingData.Instances.TopBarTwo.Position + Vector2.new(25, 15);
  383. Text = 'Unnamed ESP';
  384. Color = Colors.Secondary.Light;
  385. Visible = true;
  386. });
  387. Menu:AddMenuInstace('TopBarTextBR', NewDrawing'Text'{
  388. Size = 15;
  389. Position = shared.MenuDrawingData.Instances.TopBarTwo.Position + Vector2.new(BaseSize.X - 65, 40);
  390. Text = 'by ic3w0lf';
  391. Color = Colors.Secondary.Dark;
  392. Visible = true;
  393. });
  394. Menu:AddMenuInstace('Filling', NewDrawing'Square'{
  395. Size = BaseSize - Vector2.new(0, 85);
  396. Position = BasePosition + Vector2.new(0, 85);
  397. Filled = true;
  398. Color = Colors.Secondary.Main;
  399. Transparency= .5;
  400. Visible = true;
  401. });
  402.  
  403. local CPos = 0;
  404.  
  405. GetTableData(Options)(function(i, v)
  406. if typeof(v.Value) == 'boolean' and not IsStringEmpty(v.Text) and v.Text ~= nil then
  407. CPos = CPos + 25;
  408. local BaseSize = Vector2.new(BaseSize.X, 30);
  409. local BasePosition = shared.MenuDrawingData.Instances.Filling.Position + Vector2.new(30, v.Index * 25 - 10);
  410. UIButtons[#UIButtons + 1] = {
  411. Option = v;
  412. Instance = Menu:AddMenuInstace(Format('%s_Hitbox', v.Name), NewDrawing'Square'{
  413. Position = BasePosition - Vector2.new(30, 15);
  414. Size = BaseSize;
  415. Visible = false;
  416. });
  417. };
  418. Menu:AddMenuInstace(Format('%s_OuterCircle', v.Name), NewDrawing'Circle'{
  419. Radius = 10;
  420. Position = BasePosition;
  421. Color = Colors.Secondary.Light;
  422. Filled = true;
  423. Visible = true;
  424. });
  425. Menu:AddMenuInstace(Format('%s_InnerCircle', v.Name), NewDrawing'Circle'{
  426. Radius = 7;
  427. Position = BasePosition;
  428. Color = Colors.Secondary.Dark;
  429. Filled = true;
  430. Visible = v.Value;
  431. });
  432. Menu:AddMenuInstace(Format('%s_Text', v.Name), NewDrawing'Text'{
  433. Text = v.Text;
  434. Size = 20;
  435. Position = BasePosition + Vector2.new(20, -10);
  436. Visible = true;
  437. Color = Colors.Primary.Dark;
  438. });
  439. end
  440. end)
  441. GetTableData(Options)(function(i, v) -- just to make sure certain things are drawn before or after others, too lazy to actually sort table
  442. if typeof(v.Value) == 'number' then
  443. CPos = CPos + 25;
  444.  
  445. local BaseSize = Vector2.new(BaseSize.X, 30);
  446. local BasePosition = shared.MenuDrawingData.Instances.Filling.Position + Vector2.new(0, CPos - 10);
  447.  
  448. local Text = Menu:AddMenuInstace(Format('%s_Text', v.Name), NewDrawing'Text'{
  449. Text = v.Text;
  450. Size = 20;
  451. Position = BasePosition + Vector2.new(20, -10);
  452. Visible = true;
  453. Color = Colors.Primary.Dark;
  454. });
  455. local AMT = Menu:AddMenuInstace(Format('%s_AmountText', v.Name), NewDrawing'Text'{
  456. Text = tostring(v.Value);
  457. Size = 20;
  458. Position = BasePosition;
  459. Visible = true;
  460. Color = Colors.Primary.Dark;
  461. });
  462. local Line = Menu:AddMenuInstace(Format('%s_SliderLine', v.Name), NewDrawing'Line'{
  463. Transparency = 1;
  464. Color = Colors.Primary.Dark;
  465. Thickness = 3;
  466. Visible = true;
  467. From = BasePosition + Vector2.new(20, 20);
  468. To = BasePosition + Vector2.new(BaseSize.X - 10, 20);
  469. });
  470. CPos = CPos + 10;
  471. local Slider = Menu:AddMenuInstace(Format('%s_Slider', v.Name), NewDrawing'Circle'{
  472. Visible = true;
  473. Filled = true;
  474. Radius = 6;
  475. Color = Colors.Secondary.Dark;
  476. Position = BasePosition + Vector2.new(35, 20);
  477. })
  478.  
  479. local CSlider = {Slider = Slider; Line = Line; Min = v.AllArgs[4]; Max = v.AllArgs[5]; Option = v};
  480. Sliders[#Sliders + 1] = CSlider;
  481.  
  482. -- local Percent = (v.Value / CSlider.Max) * 100;
  483. -- local Size = math.abs(Line.From.X - Line.To.X);
  484. -- local Value = Size * (Percent / 100); -- this shit's inaccurate but fuck it i'm not even gonna bother fixing it
  485.  
  486. Slider.Position = BasePosition + Vector2.new(40, 20);
  487.  
  488. v.BaseSize = BaseSize;
  489. v.BasePosition = BasePosition;
  490. AMT.Position = BasePosition + Vector2.new(BaseSize.X - AMT.TextBounds.X - 10, -10)
  491. end
  492. end)
  493. GetTableData(Options)(function(i, v) -- just to make sure certain things are drawn before or after others, too lazy to actually sort table
  494. if typeof(v.Value) == 'EnumItem' then
  495. CPos = CPos + 30;
  496.  
  497. local BaseSize = Vector2.new(BaseSize.X, 30);
  498. local BasePosition = shared.MenuDrawingData.Instances.Filling.Position + Vector2.new(0, CPos - 10);
  499.  
  500. UIButtons[#UIButtons + 1] = {
  501. Option = v;
  502. Instance = Menu:AddMenuInstace(Format('%s_Hitbox', v.Name), NewDrawing'Square'{
  503. Size = Vector2.new(BaseSize.X, 20) - Vector2.new(30, 0);
  504. Visible = true;
  505. Transparency= .5;
  506. Position = BasePosition + Vector2.new(15, -10);
  507. Color = Colors.Secondary.Light;
  508. Filled = true;
  509. });
  510. };
  511. local Text = Menu:AddMenuInstace(Format('%s_Text', v.Name), NewDrawing'Text'{
  512. Text = v.Text;
  513. Size = 20;
  514. Position = BasePosition + Vector2.new(20, -10);
  515. Visible = true;
  516. Color = Colors.Primary.Dark;
  517. });
  518. local BindText = Menu:AddMenuInstace(Format('%s_BindText', v.Name), NewDrawing'Text'{
  519. Text = tostring(v.Value):match'%w+%.%w+%.(.+)';
  520. Size = 20;
  521. Position = BasePosition;
  522. Visible = true;
  523. Color = Colors.Primary.Dark;
  524. });
  525.  
  526. Options[i].BaseSize = BaseSize;
  527. Options[i].BasePosition = BasePosition;
  528. BindText.Position = BasePosition + Vector2.new(BaseSize.X - BindText.TextBounds.X - 20, -10);
  529. end
  530. end)
  531. GetTableData(Options)(function(i, v) -- just to make sure certain things are drawn before or after others, too lazy to actually sort table
  532. if typeof(v.Value) == 'function' then
  533. local BaseSize = Vector2.new(BaseSize.X, 30);
  534. local BasePosition = shared.MenuDrawingData.Instances.Filling.Position + Vector2.new(0, CPos + (25 * v.AllArgs[4]) - 35);
  535.  
  536. UIButtons[#UIButtons + 1] = {
  537. Option = v;
  538. Instance = Menu:AddMenuInstace(Format('%s_Hitbox', v.Name), NewDrawing'Square'{
  539. Size = Vector2.new(BaseSize.X, 20) - Vector2.new(30, 0);
  540. Visible = true;
  541. Transparency= .5;
  542. Position = BasePosition + Vector2.new(15, -10);
  543. Color = Colors.Secondary.Light;
  544. Filled = true;
  545. });
  546. };
  547. local Text = Menu:AddMenuInstace(Format('%s_Text', v.Name), NewDrawing'Text'{
  548. Text = v.Text;
  549. Size = 20;
  550. Position = BasePosition + Vector2.new(20, -10);
  551. Visible = true;
  552. Color = Colors.Primary.Dark;
  553. });
  554.  
  555. -- BindText.Position = BasePosition + Vector2.new(BaseSize.X - BindText.TextBounds.X - 10, -10);
  556. end
  557. end)
  558.  
  559. delay(.1, function()
  560. MenuLoaded = true;
  561. end);
  562.  
  563. -- this has to be at the bottom cuz proto drawing api doesnt have zindex :triumph:
  564. Menu:AddMenuInstace('Cursor1', NewDrawing'Line'{
  565. Visible = false;
  566. Color = Color3.new(1, 0, 0);
  567. Transparency = 1;
  568. Thickness = 2;
  569. });
  570. Menu:AddMenuInstace('Cursor2', NewDrawing'Line'{
  571. Visible = false;
  572. Color = Color3.new(1, 0, 0);
  573. Transparency = 1;
  574. Thickness = 2;
  575. });
  576. Menu:AddMenuInstace('Cursor3', NewDrawing'Line'{
  577. Visible = false;
  578. Color = Color3.new(1, 0, 0);
  579. Transparency = 1;
  580. Thickness = 2;
  581. });
  582. end
  583.  
  584. CreateMenu();
  585.  
  586. shared.InputBeganCon = UserInputService.InputBegan:connect(function(input)
  587. if input.UserInputType.Name == 'MouseButton1' and Options.MenuOpen.Value then
  588. MouseHeld = true;
  589. local Bar = Menu:GetInstance'TopBar';
  590. local Values = {
  591. Bar.Position.X;
  592. Bar.Position.Y;
  593. Bar.Position.X + Bar.Size.X;
  594. Bar.Position.Y + Bar.Size.Y;
  595. }
  596. if MouseHoveringOver(Values) and not syn then -- disable dragging for synapse cuz idk why it breaks
  597. DraggingUI = false; -- also breaks for other exploits
  598. DragOffset = Menu:GetInstance'Main'.Position - GetMouseLocation();
  599. else
  600. for i, v in pairs(Sliders) do
  601. local Values = {
  602. v.Line.From.X - (v.Slider.Radius);
  603. v.Line.From.Y - (v.Slider.Radius);
  604. v.Line.To.X + (v.Slider.Radius);
  605. v.Line.To.Y + (v.Slider.Radius);
  606. };
  607. if MouseHoveringOver(Values) then
  608. DraggingWhat = v;
  609. Dragging = true;
  610. break
  611. end
  612. end
  613. end
  614. end
  615. end)
  616. shared.InputEndedCon = UserInputService.InputEnded:connect(function(input)
  617. if input.UserInputType.Name == 'MouseButton1' and Options.MenuOpen.Value then
  618. MouseHeld = false;
  619. for i, v in pairs(UIButtons) do
  620. local Values = {
  621. v.Instance.Position.X;
  622. v.Instance.Position.Y;
  623. v.Instance.Position.X + v.Instance.Size.X;
  624. v.Instance.Position.Y + v.Instance.Size.Y;
  625. };
  626. if MouseHoveringOver(Values) then
  627. v.Option();
  628. break -- prevent clicking 2 options
  629. end
  630. end
  631. elseif input.UserInputType.Name == 'Keyboard' then
  632. if Binding then
  633. BindedKey = input.KeyCode;
  634. Binding = false;
  635. elseif input.KeyCode == Options.MenuKey.Value or (input.KeyCode == Enum.KeyCode.Home and UserInputService:IsKeyDown(Enum.KeyCode.LeftControl)) then
  636. Options.MenuOpen();
  637. end
  638. end
  639. end)
  640.  
  641. function ToggleMenu()
  642. if Options.MenuOpen.Value then
  643. GetTableData(shared.MenuDrawingData.Instances)(function(i, v)
  644. if OldData[v] then
  645. pcall(Set, v, 'Visible', true);
  646. end
  647. end)
  648. else
  649. -- GUIService:SetMenuIsOpen(false);
  650. GetTableData(shared.MenuDrawingData.Instances)(function(i, v)
  651. if v.Visible == true then
  652. OldData[v] = true;
  653. pcall(Set, v, 'Visible', false);
  654. end
  655. end)
  656. end
  657. end
  658.  
  659. function CheckRay(Player, Distance, Position, Unit)
  660. local Pass = true;
  661.  
  662. if Distance > 999 then return false; end
  663.  
  664. local _Ray = Ray.new(Position, Unit * Distance);
  665.  
  666. local List = {LocalPlayer.Character, Camera, Mouse.TargetFilter};
  667.  
  668. for i,v in pairs(IgnoreList) do table.insert(List, v); end;
  669.  
  670. local Hit = workspace:FindPartOnRayWithIgnoreList(_Ray, List);
  671. if Hit and not Hit:IsDescendantOf(Player.Character) then
  672. Pass = false;
  673. if Hit.Transparency >= .3 or not Hit.CanCollide and Hit.ClassName ~= Terrain then -- Detect invisible walls
  674. IgnoreList[#IgnoreList + 1] = Hit;
  675. end
  676. end
  677.  
  678. return Pass;
  679. end
  680.  
  681. function CheckPlayer(Player)
  682. if not Options.Enabled.Value then return false end
  683.  
  684. local Pass = true;
  685. local Distance = 0;
  686.  
  687. if Player ~= LocalPlayer and Player.Character then
  688. if not Options.ShowTeam.Value and Player.TeamColor == LocalPlayer.TeamColor then
  689. Pass = false;
  690. end
  691.  
  692. local Head = Player.Character:FindFirstChild'Head';
  693.  
  694. if Pass and Player.Character and Head then
  695. Distance = (Camera.CFrame.p - Head.Position).magnitude;
  696. if Options.VisCheck.Value then
  697. Pass = CheckRay(Player, Distance, Camera.CFrame.p, (Head.Position - Camera.CFrame.p).unit);
  698. end
  699. if Distance > Options.MaxDistance.Value then
  700. Pass = false;
  701. end
  702. end
  703. else
  704. Pass = false;
  705. end
  706.  
  707. return Pass, Distance;
  708. end
  709.  
  710. function UpdatePlayerData()
  711. if (tick() - LastRefresh) > (Options.RefreshRate.Value / 1000) then
  712. LastRefresh = tick();
  713. for i, v in pairs(Players:GetPlayers()) do
  714. local Data = shared.PlayerData[v.Name] or { Instances = {} };
  715.  
  716. Data.Instances['Box'] = Data.Instances['Box'] or LineBox:Create{Thickness = 3};
  717. Data.Instances['Tracer'] = Data.Instances['Tracer'] or NewDrawing'Line'{
  718. Transparency = 1;
  719. Thickness = 2;
  720. }
  721. Data.Instances['HeadDot'] = Data.Instances['HeadDot'] or NewDrawing'Circle'{
  722. Filled = true;
  723. NumSides = 30;
  724. }
  725. Data.Instances['NameTag'] = Data.Instances['NameTag'] or NewDrawing'Text'{
  726. Size = Options.TextSize.Value;
  727. Center = true;
  728. Outline = Options.TextOutline.Value;
  729. Visible = true;
  730. };
  731. Data.Instances['DistanceHealthTag'] = Data.Instances['DistanceHealthTag'] or NewDrawing'Text'{
  732. Size = Options.TextSize.Value - 1;
  733. Center = true;
  734. Outline = Options.TextOutline.Value;
  735. Visible = true;
  736. };
  737.  
  738. local NameTag = Data.Instances['NameTag'];
  739. local DistanceTag = Data.Instances['DistanceHealthTag'];
  740. local Tracer = Data.Instances['Tracer'];
  741. local HeadDot = Data.Instances['HeadDot'];
  742. local Box = Data.Instances['Box'];
  743.  
  744. local Pass, Distance = CheckPlayer(v);
  745.  
  746. if Pass and v.Character then
  747. Data.LastUpdate = tick();
  748. local Humanoid = v.Character:FindFirstChildOfClass'Humanoid';
  749. local Head = v.Character:FindFirstChild'Head';
  750. local HumanoidRootPart = v.Character:FindFirstChild'HumanoidRootPart';
  751. if v.Character ~= nil and Head then
  752. local ScreenPosition, Vis = Camera:WorldToViewportPoint(Head.Position);
  753. if Vis then
  754. local Color = v.TeamColor == LocalPlayer.TeamColor and Green or Red;
  755.  
  756. local ScreenPositionUpper = Camera:WorldToViewportPoint(Head.CFrame * CFrame.new(0, Head.Size.Y, 0).p);
  757. local Scale = Head.Size.Y / 2;
  758.  
  759. if Options.ShowName.Value then
  760. NameTag.Visible = true;
  761. NameTag.Text = v.Name;
  762. NameTag.Size = Options.TextSize.Value;
  763. NameTag.Outline = Options.TextOutline.Value;
  764. NameTag.Position = Vector2.new(ScreenPositionUpper.X, ScreenPositionUpper.Y);
  765. NameTag.Color = Color;
  766. if Drawing.Fonts then -- CURRENTLY SYNAPSE ONLY :MEGAHOLY:
  767. NameTag.Font = Drawing.Fonts.UI;
  768. end
  769. else
  770. NameTag.Visible = false;
  771. end
  772. if Options.ShowDistance.Value or Options.ShowHealth.Value then
  773. DistanceTag.Visible = true;
  774. DistanceTag.Size = Options.TextSize.Value - 1;
  775. DistanceTag.Outline = Options.TextOutline.Value;
  776. DistanceTag.Color = Color3.new(1, 1, 1);
  777. if Drawing.Fonts then -- CURRENTLY SYNAPSE ONLY :MEGAHOLY:
  778. NameTag.Font = Drawing.Fonts.UI;
  779. end
  780.  
  781. local Str = '';
  782.  
  783. if Options.ShowDistance.Value then
  784. Str = Str .. Format('[%d] ', Distance);
  785. end
  786. if Options.ShowHealth.Value and Humanoid then
  787. Str = Str .. Format('[%d/100]', Humanoid.Health / Humanoid.MaxHealth * 100);
  788. end
  789.  
  790. DistanceTag.Text = Str;
  791. DistanceTag.Position = Vector2.new(ScreenPositionUpper.X, ScreenPositionUpper.Y) + Vector2.new(0, NameTag.Size);
  792. else
  793. DistanceTag.Visible = false;
  794. end
  795. if Options.ShowDot.Value then
  796. local Top = Camera:WorldToViewportPoint((Head.CFrame * CFrame.new(0, Scale, 0)).p);
  797. local Bottom = Camera:WorldToViewportPoint((Head.CFrame * CFrame.new(0, -Scale, 0)).p);
  798. local Radius = (Top - Bottom).y;
  799.  
  800. HeadDot.Visible = true;
  801. HeadDot.Color = Color;
  802. HeadDot.Position = Vector2.new(ScreenPosition.X, ScreenPosition.Y);
  803. HeadDot.Radius = Radius;
  804. else
  805. HeadDot.Visible = false;
  806. end
  807. if Options.ShowTracers.Value then
  808. Tracer.Visible = true;
  809. Tracer.From = Vector2.new(Camera.ViewportSize.X / 2, Camera.ViewportSize.Y);
  810. Tracer.To = Vector2.new(ScreenPosition.X, ScreenPosition.Y);
  811. Tracer.Color = Color;
  812. else
  813. Tracer.Visible = false;
  814. end
  815. if Options.ShowBoxes.Value and HumanoidRootPart then
  816. Box:Update(HumanoidRootPart.CFrame, Vector3.new(2, 3, 0) * (Scale * 2), Color);
  817. else
  818. Box:SetVisible(false);
  819. end
  820. else
  821. NameTag.Visible = false;
  822. DistanceTag.Visible = false;
  823. Tracer.Visible = false;
  824. HeadDot.Visible = false;
  825.  
  826. Box:SetVisible(false);
  827. end
  828. end
  829. else
  830. NameTag.Visible = false;
  831. DistanceTag.Visible = false;
  832. Tracer.Visible = false;
  833. HeadDot.Visible = false;
  834.  
  835. Box:SetVisible(false);
  836. end
  837.  
  838. shared.PlayerData[v.Name] = Data;
  839. end
  840. end
  841. end
  842.  
  843. function Update()
  844. for i, v in pairs(shared.PlayerData) do
  845. if not Players:FindFirstChild(tostring(i)) then
  846. GetTableData(v.Instances)(function(i, obj)
  847. obj.Visible = false;
  848. obj:Remove();
  849. v.Instances[i] = nil;
  850. end)
  851. shared.PlayerData[i] = nil;
  852. end
  853. end
  854.  
  855. local CX = Menu:GetInstance'CrosshairX';
  856. local CY = Menu:GetInstance'CrosshairY';
  857. if Options.Crosshair.Value then
  858. CX.Visible = true;
  859. CY.Visible = true;
  860.  
  861. CX.To = Vector2.new((Camera.ViewportSize.X / 2) - 8, (Camera.ViewportSize.Y / 2));
  862. CX.From = Vector2.new((Camera.ViewportSize.X / 2) + 8, (Camera.ViewportSize.Y / 2));
  863. CY.To = Vector2.new((Camera.ViewportSize.X / 2), (Camera.ViewportSize.Y / 2) - 8);
  864. CY.From = Vector2.new((Camera.ViewportSize.X / 2), (Camera.ViewportSize.Y / 2) + 8);
  865. else
  866. CX.Visible = false;
  867. CY.Visible = false;
  868. end
  869.  
  870. if Options.MenuOpen.Value and MenuLoaded then
  871. local MLocation = GetMouseLocation();
  872. shared.MenuDrawingData.Instances.Main.Color = Color3.fromHSV(tick() * 24 % 255/255, 1, 1);
  873. local MainInstance = Menu:GetInstance'Main';
  874. local Values = {
  875. MainInstance.Position.X;
  876. MainInstance.Position.Y;
  877. MainInstance.Position.X + MainInstance.Size.X;
  878. MainInstance.Position.Y + MainInstance.Size.Y;
  879. };
  880. if MainInstance and MouseHoveringOver(Values) then
  881. Debounce.CursorVis = true;
  882. -- GUIService:SetMenuIsOpen(true);
  883. Menu:UpdateMenuInstance'Cursor1'{
  884. Visible = true;
  885. From = Vector2.new(MLocation.x, MLocation.y);
  886. To = Vector2.new(MLocation.x + 5, MLocation.y + 6);
  887. }
  888. Menu:UpdateMenuInstance'Cursor2'{
  889. Visible = true;
  890. From = Vector2.new(MLocation.x, MLocation.y);
  891. To = Vector2.new(MLocation.x, MLocation.y + 8);
  892. }
  893. Menu:UpdateMenuInstance'Cursor3'{
  894. Visible = true;
  895. From = Vector2.new(MLocation.x, MLocation.y + 6);
  896. To = Vector2.new(MLocation.x + 5, MLocation.y + 5);
  897. }
  898. else
  899. if Debounce.CursorVis then
  900. Debounce.CursorVis = false;
  901. -- GUIService:SetMenuIsOpen(false);
  902. Menu:UpdateMenuInstance'Cursor1'{Visible = false};
  903. Menu:UpdateMenuInstance'Cursor2'{Visible = false};
  904. Menu:UpdateMenuInstance'Cursor3'{Visible = false};
  905. end
  906. end
  907. if MouseHeld then
  908. if Dragging then
  909. DraggingWhat.Slider.Position = Vector2.new(math.clamp(MLocation.X, DraggingWhat.Line.From.X, DraggingWhat.Line.To.X), DraggingWhat.Slider.Position.Y);
  910. local Percent = (DraggingWhat.Slider.Position.X - DraggingWhat.Line.From.X) / ((DraggingWhat.Line.To.X - DraggingWhat.Line.From.X));
  911. local Value = CalculateValue(DraggingWhat.Min, DraggingWhat.Max, Percent);
  912. DraggingWhat.Option(Value);
  913. elseif DraggingUI then
  914. Debounce.UIDrag = true;
  915. local Main = Menu:GetInstance'Main';
  916. local MousePos = GetMouseLocation();
  917. Main.Position = MousePos + DragOffset;
  918. end
  919. else
  920. Dragging = false;
  921. if DraggingUI and Debounce.UIDrag then
  922. Debounce.UIDrag = false;
  923. DraggingUI = false;
  924. CreateMenu(Menu:GetInstance'Main'.Position);
  925. end
  926. end
  927. if not Debounce.Menu then
  928. Debounce.Menu = true;
  929. ToggleMenu();
  930. end
  931. elseif Debounce.Menu and not Options.MenuOpen.Value then
  932. Debounce.Menu = false;
  933. ToggleMenu();
  934. end
  935. end
  936.  
  937. RunService:UnbindFromRenderStep(GetDataName);
  938. RunService:UnbindFromRenderStep(UpdateName);
  939.  
  940. RunService:BindToRenderStep(GetDataName, 1, UpdatePlayerData);
  941. RunService:BindToRenderStep(UpdateName, 1, Update);
Add Comment
Please, Sign In to add comment