TAMATI9875

ESP ui localisation

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