24k_Dark

Unnamed ESP Script

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