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