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