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