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