ExodiaForce

Linoria

Nov 8th, 2024
4
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 120.02 KB | None | 0 0
  1. local InputService = game:GetService('UserInputService');
  2. local TextService = game:GetService('TextService');
  3. local CoreGui = game:GetService('CoreGui');
  4. local Teams = game:GetService('Teams');
  5. local Players = game:GetService('Players');
  6. local RunService = game:GetService('RunService')
  7. local TweenService = game:GetService('TweenService');
  8. local RenderStepped = RunService.RenderStepped;
  9. local LocalPlayer = Players.LocalPlayer;
  10. local Mouse = LocalPlayer:GetMouse();
  11.  
  12. local ProtectGui = protectgui or (syn and syn.protect_gui) or (function() end);
  13.  
  14. local ScreenGui = Instance.new('ScreenGui');
  15. ProtectGui(ScreenGui);
  16.  
  17. ScreenGui.ZIndexBehavior = Enum.ZIndexBehavior.Global;
  18. ScreenGui.Parent = CoreGui;
  19.  
  20. local Toggles = {};
  21. local Options = {};
  22.  
  23. getgenv().Toggles = Toggles;
  24. getgenv().Options = Options;
  25.  
  26. local Library = {
  27. Registry = {};
  28. RegistryMap = {};
  29.  
  30. HudRegistry = {};
  31.  
  32. FontColor = Color3.fromRGB(255, 255, 255);
  33. MainColor = Color3.fromRGB(28, 28, 28);
  34. BackgroundColor = Color3.fromRGB(20, 20, 20);
  35. AccentColor = Color3.fromRGB(0, 85, 255);
  36. OutlineColor = Color3.fromRGB(50, 50, 50);
  37. RiskColor = Color3.fromRGB(255, 50, 50),
  38.  
  39. Black = Color3.new(0, 0, 0);
  40. Font = Enum.Font.Code,
  41.  
  42. OpenedFrames = {};
  43. DependencyBoxes = {};
  44.  
  45. Signals = {};
  46. ScreenGui = ScreenGui;
  47. };
  48.  
  49. local RainbowStep = 0
  50. local Hue = 0
  51.  
  52. table.insert(Library.Signals, RenderStepped:Connect(function(Delta)
  53. RainbowStep = RainbowStep + Delta
  54.  
  55. if RainbowStep >= (1 / 60) then
  56. RainbowStep = 0
  57.  
  58. Hue = Hue + (1 / 400);
  59.  
  60. if Hue > 1 then
  61. Hue = 0;
  62. end;
  63.  
  64. Library.CurrentRainbowHue = Hue;
  65. Library.CurrentRainbowColor = Color3.fromHSV(Hue, 0.8, 1);
  66. end
  67. end))
  68.  
  69. local function GetPlayersString()
  70. local PlayerList = Players:GetPlayers();
  71.  
  72. for i = 1, #PlayerList do
  73. PlayerList[i] = PlayerList[i].Name;
  74. end;
  75.  
  76. table.sort(PlayerList, function(str1, str2) return str1 < str2 end);
  77.  
  78. return PlayerList;
  79. end;
  80.  
  81. local function GetTeamsString()
  82. local TeamList = Teams:GetTeams();
  83.  
  84. for i = 1, #TeamList do
  85. TeamList[i] = TeamList[i].Name;
  86. end;
  87.  
  88. table.sort(TeamList, function(str1, str2) return str1 < str2 end);
  89.  
  90. return TeamList;
  91. end;
  92.  
  93. function Library:SafeCallback(f, ...)
  94. if (not f) then
  95. return;
  96. end;
  97.  
  98. if not Library.NotifyOnError then
  99. return f(...);
  100. end;
  101.  
  102. local success, event = pcall(f, ...);
  103.  
  104. if not success then
  105. local _, i = event:find(":%d+: ");
  106.  
  107. if not i then
  108. return Library:Notify(event);
  109. end;
  110.  
  111. return Library:Notify(event:sub(i + 1), 3);
  112. end;
  113. end;
  114.  
  115. function Library:AttemptSave()
  116. if Library.SaveManager then
  117. Library.SaveManager:Save();
  118. end;
  119. end;
  120.  
  121. function Library:Create(Class, Properties)
  122. local _Instance = Class;
  123.  
  124. if type(Class) == 'string' then
  125. _Instance = Instance.new(Class);
  126. end;
  127.  
  128. for Property, Value in next, Properties do
  129. _Instance[Property] = Value;
  130. end;
  131.  
  132. return _Instance;
  133. end;
  134.  
  135. function Library:ApplyTextStroke(Inst)
  136. Inst.TextStrokeTransparency = 1;
  137.  
  138. Library:Create('UIStroke', {
  139. Color = Color3.new(0, 0, 0);
  140. Thickness = 1;
  141. LineJoinMode = Enum.LineJoinMode.Miter;
  142. Parent = Inst;
  143. });
  144. end;
  145.  
  146. function Library:CreateLabel(Properties, IsHud)
  147. local _Instance = Library:Create('TextLabel', {
  148. BackgroundTransparency = 1;
  149. Font = Library.Font;
  150. TextColor3 = Library.FontColor;
  151. TextSize = 16;
  152. TextStrokeTransparency = 0;
  153. });
  154.  
  155. Library:ApplyTextStroke(_Instance);
  156.  
  157. Library:AddToRegistry(_Instance, {
  158. TextColor3 = 'FontColor';
  159. }, IsHud);
  160.  
  161. return Library:Create(_Instance, Properties);
  162. end;
  163.  
  164. function Library:MakeDraggable(Instance, Cutoff)
  165. Instance.Active = true;
  166.  
  167. Instance.InputBegan:Connect(function(Input)
  168. if Input.UserInputType == Enum.UserInputType.MouseButton1 then
  169. local ObjPos = Vector2.new(
  170. Mouse.X - Instance.AbsolutePosition.X,
  171. Mouse.Y - Instance.AbsolutePosition.Y
  172. );
  173.  
  174. if ObjPos.Y > (Cutoff or 40) then
  175. return;
  176. end;
  177.  
  178. while InputService:IsMouseButtonPressed(Enum.UserInputType.MouseButton1) do
  179. Instance.Position = UDim2.new(
  180. 0,
  181. Mouse.X - ObjPos.X + (Instance.Size.X.Offset * Instance.AnchorPoint.X),
  182. 0,
  183. Mouse.Y - ObjPos.Y + (Instance.Size.Y.Offset * Instance.AnchorPoint.Y)
  184. );
  185.  
  186. RenderStepped:Wait();
  187. end;
  188. end;
  189. end)
  190. end;
  191.  
  192. function Library:AddToolTip(InfoStr, HoverInstance)
  193. local X, Y = Library:GetTextBounds(InfoStr, Library.Font, 14);
  194. local Tooltip = Library:Create('Frame', {
  195. BackgroundColor3 = Library.MainColor,
  196. BorderColor3 = Library.OutlineColor,
  197.  
  198. Size = UDim2.fromOffset(X + 5, Y + 4),
  199. ZIndex = 100,
  200. Parent = Library.ScreenGui,
  201.  
  202. Visible = false,
  203. })
  204.  
  205. local Label = Library:CreateLabel({
  206. Position = UDim2.fromOffset(3, 1),
  207. Size = UDim2.fromOffset(X, Y);
  208. TextSize = 14;
  209. Text = InfoStr,
  210. TextColor3 = Library.FontColor,
  211. TextXAlignment = Enum.TextXAlignment.Left;
  212. ZIndex = Tooltip.ZIndex + 1,
  213.  
  214. Parent = Tooltip;
  215. });
  216.  
  217. Library:AddToRegistry(Tooltip, {
  218. BackgroundColor3 = 'MainColor';
  219. BorderColor3 = 'OutlineColor';
  220. });
  221.  
  222. Library:AddToRegistry(Label, {
  223. TextColor3 = 'FontColor',
  224. });
  225.  
  226. local IsHovering = false
  227.  
  228. HoverInstance.MouseEnter:Connect(function()
  229. if Library:MouseIsOverOpenedFrame() then
  230. return
  231. end
  232.  
  233. IsHovering = true
  234.  
  235. Tooltip.Position = UDim2.fromOffset(Mouse.X + 15, Mouse.Y + 12)
  236. Tooltip.Visible = true
  237.  
  238. while IsHovering do
  239. RunService.Heartbeat:Wait()
  240. Tooltip.Position = UDim2.fromOffset(Mouse.X + 15, Mouse.Y + 12)
  241. end
  242. end)
  243.  
  244. HoverInstance.MouseLeave:Connect(function()
  245. IsHovering = false
  246. Tooltip.Visible = false
  247. end)
  248. end
  249.  
  250. function Library:OnHighlight(HighlightInstance, Instance, Properties, PropertiesDefault)
  251. HighlightInstance.MouseEnter:Connect(function()
  252. local Reg = Library.RegistryMap[Instance];
  253.  
  254. for Property, ColorIdx in next, Properties do
  255. Instance[Property] = Library[ColorIdx] or ColorIdx;
  256.  
  257. if Reg and Reg.Properties[Property] then
  258. Reg.Properties[Property] = ColorIdx;
  259. end;
  260. end;
  261. end)
  262.  
  263. HighlightInstance.MouseLeave:Connect(function()
  264. local Reg = Library.RegistryMap[Instance];
  265.  
  266. for Property, ColorIdx in next, PropertiesDefault do
  267. Instance[Property] = Library[ColorIdx] or ColorIdx;
  268.  
  269. if Reg and Reg.Properties[Property] then
  270. Reg.Properties[Property] = ColorIdx;
  271. end;
  272. end;
  273. end)
  274. end;
  275.  
  276. function Library:MouseIsOverOpenedFrame()
  277. for Frame, _ in next, Library.OpenedFrames do
  278. local AbsPos, AbsSize = Frame.AbsolutePosition, Frame.AbsoluteSize;
  279.  
  280. if Mouse.X >= AbsPos.X and Mouse.X <= AbsPos.X + AbsSize.X
  281. and Mouse.Y >= AbsPos.Y and Mouse.Y <= AbsPos.Y + AbsSize.Y then
  282.  
  283. return true;
  284. end;
  285. end;
  286. end;
  287.  
  288. function Library:IsMouseOverFrame(Frame)
  289. local AbsPos, AbsSize = Frame.AbsolutePosition, Frame.AbsoluteSize;
  290.  
  291. if Mouse.X >= AbsPos.X and Mouse.X <= AbsPos.X + AbsSize.X
  292. and Mouse.Y >= AbsPos.Y and Mouse.Y <= AbsPos.Y + AbsSize.Y then
  293.  
  294. return true;
  295. end;
  296. end;
  297.  
  298. function Library:UpdateDependencyBoxes()
  299. for _, Depbox in next, Library.DependencyBoxes do
  300. Depbox:Update();
  301. end;
  302. end;
  303.  
  304. function Library:MapValue(Value, MinA, MaxA, MinB, MaxB)
  305. return (1 - ((Value - MinA) / (MaxA - MinA))) * MinB + ((Value - MinA) / (MaxA - MinA)) * MaxB;
  306. end;
  307.  
  308. function Library:GetTextBounds(Text, Font, Size, Resolution)
  309. local Bounds = TextService:GetTextSize(Text, Size, Font, Resolution or Vector2.new(1920, 1080))
  310. return Bounds.X, Bounds.Y
  311. end;
  312.  
  313. function Library:GetDarkerColor(Color)
  314. local H, S, V = Color3.toHSV(Color);
  315. return Color3.fromHSV(H, S, V / 1.5);
  316. end;
  317. Library.AccentColorDark = Library:GetDarkerColor(Library.AccentColor);
  318.  
  319. function Library:AddToRegistry(Instance, Properties, IsHud)
  320. local Idx = #Library.Registry + 1;
  321. local Data = {
  322. Instance = Instance;
  323. Properties = Properties;
  324. Idx = Idx;
  325. };
  326.  
  327. table.insert(Library.Registry, Data);
  328. Library.RegistryMap[Instance] = Data;
  329.  
  330. if IsHud then
  331. table.insert(Library.HudRegistry, Data);
  332. end;
  333. end;
  334.  
  335. function Library:RemoveFromRegistry(Instance)
  336. local Data = Library.RegistryMap[Instance];
  337.  
  338. if Data then
  339. for Idx = #Library.Registry, 1, -1 do
  340. if Library.Registry[Idx] == Data then
  341. table.remove(Library.Registry, Idx);
  342. end;
  343. end;
  344.  
  345. for Idx = #Library.HudRegistry, 1, -1 do
  346. if Library.HudRegistry[Idx] == Data then
  347. table.remove(Library.HudRegistry, Idx);
  348. end;
  349. end;
  350.  
  351. Library.RegistryMap[Instance] = nil;
  352. end;
  353. end;
  354.  
  355. function Library:UpdateColorsUsingRegistry()
  356. -- TODO: Could have an 'active' list of objects
  357. -- where the active list only contains Visible objects.
  358.  
  359. -- IMPL: Could setup .Changed events on the AddToRegistry function
  360. -- that listens for the 'Visible' propert being changed.
  361. -- Visible: true => Add to active list, and call UpdateColors function
  362. -- Visible: false => Remove from active list.
  363.  
  364. -- The above would be especially efficient for a rainbow menu color or live color-changing.
  365.  
  366. for Idx, Object in next, Library.Registry do
  367. for Property, ColorIdx in next, Object.Properties do
  368. if type(ColorIdx) == 'string' then
  369. Object.Instance[Property] = Library[ColorIdx];
  370. elseif type(ColorIdx) == 'function' then
  371. Object.Instance[Property] = ColorIdx()
  372. end
  373. end;
  374. end;
  375. end;
  376.  
  377. function Library:GiveSignal(Signal)
  378. -- Only used for signals not attached to library instances, as those should be cleaned up on object destruction by Roblox
  379. table.insert(Library.Signals, Signal)
  380. end
  381.  
  382. function Library:Unload()
  383. -- Unload all of the signals
  384. for Idx = #Library.Signals, 1, -1 do
  385. local Connection = table.remove(Library.Signals, Idx)
  386. Connection:Disconnect()
  387. end
  388.  
  389. -- Call our unload callback, maybe to undo some hooks etc
  390. if Library.OnUnload then
  391. Library.OnUnload()
  392. end
  393.  
  394. ScreenGui:Destroy()
  395. end
  396.  
  397. function Library:OnUnload(Callback)
  398. Library.OnUnload = Callback
  399. end
  400.  
  401. Library:GiveSignal(ScreenGui.DescendantRemoving:Connect(function(Instance)
  402. if Library.RegistryMap[Instance] then
  403. Library:RemoveFromRegistry(Instance);
  404. end;
  405. end))
  406.  
  407. local BaseAddons = {};
  408.  
  409. do
  410. local Funcs = {};
  411.  
  412. function Funcs:AddColorPicker(Idx, Info)
  413. local ToggleLabel = self.TextLabel;
  414. -- local Container = self.Container;
  415.  
  416. assert(Info.Default, 'AddColorPicker: Missing default value.');
  417.  
  418. local ColorPicker = {
  419. Value = Info.Default;
  420. Transparency = Info.Transparency or 0;
  421. Type = 'ColorPicker';
  422. Title = type(Info.Title) == 'string' and Info.Title or 'Color picker',
  423. Callback = Info.Callback or function(Color) end;
  424. };
  425.  
  426. function ColorPicker:SetHSVFromRGB(Color)
  427. local H, S, V = Color3.toHSV(Color);
  428.  
  429. ColorPicker.Hue = H;
  430. ColorPicker.Sat = S;
  431. ColorPicker.Vib = V;
  432. end;
  433.  
  434. ColorPicker:SetHSVFromRGB(ColorPicker.Value);
  435.  
  436. local DisplayFrame = Library:Create('Frame', {
  437. BackgroundColor3 = ColorPicker.Value;
  438. BorderColor3 = Library:GetDarkerColor(ColorPicker.Value);
  439. BorderMode = Enum.BorderMode.Inset;
  440. Size = UDim2.new(0, 28, 0, 14);
  441. ZIndex = 6;
  442. Parent = ToggleLabel;
  443. });
  444.  
  445. -- Transparency image taken from https://github.com/matas3535/SplixPrivateDrawingLibrary/blob/main/Library.lua cus i'm lazy
  446. local CheckerFrame = Library:Create('ImageLabel', {
  447. BorderSizePixel = 0;
  448. Size = UDim2.new(0, 27, 0, 13);
  449. ZIndex = 5;
  450. Image = 'http://www.roblox.com/asset/?id=12977615774';
  451. Visible = not not Info.Transparency;
  452. Parent = DisplayFrame;
  453. });
  454.  
  455. -- 1/16/23
  456. -- Rewrote this to be placed inside the Library ScreenGui
  457. -- There was some issue which caused RelativeOffset to be way off
  458. -- Thus the color picker would never show
  459.  
  460. local PickerFrameOuter = Library:Create('Frame', {
  461. Name = 'Color';
  462. BackgroundColor3 = Color3.new(1, 1, 1);
  463. BorderColor3 = Color3.new(0, 0, 0);
  464. Position = UDim2.fromOffset(DisplayFrame.AbsolutePosition.X, DisplayFrame.AbsolutePosition.Y + 18),
  465. Size = UDim2.fromOffset(230, Info.Transparency and 271 or 253);
  466. Visible = false;
  467. ZIndex = 15;
  468. Parent = ScreenGui,
  469. });
  470.  
  471. DisplayFrame:GetPropertyChangedSignal('AbsolutePosition'):Connect(function()
  472. PickerFrameOuter.Position = UDim2.fromOffset(DisplayFrame.AbsolutePosition.X, DisplayFrame.AbsolutePosition.Y + 18);
  473. end)
  474.  
  475. local PickerFrameInner = Library:Create('Frame', {
  476. BackgroundColor3 = Library.BackgroundColor;
  477. BorderColor3 = Library.OutlineColor;
  478. BorderMode = Enum.BorderMode.Inset;
  479. Size = UDim2.new(1, 0, 1, 0);
  480. ZIndex = 16;
  481. Parent = PickerFrameOuter;
  482. });
  483.  
  484. local Highlight = Library:Create('Frame', {
  485. BackgroundColor3 = Library.AccentColor;
  486. BorderSizePixel = 0;
  487. Size = UDim2.new(1, 0, 0, 2);
  488. ZIndex = 17;
  489. Parent = PickerFrameInner;
  490. });
  491.  
  492. local SatVibMapOuter = Library:Create('Frame', {
  493. BorderColor3 = Color3.new(0, 0, 0);
  494. Position = UDim2.new(0, 4, 0, 25);
  495. Size = UDim2.new(0, 200, 0, 200);
  496. ZIndex = 17;
  497. Parent = PickerFrameInner;
  498. });
  499.  
  500. local SatVibMapInner = Library:Create('Frame', {
  501. BackgroundColor3 = Library.BackgroundColor;
  502. BorderColor3 = Library.OutlineColor;
  503. BorderMode = Enum.BorderMode.Inset;
  504. Size = UDim2.new(1, 0, 1, 0);
  505. ZIndex = 18;
  506. Parent = SatVibMapOuter;
  507. });
  508.  
  509. local SatVibMap = Library:Create('ImageLabel', {
  510. BorderSizePixel = 0;
  511. Size = UDim2.new(1, 0, 1, 0);
  512. ZIndex = 18;
  513. Image = 'rbxassetid://4155801252';
  514. Parent = SatVibMapInner;
  515. });
  516.  
  517. local CursorOuter = Library:Create('ImageLabel', {
  518. AnchorPoint = Vector2.new(0.5, 0.5);
  519. Size = UDim2.new(0, 6, 0, 6);
  520. BackgroundTransparency = 1;
  521. Image = 'http://www.roblox.com/asset/?id=9619665977';
  522. ImageColor3 = Color3.new(0, 0, 0);
  523. ZIndex = 19;
  524. Parent = SatVibMap;
  525. });
  526.  
  527. local CursorInner = Library:Create('ImageLabel', {
  528. Size = UDim2.new(0, CursorOuter.Size.X.Offset - 2, 0, CursorOuter.Size.Y.Offset - 2);
  529. Position = UDim2.new(0, 1, 0, 1);
  530. BackgroundTransparency = 1;
  531. Image = 'http://www.roblox.com/asset/?id=9619665977';
  532. ZIndex = 20;
  533. Parent = CursorOuter;
  534. })
  535.  
  536. local HueSelectorOuter = Library:Create('Frame', {
  537. BorderColor3 = Color3.new(0, 0, 0);
  538. Position = UDim2.new(0, 208, 0, 25);
  539. Size = UDim2.new(0, 15, 0, 200);
  540. ZIndex = 17;
  541. Parent = PickerFrameInner;
  542. });
  543.  
  544. local HueSelectorInner = Library:Create('Frame', {
  545. BackgroundColor3 = Color3.new(1, 1, 1);
  546. BorderSizePixel = 0;
  547. Size = UDim2.new(1, 0, 1, 0);
  548. ZIndex = 18;
  549. Parent = HueSelectorOuter;
  550. });
  551.  
  552. local HueCursor = Library:Create('Frame', {
  553. BackgroundColor3 = Color3.new(1, 1, 1);
  554. AnchorPoint = Vector2.new(0, 0.5);
  555. BorderColor3 = Color3.new(0, 0, 0);
  556. Size = UDim2.new(1, 0, 0, 1);
  557. ZIndex = 18;
  558. Parent = HueSelectorInner;
  559. });
  560.  
  561. local HueBoxOuter = Library:Create('Frame', {
  562. BorderColor3 = Color3.new(0, 0, 0);
  563. Position = UDim2.fromOffset(4, 228),
  564. Size = UDim2.new(0.5, -6, 0, 20),
  565. ZIndex = 18,
  566. Parent = PickerFrameInner;
  567. });
  568.  
  569. local HueBoxInner = Library:Create('Frame', {
  570. BackgroundColor3 = Library.MainColor;
  571. BorderColor3 = Library.OutlineColor;
  572. BorderMode = Enum.BorderMode.Inset;
  573. Size = UDim2.new(1, 0, 1, 0);
  574. ZIndex = 18,
  575. Parent = HueBoxOuter;
  576. });
  577.  
  578. Library:Create('UIGradient', {
  579. Color = ColorSequence.new({
  580. ColorSequenceKeypoint.new(0, Color3.new(1, 1, 1)),
  581. ColorSequenceKeypoint.new(1, Color3.fromRGB(212, 212, 212))
  582. });
  583. Rotation = 90;
  584. Parent = HueBoxInner;
  585. });
  586.  
  587. local HueBox = Library:Create('TextBox', {
  588. BackgroundTransparency = 1;
  589. Position = UDim2.new(0, 5, 0, 0);
  590. Size = UDim2.new(1, -5, 1, 0);
  591. Font = Library.Font;
  592. PlaceholderColor3 = Color3.fromRGB(190, 190, 190);
  593. PlaceholderText = 'Hex color',
  594. Text = '#FFFFFF',
  595. TextColor3 = Library.FontColor;
  596. TextSize = 14;
  597. TextStrokeTransparency = 0;
  598. TextXAlignment = Enum.TextXAlignment.Left;
  599. ZIndex = 20,
  600. Parent = HueBoxInner;
  601. });
  602.  
  603. Library:ApplyTextStroke(HueBox);
  604.  
  605. local RgbBoxBase = Library:Create(HueBoxOuter:Clone(), {
  606. Position = UDim2.new(0.5, 2, 0, 228),
  607. Size = UDim2.new(0.5, -6, 0, 20),
  608. Parent = PickerFrameInner
  609. });
  610.  
  611. local RgbBox = Library:Create(RgbBoxBase.Frame:FindFirstChild('TextBox'), {
  612. Text = '255, 255, 255',
  613. PlaceholderText = 'RGB color',
  614. TextColor3 = Library.FontColor
  615. });
  616.  
  617. local TransparencyBoxOuter, TransparencyBoxInner, TransparencyCursor;
  618.  
  619. if Info.Transparency then
  620. TransparencyBoxOuter = Library:Create('Frame', {
  621. BorderColor3 = Color3.new(0, 0, 0);
  622. Position = UDim2.fromOffset(4, 251);
  623. Size = UDim2.new(1, -8, 0, 15);
  624. ZIndex = 19;
  625. Parent = PickerFrameInner;
  626. });
  627.  
  628. TransparencyBoxInner = Library:Create('Frame', {
  629. BackgroundColor3 = ColorPicker.Value;
  630. BorderColor3 = Library.OutlineColor;
  631. BorderMode = Enum.BorderMode.Inset;
  632. Size = UDim2.new(1, 0, 1, 0);
  633. ZIndex = 19;
  634. Parent = TransparencyBoxOuter;
  635. });
  636.  
  637. Library:AddToRegistry(TransparencyBoxInner, { BorderColor3 = 'OutlineColor' });
  638.  
  639. Library:Create('ImageLabel', {
  640. BackgroundTransparency = 1;
  641. Size = UDim2.new(1, 0, 1, 0);
  642. Image = 'http://www.roblox.com/asset/?id=12978095818';
  643. ZIndex = 20;
  644. Parent = TransparencyBoxInner;
  645. });
  646.  
  647. TransparencyCursor = Library:Create('Frame', {
  648. BackgroundColor3 = Color3.new(1, 1, 1);
  649. AnchorPoint = Vector2.new(0.5, 0);
  650. BorderColor3 = Color3.new(0, 0, 0);
  651. Size = UDim2.new(0, 1, 1, 0);
  652. ZIndex = 21;
  653. Parent = TransparencyBoxInner;
  654. });
  655. end;
  656.  
  657. local DisplayLabel = Library:CreateLabel({
  658. Size = UDim2.new(1, 0, 0, 14);
  659. Position = UDim2.fromOffset(5, 5);
  660. TextXAlignment = Enum.TextXAlignment.Left;
  661. TextSize = 14;
  662. Text = ColorPicker.Title,--Info.Default;
  663. TextWrapped = false;
  664. ZIndex = 16;
  665. Parent = PickerFrameInner;
  666. });
  667.  
  668.  
  669. local ContextMenu = {}
  670. do
  671. ContextMenu.Options = {}
  672. ContextMenu.Container = Library:Create('Frame', {
  673. BorderColor3 = Color3.new(),
  674. ZIndex = 14,
  675.  
  676. Visible = false,
  677. Parent = ScreenGui
  678. })
  679.  
  680. ContextMenu.Inner = Library:Create('Frame', {
  681. BackgroundColor3 = Library.BackgroundColor;
  682. BorderColor3 = Library.OutlineColor;
  683. BorderMode = Enum.BorderMode.Inset;
  684. Size = UDim2.fromScale(1, 1);
  685. ZIndex = 15;
  686. Parent = ContextMenu.Container;
  687. });
  688.  
  689. Library:Create('UIListLayout', {
  690. Name = 'Layout',
  691. FillDirection = Enum.FillDirection.Vertical;
  692. SortOrder = Enum.SortOrder.LayoutOrder;
  693. Parent = ContextMenu.Inner;
  694. });
  695.  
  696. Library:Create('UIPadding', {
  697. Name = 'Padding',
  698. PaddingLeft = UDim.new(0, 4),
  699. Parent = ContextMenu.Inner,
  700. });
  701.  
  702. local function updateMenuPosition()
  703. ContextMenu.Container.Position = UDim2.fromOffset(
  704. (DisplayFrame.AbsolutePosition.X + DisplayFrame.AbsoluteSize.X) + 4,
  705. DisplayFrame.AbsolutePosition.Y + 1
  706. )
  707. end
  708.  
  709. local function updateMenuSize()
  710. local menuWidth = 60
  711. for i, label in next, ContextMenu.Inner:GetChildren() do
  712. if label:IsA('TextLabel') then
  713. menuWidth = math.max(menuWidth, label.TextBounds.X)
  714. end
  715. end
  716.  
  717. ContextMenu.Container.Size = UDim2.fromOffset(
  718. menuWidth + 8,
  719. ContextMenu.Inner.Layout.AbsoluteContentSize.Y + 4
  720. )
  721. end
  722.  
  723. DisplayFrame:GetPropertyChangedSignal('AbsolutePosition'):Connect(updateMenuPosition)
  724. ContextMenu.Inner.Layout:GetPropertyChangedSignal('AbsoluteContentSize'):Connect(updateMenuSize)
  725.  
  726. task.spawn(updateMenuPosition)
  727. task.spawn(updateMenuSize)
  728.  
  729. Library:AddToRegistry(ContextMenu.Inner, {
  730. BackgroundColor3 = 'BackgroundColor';
  731. BorderColor3 = 'OutlineColor';
  732. });
  733.  
  734. function ContextMenu:Show()
  735. self.Container.Visible = true
  736. end
  737.  
  738. function ContextMenu:Hide()
  739. self.Container.Visible = false
  740. end
  741.  
  742. function ContextMenu:AddOption(Str, Callback)
  743. if type(Callback) ~= 'function' then
  744. Callback = function() end
  745. end
  746.  
  747. local Button = Library:CreateLabel({
  748. Active = false;
  749. Size = UDim2.new(1, 0, 0, 15);
  750. TextSize = 13;
  751. Text = Str;
  752. ZIndex = 16;
  753. Parent = self.Inner;
  754. TextXAlignment = Enum.TextXAlignment.Left,
  755. });
  756.  
  757. Library:OnHighlight(Button, Button,
  758. { TextColor3 = 'AccentColor' },
  759. { TextColor3 = 'FontColor' }
  760. );
  761.  
  762. Button.InputBegan:Connect(function(Input)
  763. if Input.UserInputType ~= Enum.UserInputType.MouseButton1 then
  764. return
  765. end
  766.  
  767. Callback()
  768. end)
  769. end
  770.  
  771. ContextMenu:AddOption('Copy color', function()
  772. Library.ColorClipboard = ColorPicker.Value
  773. Library:Notify('Copied color!', 2)
  774. end)
  775.  
  776. ContextMenu:AddOption('Paste color', function()
  777. if not Library.ColorClipboard then
  778. return Library:Notify('You have not copied a color!', 2)
  779. end
  780. ColorPicker:SetValueRGB(Library.ColorClipboard)
  781. end)
  782.  
  783.  
  784. ContextMenu:AddOption('Copy HEX', function()
  785. pcall(setclipboard, ColorPicker.Value:ToHex())
  786. Library:Notify('Copied hex code to clipboard!', 2)
  787. end)
  788.  
  789. ContextMenu:AddOption('Copy RGB', function()
  790. pcall(setclipboard, table.concat({ math.floor(ColorPicker.Value.R * 255), math.floor(ColorPicker.Value.G * 255), math.floor(ColorPicker.Value.B * 255) }, ', '))
  791. Library:Notify('Copied RGB values to clipboard!', 2)
  792. end)
  793.  
  794. end
  795.  
  796. Library:AddToRegistry(PickerFrameInner, { BackgroundColor3 = 'BackgroundColor'; BorderColor3 = 'OutlineColor'; });
  797. Library:AddToRegistry(Highlight, { BackgroundColor3 = 'AccentColor'; });
  798. Library:AddToRegistry(SatVibMapInner, { BackgroundColor3 = 'BackgroundColor'; BorderColor3 = 'OutlineColor'; });
  799.  
  800. Library:AddToRegistry(HueBoxInner, { BackgroundColor3 = 'MainColor'; BorderColor3 = 'OutlineColor'; });
  801. Library:AddToRegistry(RgbBoxBase.Frame, { BackgroundColor3 = 'MainColor'; BorderColor3 = 'OutlineColor'; });
  802. Library:AddToRegistry(RgbBox, { TextColor3 = 'FontColor', });
  803. Library:AddToRegistry(HueBox, { TextColor3 = 'FontColor', });
  804.  
  805. local SequenceTable = {};
  806.  
  807. for Hue = 0, 1, 0.1 do
  808. table.insert(SequenceTable, ColorSequenceKeypoint.new(Hue, Color3.fromHSV(Hue, 1, 1)));
  809. end;
  810.  
  811. local HueSelectorGradient = Library:Create('UIGradient', {
  812. Color = ColorSequence.new(SequenceTable);
  813. Rotation = 90;
  814. Parent = HueSelectorInner;
  815. });
  816.  
  817. HueBox.FocusLost:Connect(function(enter)
  818. if enter then
  819. local success, result = pcall(Color3.fromHex, HueBox.Text)
  820. if success and typeof(result) == 'Color3' then
  821. ColorPicker.Hue, ColorPicker.Sat, ColorPicker.Vib = Color3.toHSV(result)
  822. end
  823. end
  824.  
  825. ColorPicker:Display()
  826. end)
  827.  
  828. RgbBox.FocusLost:Connect(function(enter)
  829. if enter then
  830. local r, g, b = RgbBox.Text:match('(%d+),%s*(%d+),%s*(%d+)')
  831. if r and g and b then
  832. ColorPicker.Hue, ColorPicker.Sat, ColorPicker.Vib = Color3.toHSV(Color3.fromRGB(r, g, b))
  833. end
  834. end
  835.  
  836. ColorPicker:Display()
  837. end)
  838.  
  839. function ColorPicker:Display()
  840. ColorPicker.Value = Color3.fromHSV(ColorPicker.Hue, ColorPicker.Sat, ColorPicker.Vib);
  841. SatVibMap.BackgroundColor3 = Color3.fromHSV(ColorPicker.Hue, 1, 1);
  842.  
  843. Library:Create(DisplayFrame, {
  844. BackgroundColor3 = ColorPicker.Value;
  845. BackgroundTransparency = ColorPicker.Transparency;
  846. BorderColor3 = Library:GetDarkerColor(ColorPicker.Value);
  847. });
  848.  
  849. if TransparencyBoxInner then
  850. TransparencyBoxInner.BackgroundColor3 = ColorPicker.Value;
  851. TransparencyCursor.Position = UDim2.new(1 - ColorPicker.Transparency, 0, 0, 0);
  852. end;
  853.  
  854. CursorOuter.Position = UDim2.new(ColorPicker.Sat, 0, 1 - ColorPicker.Vib, 0);
  855. HueCursor.Position = UDim2.new(0, 0, ColorPicker.Hue, 0);
  856.  
  857. HueBox.Text = '#' .. ColorPicker.Value:ToHex()
  858. RgbBox.Text = table.concat({ math.floor(ColorPicker.Value.R * 255), math.floor(ColorPicker.Value.G * 255), math.floor(ColorPicker.Value.B * 255) }, ', ')
  859.  
  860. Library:SafeCallback(ColorPicker.Callback, ColorPicker.Value);
  861. Library:SafeCallback(ColorPicker.Changed, ColorPicker.Value);
  862. end;
  863.  
  864. function ColorPicker:OnChanged(Func)
  865. ColorPicker.Changed = Func;
  866. Func(ColorPicker.Value)
  867. end;
  868.  
  869. function ColorPicker:Show()
  870. for Frame, Val in next, Library.OpenedFrames do
  871. if Frame.Name == 'Color' then
  872. Frame.Visible = false;
  873. Library.OpenedFrames[Frame] = nil;
  874. end;
  875. end;
  876.  
  877. PickerFrameOuter.Visible = true;
  878. Library.OpenedFrames[PickerFrameOuter] = true;
  879. end;
  880.  
  881. function ColorPicker:Hide()
  882. PickerFrameOuter.Visible = false;
  883. Library.OpenedFrames[PickerFrameOuter] = nil;
  884. end;
  885.  
  886. function ColorPicker:SetValue(HSV, Transparency)
  887. local Color = Color3.fromHSV(HSV[1], HSV[2], HSV[3]);
  888.  
  889. ColorPicker.Transparency = Transparency or 0;
  890. ColorPicker:SetHSVFromRGB(Color);
  891. ColorPicker:Display();
  892. end;
  893.  
  894. function ColorPicker:SetValueRGB(Color, Transparency)
  895. ColorPicker.Transparency = Transparency or 0;
  896. ColorPicker:SetHSVFromRGB(Color);
  897. ColorPicker:Display();
  898. end;
  899.  
  900. SatVibMap.InputBegan:Connect(function(Input)
  901. if Input.UserInputType == Enum.UserInputType.MouseButton1 then
  902. while InputService:IsMouseButtonPressed(Enum.UserInputType.MouseButton1) do
  903. local MinX = SatVibMap.AbsolutePosition.X;
  904. local MaxX = MinX + SatVibMap.AbsoluteSize.X;
  905. local MouseX = math.clamp(Mouse.X, MinX, MaxX);
  906.  
  907. local MinY = SatVibMap.AbsolutePosition.Y;
  908. local MaxY = MinY + SatVibMap.AbsoluteSize.Y;
  909. local MouseY = math.clamp(Mouse.Y, MinY, MaxY);
  910.  
  911. ColorPicker.Sat = (MouseX - MinX) / (MaxX - MinX);
  912. ColorPicker.Vib = 1 - ((MouseY - MinY) / (MaxY - MinY));
  913. ColorPicker:Display();
  914.  
  915. RenderStepped:Wait();
  916. end;
  917.  
  918. Library:AttemptSave();
  919. end;
  920. end);
  921.  
  922. HueSelectorInner.InputBegan:Connect(function(Input)
  923. if Input.UserInputType == Enum.UserInputType.MouseButton1 then
  924. while InputService:IsMouseButtonPressed(Enum.UserInputType.MouseButton1) do
  925. local MinY = HueSelectorInner.AbsolutePosition.Y;
  926. local MaxY = MinY + HueSelectorInner.AbsoluteSize.Y;
  927. local MouseY = math.clamp(Mouse.Y, MinY, MaxY);
  928.  
  929. ColorPicker.Hue = ((MouseY - MinY) / (MaxY - MinY));
  930. ColorPicker:Display();
  931.  
  932. RenderStepped:Wait();
  933. end;
  934.  
  935. Library:AttemptSave();
  936. end;
  937. end);
  938.  
  939. DisplayFrame.InputBegan:Connect(function(Input)
  940. if Input.UserInputType == Enum.UserInputType.MouseButton1 and not Library:MouseIsOverOpenedFrame() then
  941. if PickerFrameOuter.Visible then
  942. ColorPicker:Hide()
  943. else
  944. ContextMenu:Hide()
  945. ColorPicker:Show()
  946. end;
  947. elseif Input.UserInputType == Enum.UserInputType.MouseButton2 and not Library:MouseIsOverOpenedFrame() then
  948. ContextMenu:Show()
  949. ColorPicker:Hide()
  950. end
  951. end);
  952.  
  953. if TransparencyBoxInner then
  954. TransparencyBoxInner.InputBegan:Connect(function(Input)
  955. if Input.UserInputType == Enum.UserInputType.MouseButton1 then
  956. while InputService:IsMouseButtonPressed(Enum.UserInputType.MouseButton1) do
  957. local MinX = TransparencyBoxInner.AbsolutePosition.X;
  958. local MaxX = MinX + TransparencyBoxInner.AbsoluteSize.X;
  959. local MouseX = math.clamp(Mouse.X, MinX, MaxX);
  960.  
  961. ColorPicker.Transparency = 1 - ((MouseX - MinX) / (MaxX - MinX));
  962.  
  963. ColorPicker:Display();
  964.  
  965. RenderStepped:Wait();
  966. end;
  967.  
  968. Library:AttemptSave();
  969. end;
  970. end);
  971. end;
  972.  
  973. Library:GiveSignal(InputService.InputBegan:Connect(function(Input)
  974. if Input.UserInputType == Enum.UserInputType.MouseButton1 then
  975. local AbsPos, AbsSize = PickerFrameOuter.AbsolutePosition, PickerFrameOuter.AbsoluteSize;
  976.  
  977. if Mouse.X < AbsPos.X or Mouse.X > AbsPos.X + AbsSize.X
  978. or Mouse.Y < (AbsPos.Y - 20 - 1) or Mouse.Y > AbsPos.Y + AbsSize.Y then
  979.  
  980. ColorPicker:Hide();
  981. end;
  982.  
  983. if not Library:IsMouseOverFrame(ContextMenu.Container) then
  984. ContextMenu:Hide()
  985. end
  986. end;
  987.  
  988. if Input.UserInputType == Enum.UserInputType.MouseButton2 and ContextMenu.Container.Visible then
  989. if not Library:IsMouseOverFrame(ContextMenu.Container) and not Library:IsMouseOverFrame(DisplayFrame) then
  990. ContextMenu:Hide()
  991. end
  992. end
  993. end))
  994.  
  995. ColorPicker:Display();
  996. ColorPicker.DisplayFrame = DisplayFrame
  997.  
  998. Options[Idx] = ColorPicker;
  999.  
  1000. return self;
  1001. end;
  1002.  
  1003. function Funcs:AddKeyPicker(Idx, Info)
  1004. local ParentObj = self;
  1005. local ToggleLabel = self.TextLabel;
  1006. local Container = self.Container;
  1007.  
  1008. assert(Info.Default, 'AddKeyPicker: Missing default value.');
  1009.  
  1010. local KeyPicker = {
  1011. Value = Info.Default;
  1012. Toggled = false;
  1013. Mode = Info.Mode or 'Toggle'; -- Always, Toggle, Hold
  1014. Type = 'KeyPicker';
  1015. Callback = Info.Callback or function(Value) end;
  1016. ChangedCallback = Info.ChangedCallback or function(New) end;
  1017.  
  1018. SyncToggleState = Info.SyncToggleState or false;
  1019. };
  1020.  
  1021. if KeyPicker.SyncToggleState then
  1022. Info.Modes = { 'Toggle' }
  1023. Info.Mode = 'Toggle'
  1024. end
  1025.  
  1026. local PickOuter = Library:Create('Frame', {
  1027. BackgroundColor3 = Color3.new(0, 0, 0);
  1028. BorderColor3 = Color3.new(0, 0, 0);
  1029. Size = UDim2.new(0, 28, 0, 15);
  1030. ZIndex = 6;
  1031. Parent = ToggleLabel;
  1032. });
  1033.  
  1034. local PickInner = Library:Create('Frame', {
  1035. BackgroundColor3 = Library.BackgroundColor;
  1036. BorderColor3 = Library.OutlineColor;
  1037. BorderMode = Enum.BorderMode.Inset;
  1038. Size = UDim2.new(1, 0, 1, 0);
  1039. ZIndex = 7;
  1040. Parent = PickOuter;
  1041. });
  1042.  
  1043. Library:AddToRegistry(PickInner, {
  1044. BackgroundColor3 = 'BackgroundColor';
  1045. BorderColor3 = 'OutlineColor';
  1046. });
  1047.  
  1048. local DisplayLabel = Library:CreateLabel({
  1049. Size = UDim2.new(1, 0, 1, 0);
  1050. TextSize = 13;
  1051. Text = Info.Default;
  1052. TextWrapped = true;
  1053. ZIndex = 8;
  1054. Parent = PickInner;
  1055. });
  1056.  
  1057. local ModeSelectOuter = Library:Create('Frame', {
  1058. BorderColor3 = Color3.new(0, 0, 0);
  1059. Position = UDim2.fromOffset(ToggleLabel.AbsolutePosition.X + ToggleLabel.AbsoluteSize.X + 4, ToggleLabel.AbsolutePosition.Y + 1);
  1060. Size = UDim2.new(0, 60, 0, 45 + 2);
  1061. Visible = false;
  1062. ZIndex = 14;
  1063. Parent = ScreenGui;
  1064. });
  1065.  
  1066. ToggleLabel:GetPropertyChangedSignal('AbsolutePosition'):Connect(function()
  1067. ModeSelectOuter.Position = UDim2.fromOffset(ToggleLabel.AbsolutePosition.X + ToggleLabel.AbsoluteSize.X + 4, ToggleLabel.AbsolutePosition.Y + 1);
  1068. end);
  1069.  
  1070. local ModeSelectInner = Library:Create('Frame', {
  1071. BackgroundColor3 = Library.BackgroundColor;
  1072. BorderColor3 = Library.OutlineColor;
  1073. BorderMode = Enum.BorderMode.Inset;
  1074. Size = UDim2.new(1, 0, 1, 0);
  1075. ZIndex = 15;
  1076. Parent = ModeSelectOuter;
  1077. });
  1078.  
  1079. Library:AddToRegistry(ModeSelectInner, {
  1080. BackgroundColor3 = 'BackgroundColor';
  1081. BorderColor3 = 'OutlineColor';
  1082. });
  1083.  
  1084. Library:Create('UIListLayout', {
  1085. FillDirection = Enum.FillDirection.Vertical;
  1086. SortOrder = Enum.SortOrder.LayoutOrder;
  1087. Parent = ModeSelectInner;
  1088. });
  1089.  
  1090. local ContainerLabel = Library:CreateLabel({
  1091. TextXAlignment = Enum.TextXAlignment.Left;
  1092. Size = UDim2.new(1, 0, 0, 18);
  1093. TextSize = 13;
  1094. Visible = false;
  1095. ZIndex = 110;
  1096. Parent = Library.KeybindContainer;
  1097. }, true);
  1098.  
  1099. local Modes = Info.Modes or { 'Always', 'Toggle', 'Hold' };
  1100. local ModeButtons = {};
  1101.  
  1102. for Idx, Mode in next, Modes do
  1103. local ModeButton = {};
  1104.  
  1105. local Label = Library:CreateLabel({
  1106. Active = false;
  1107. Size = UDim2.new(1, 0, 0, 15);
  1108. TextSize = 13;
  1109. Text = Mode;
  1110. ZIndex = 16;
  1111. Parent = ModeSelectInner;
  1112. });
  1113.  
  1114. function ModeButton:Select()
  1115. for _, Button in next, ModeButtons do
  1116. Button:Deselect();
  1117. end;
  1118.  
  1119. KeyPicker.Mode = Mode;
  1120.  
  1121. Label.TextColor3 = Library.AccentColor;
  1122. Library.RegistryMap[Label].Properties.TextColor3 = 'AccentColor';
  1123.  
  1124. ModeSelectOuter.Visible = false;
  1125. end;
  1126.  
  1127. function ModeButton:Deselect()
  1128. KeyPicker.Mode = nil;
  1129.  
  1130. Label.TextColor3 = Library.FontColor;
  1131. Library.RegistryMap[Label].Properties.TextColor3 = 'FontColor';
  1132. end;
  1133.  
  1134. Label.InputBegan:Connect(function(Input)
  1135. if Input.UserInputType == Enum.UserInputType.MouseButton1 then
  1136. ModeButton:Select();
  1137. Library:AttemptSave();
  1138. end;
  1139. end);
  1140.  
  1141. if Mode == KeyPicker.Mode then
  1142. ModeButton:Select();
  1143. end;
  1144.  
  1145. ModeButtons[Mode] = ModeButton;
  1146. end;
  1147.  
  1148. function KeyPicker:Update()
  1149. if Info.NoUI then
  1150. return;
  1151. end;
  1152.  
  1153. local State = KeyPicker:GetState();
  1154.  
  1155. ContainerLabel.Text = string.format('[%s] %s (%s)', KeyPicker.Value, Info.Text, KeyPicker.Mode);
  1156.  
  1157. ContainerLabel.Visible = true;
  1158. ContainerLabel.TextColor3 = State and Library.AccentColor or Library.FontColor;
  1159.  
  1160. Library.RegistryMap[ContainerLabel].Properties.TextColor3 = State and 'AccentColor' or 'FontColor';
  1161.  
  1162. local YSize = 0
  1163. local XSize = 0
  1164.  
  1165. for _, Label in next, Library.KeybindContainer:GetChildren() do
  1166. if Label:IsA('TextLabel') and Label.Visible then
  1167. YSize = YSize + 18;
  1168. if (Label.TextBounds.X > XSize) then
  1169. XSize = Label.TextBounds.X
  1170. end
  1171. end;
  1172. end;
  1173.  
  1174. Library.KeybindFrame.Size = UDim2.new(0, math.max(XSize + 10, 210), 0, YSize + 23)
  1175. end;
  1176.  
  1177. function KeyPicker:GetState()
  1178. if KeyPicker.Mode == 'Always' then
  1179. return true;
  1180. elseif KeyPicker.Mode == 'Hold' then
  1181. if KeyPicker.Value == 'None' then
  1182. return false;
  1183. end
  1184.  
  1185. local Key = KeyPicker.Value;
  1186.  
  1187. if Key == 'MB1' or Key == 'MB2' then
  1188. return Key == 'MB1' and InputService:IsMouseButtonPressed(Enum.UserInputType.MouseButton1)
  1189. or Key == 'MB2' and InputService:IsMouseButtonPressed(Enum.UserInputType.MouseButton2);
  1190. else
  1191. return InputService:IsKeyDown(Enum.KeyCode[KeyPicker.Value]);
  1192. end;
  1193. else
  1194. return KeyPicker.Toggled;
  1195. end;
  1196. end;
  1197.  
  1198. function KeyPicker:SetValue(Data)
  1199. local Key, Mode = Data[1], Data[2];
  1200. DisplayLabel.Text = Key;
  1201. KeyPicker.Value = Key;
  1202. ModeButtons[Mode]:Select();
  1203. KeyPicker:Update();
  1204. end;
  1205.  
  1206. function KeyPicker:OnClick(Callback)
  1207. KeyPicker.Clicked = Callback
  1208. end
  1209.  
  1210. function KeyPicker:OnChanged(Callback)
  1211. KeyPicker.Changed = Callback
  1212. Callback(KeyPicker.Value)
  1213. end
  1214.  
  1215. if ParentObj.Addons then
  1216. table.insert(ParentObj.Addons, KeyPicker)
  1217. end
  1218.  
  1219. function KeyPicker:DoClick()
  1220. if ParentObj.Type == 'Toggle' and KeyPicker.SyncToggleState then
  1221. ParentObj:SetValue(not ParentObj.Value)
  1222. end
  1223.  
  1224. Library:SafeCallback(KeyPicker.Callback, KeyPicker.Toggled)
  1225. Library:SafeCallback(KeyPicker.Clicked, KeyPicker.Toggled)
  1226. end
  1227.  
  1228. local Picking = false;
  1229.  
  1230. PickOuter.InputBegan:Connect(function(Input)
  1231. if Input.UserInputType == Enum.UserInputType.MouseButton1 and not Library:MouseIsOverOpenedFrame() then
  1232. Picking = true;
  1233.  
  1234. DisplayLabel.Text = '';
  1235.  
  1236. local Break;
  1237. local Text = '';
  1238.  
  1239. task.spawn(function()
  1240. while (not Break) do
  1241. if Text == '...' then
  1242. Text = '';
  1243. end;
  1244.  
  1245. Text = Text .. '.';
  1246. DisplayLabel.Text = Text;
  1247.  
  1248. wait(0.4);
  1249. end;
  1250. end);
  1251.  
  1252. wait(0.2);
  1253.  
  1254. local Event;
  1255. Event = InputService.InputBegan:Connect(function(Input)
  1256. local Key;
  1257.  
  1258. if Input.UserInputType == Enum.UserInputType.Keyboard then
  1259. Key = Input.KeyCode.Name;
  1260. elseif Input.UserInputType == Enum.UserInputType.MouseButton1 then
  1261. Key = 'MB1';
  1262. elseif Input.UserInputType == Enum.UserInputType.MouseButton2 then
  1263. Key = 'MB2';
  1264. end;
  1265.  
  1266. Break = true;
  1267. Picking = false;
  1268.  
  1269. DisplayLabel.Text = Key;
  1270. KeyPicker.Value = Key;
  1271.  
  1272. Library:SafeCallback(KeyPicker.ChangedCallback, Input.KeyCode or Input.UserInputType)
  1273. Library:SafeCallback(KeyPicker.Changed, Input.KeyCode or Input.UserInputType)
  1274.  
  1275. Library:AttemptSave();
  1276.  
  1277. Event:Disconnect();
  1278. end);
  1279. elseif Input.UserInputType == Enum.UserInputType.MouseButton2 and not Library:MouseIsOverOpenedFrame() then
  1280. ModeSelectOuter.Visible = true;
  1281. end;
  1282. end);
  1283.  
  1284. Library:GiveSignal(InputService.InputBegan:Connect(function(Input)
  1285. if (not Picking) then
  1286. if KeyPicker.Mode == 'Toggle' then
  1287. local Key = KeyPicker.Value;
  1288.  
  1289. if Key == 'MB1' or Key == 'MB2' then
  1290. if Key == 'MB1' and Input.UserInputType == Enum.UserInputType.MouseButton1
  1291. or Key == 'MB2' and Input.UserInputType == Enum.UserInputType.MouseButton2 then
  1292. KeyPicker.Toggled = not KeyPicker.Toggled
  1293. KeyPicker:DoClick()
  1294. end;
  1295. elseif Input.UserInputType == Enum.UserInputType.Keyboard then
  1296. if Input.KeyCode.Name == Key then
  1297. KeyPicker.Toggled = not KeyPicker.Toggled;
  1298. KeyPicker:DoClick()
  1299. end;
  1300. end;
  1301. end;
  1302.  
  1303. KeyPicker:Update();
  1304. end;
  1305.  
  1306. if Input.UserInputType == Enum.UserInputType.MouseButton1 then
  1307. local AbsPos, AbsSize = ModeSelectOuter.AbsolutePosition, ModeSelectOuter.AbsoluteSize;
  1308.  
  1309. if Mouse.X < AbsPos.X or Mouse.X > AbsPos.X + AbsSize.X
  1310. or Mouse.Y < (AbsPos.Y - 20 - 1) or Mouse.Y > AbsPos.Y + AbsSize.Y then
  1311.  
  1312. ModeSelectOuter.Visible = false;
  1313. end;
  1314. end;
  1315. end))
  1316.  
  1317. Library:GiveSignal(InputService.InputEnded:Connect(function(Input)
  1318. if (not Picking) then
  1319. KeyPicker:Update();
  1320. end;
  1321. end))
  1322.  
  1323. KeyPicker:Update();
  1324.  
  1325. Options[Idx] = KeyPicker;
  1326.  
  1327. return self;
  1328. end;
  1329.  
  1330. BaseAddons.__index = Funcs;
  1331. BaseAddons.__namecall = function(Table, Key, ...)
  1332. return Funcs[Key](...);
  1333. end;
  1334. end;
  1335.  
  1336. local BaseGroupbox = {};
  1337.  
  1338. do
  1339. local Funcs = {};
  1340.  
  1341. function Funcs:AddBlank(Size)
  1342. local Groupbox = self;
  1343. local Container = Groupbox.Container;
  1344.  
  1345. Library:Create('Frame', {
  1346. BackgroundTransparency = 1;
  1347. Size = UDim2.new(1, 0, 0, Size);
  1348. ZIndex = 1;
  1349. Parent = Container;
  1350. });
  1351. end;
  1352.  
  1353. function Funcs:AddLabel(Text, DoesWrap)
  1354. local Label = {};
  1355.  
  1356. local Groupbox = self;
  1357. local Container = Groupbox.Container;
  1358.  
  1359. local TextLabel = Library:CreateLabel({
  1360. Size = UDim2.new(1, -4, 0, 15);
  1361. TextSize = 14;
  1362. Text = Text;
  1363. TextWrapped = DoesWrap or false,
  1364. TextXAlignment = Enum.TextXAlignment.Left;
  1365. ZIndex = 5;
  1366. Parent = Container;
  1367. });
  1368.  
  1369. if DoesWrap then
  1370. local Y = select(2, Library:GetTextBounds(Text, Library.Font, 14, Vector2.new(TextLabel.AbsoluteSize.X, math.huge)))
  1371. TextLabel.Size = UDim2.new(1, -4, 0, Y)
  1372. else
  1373. Library:Create('UIListLayout', {
  1374. Padding = UDim.new(0, 4);
  1375. FillDirection = Enum.FillDirection.Horizontal;
  1376. HorizontalAlignment = Enum.HorizontalAlignment.Right;
  1377. SortOrder = Enum.SortOrder.LayoutOrder;
  1378. Parent = TextLabel;
  1379. });
  1380. end
  1381.  
  1382. Label.TextLabel = TextLabel;
  1383. Label.Container = Container;
  1384.  
  1385. function Label:SetText(Text)
  1386. TextLabel.Text = Text
  1387.  
  1388. if DoesWrap then
  1389. local Y = select(2, Library:GetTextBounds(Text, Library.Font, 14, Vector2.new(TextLabel.AbsoluteSize.X, math.huge)))
  1390. TextLabel.Size = UDim2.new(1, -4, 0, Y)
  1391. end
  1392.  
  1393. Groupbox:Resize();
  1394. end
  1395.  
  1396. if (not DoesWrap) then
  1397. setmetatable(Label, BaseAddons);
  1398. end
  1399.  
  1400. Groupbox:AddBlank(5);
  1401. Groupbox:Resize();
  1402.  
  1403. return Label;
  1404. end;
  1405.  
  1406. function Funcs:AddButton(...)
  1407. -- TODO: Eventually redo this
  1408. local Button = {};
  1409. local function ProcessButtonParams(Class, Obj, ...)
  1410. local Props = select(1, ...)
  1411. if type(Props) == 'table' then
  1412. Obj.Text = Props.Text
  1413. Obj.Func = Props.Func
  1414. Obj.DoubleClick = Props.DoubleClick
  1415. Obj.Tooltip = Props.Tooltip
  1416. else
  1417. Obj.Text = select(1, ...)
  1418. Obj.Func = select(2, ...)
  1419. end
  1420.  
  1421. assert(type(Obj.Func) == 'function', 'AddButton: `Func` callback is missing.');
  1422. end
  1423.  
  1424. ProcessButtonParams('Button', Button, ...)
  1425.  
  1426. local Groupbox = self;
  1427. local Container = Groupbox.Container;
  1428.  
  1429. local function CreateBaseButton(Button)
  1430. local Outer = Library:Create('Frame', {
  1431. BackgroundColor3 = Color3.new(0, 0, 0);
  1432. BorderColor3 = Color3.new(0, 0, 0);
  1433. Size = UDim2.new(1, -4, 0, 20);
  1434. ZIndex = 5;
  1435. });
  1436.  
  1437. local Inner = Library:Create('Frame', {
  1438. BackgroundColor3 = Library.MainColor;
  1439. BorderColor3 = Library.OutlineColor;
  1440. BorderMode = Enum.BorderMode.Inset;
  1441. Size = UDim2.new(1, 0, 1, 0);
  1442. ZIndex = 6;
  1443. Parent = Outer;
  1444. });
  1445.  
  1446. local Label = Library:CreateLabel({
  1447. Size = UDim2.new(1, 0, 1, 0);
  1448. TextSize = 14;
  1449. Text = Button.Text;
  1450. ZIndex = 6;
  1451. Parent = Inner;
  1452. });
  1453.  
  1454. Library:Create('UIGradient', {
  1455. Color = ColorSequence.new({
  1456. ColorSequenceKeypoint.new(0, Color3.new(1, 1, 1)),
  1457. ColorSequenceKeypoint.new(1, Color3.fromRGB(212, 212, 212))
  1458. });
  1459. Rotation = 90;
  1460. Parent = Inner;
  1461. });
  1462.  
  1463. Library:AddToRegistry(Outer, {
  1464. BorderColor3 = 'Black';
  1465. });
  1466.  
  1467. Library:AddToRegistry(Inner, {
  1468. BackgroundColor3 = 'MainColor';
  1469. BorderColor3 = 'OutlineColor';
  1470. });
  1471.  
  1472. Library:OnHighlight(Outer, Outer,
  1473. { BorderColor3 = 'AccentColor' },
  1474. { BorderColor3 = 'Black' }
  1475. );
  1476.  
  1477. return Outer, Inner, Label
  1478. end
  1479.  
  1480. local function InitEvents(Button)
  1481. local function WaitForEvent(event, timeout, validator)
  1482. local bindable = Instance.new('BindableEvent')
  1483. local connection = event:Once(function(...)
  1484.  
  1485. if type(validator) == 'function' and validator(...) then
  1486. bindable:Fire(true)
  1487. else
  1488. bindable:Fire(false)
  1489. end
  1490. end)
  1491. task.delay(timeout, function()
  1492. connection:disconnect()
  1493. bindable:Fire(false)
  1494. end)
  1495. return bindable.Event:Wait()
  1496. end
  1497.  
  1498. local function ValidateClick(Input)
  1499. if Library:MouseIsOverOpenedFrame() then
  1500. return false
  1501. end
  1502.  
  1503. if Input.UserInputType ~= Enum.UserInputType.MouseButton1 then
  1504. return false
  1505. end
  1506.  
  1507. return true
  1508. end
  1509.  
  1510. Button.Outer.InputBegan:Connect(function(Input)
  1511. if not ValidateClick(Input) then return end
  1512. if Button.Locked then return end
  1513.  
  1514. if Button.DoubleClick then
  1515. Library:RemoveFromRegistry(Button.Label)
  1516. Library:AddToRegistry(Button.Label, { TextColor3 = 'AccentColor' })
  1517.  
  1518. Button.Label.TextColor3 = Library.AccentColor
  1519. Button.Label.Text = 'Are you sure?'
  1520. Button.Locked = true
  1521.  
  1522. local clicked = WaitForEvent(Button.Outer.InputBegan, 0.5, ValidateClick)
  1523.  
  1524. Library:RemoveFromRegistry(Button.Label)
  1525. Library:AddToRegistry(Button.Label, { TextColor3 = 'FontColor' })
  1526.  
  1527. Button.Label.TextColor3 = Library.FontColor
  1528. Button.Label.Text = Button.Text
  1529. task.defer(rawset, Button, 'Locked', false)
  1530.  
  1531. if clicked then
  1532. Library:SafeCallback(Button.Func)
  1533. end
  1534.  
  1535. return
  1536. end
  1537.  
  1538. Library:SafeCallback(Button.Func);
  1539. end)
  1540. end
  1541.  
  1542. Button.Outer, Button.Inner, Button.Label = CreateBaseButton(Button)
  1543. Button.Outer.Parent = Container
  1544.  
  1545. InitEvents(Button)
  1546.  
  1547. function Button:AddTooltip(tooltip)
  1548. if type(tooltip) == 'string' then
  1549. Library:AddToolTip(tooltip, self.Outer)
  1550. end
  1551. return self
  1552. end
  1553.  
  1554.  
  1555. function Button:AddButton(...)
  1556. local SubButton = {}
  1557.  
  1558. ProcessButtonParams('SubButton', SubButton, ...)
  1559.  
  1560. self.Outer.Size = UDim2.new(0.5, -2, 0, 20)
  1561.  
  1562. SubButton.Outer, SubButton.Inner, SubButton.Label = CreateBaseButton(SubButton)
  1563.  
  1564. SubButton.Outer.Position = UDim2.new(1, 3, 0, 0)
  1565. SubButton.Outer.Size = UDim2.fromOffset(self.Outer.AbsoluteSize.X - 2, self.Outer.AbsoluteSize.Y)
  1566. SubButton.Outer.Parent = self.Outer
  1567.  
  1568. function SubButton:AddTooltip(tooltip)
  1569. if type(tooltip) == 'string' then
  1570. Library:AddToolTip(tooltip, self.Outer)
  1571. end
  1572. return SubButton
  1573. end
  1574.  
  1575. if type(SubButton.Tooltip) == 'string' then
  1576. SubButton:AddTooltip(SubButton.Tooltip)
  1577. end
  1578.  
  1579. InitEvents(SubButton)
  1580. return SubButton
  1581. end
  1582.  
  1583. if type(Button.Tooltip) == 'string' then
  1584. Button:AddTooltip(Button.Tooltip)
  1585. end
  1586.  
  1587. Groupbox:AddBlank(5);
  1588. Groupbox:Resize();
  1589.  
  1590. return Button;
  1591. end;
  1592.  
  1593. function Funcs:AddDivider()
  1594. local Groupbox = self;
  1595. local Container = self.Container
  1596.  
  1597. local Divider = {
  1598. Type = 'Divider',
  1599. }
  1600.  
  1601. Groupbox:AddBlank(2);
  1602. local DividerOuter = Library:Create('Frame', {
  1603. BackgroundColor3 = Color3.new(0, 0, 0);
  1604. BorderColor3 = Color3.new(0, 0, 0);
  1605. Size = UDim2.new(1, -4, 0, 5);
  1606. ZIndex = 5;
  1607. Parent = Container;
  1608. });
  1609.  
  1610. local DividerInner = Library:Create('Frame', {
  1611. BackgroundColor3 = Library.MainColor;
  1612. BorderColor3 = Library.OutlineColor;
  1613. BorderMode = Enum.BorderMode.Inset;
  1614. Size = UDim2.new(1, 0, 1, 0);
  1615. ZIndex = 6;
  1616. Parent = DividerOuter;
  1617. });
  1618.  
  1619. Library:AddToRegistry(DividerOuter, {
  1620. BorderColor3 = 'Black';
  1621. });
  1622.  
  1623. Library:AddToRegistry(DividerInner, {
  1624. BackgroundColor3 = 'MainColor';
  1625. BorderColor3 = 'OutlineColor';
  1626. });
  1627.  
  1628. Groupbox:AddBlank(9);
  1629. Groupbox:Resize();
  1630. end
  1631.  
  1632. function Funcs:AddInput(Idx, Info)
  1633. assert(Info.Text, 'AddInput: Missing `Text` string.')
  1634.  
  1635. local Textbox = {
  1636. Value = Info.Default or '';
  1637. Numeric = Info.Numeric or false;
  1638. Finished = Info.Finished or false;
  1639. Type = 'Input';
  1640. Callback = Info.Callback or function(Value) end;
  1641. };
  1642.  
  1643. local Groupbox = self;
  1644. local Container = Groupbox.Container;
  1645.  
  1646. local InputLabel = Library:CreateLabel({
  1647. Size = UDim2.new(1, 0, 0, 15);
  1648. TextSize = 14;
  1649. Text = Info.Text;
  1650. TextXAlignment = Enum.TextXAlignment.Left;
  1651. ZIndex = 5;
  1652. Parent = Container;
  1653. });
  1654.  
  1655. Groupbox:AddBlank(1);
  1656.  
  1657. local TextBoxOuter = Library:Create('Frame', {
  1658. BackgroundColor3 = Color3.new(0, 0, 0);
  1659. BorderColor3 = Color3.new(0, 0, 0);
  1660. Size = UDim2.new(1, -4, 0, 20);
  1661. ZIndex = 5;
  1662. Parent = Container;
  1663. });
  1664.  
  1665. local TextBoxInner = Library:Create('Frame', {
  1666. BackgroundColor3 = Library.MainColor;
  1667. BorderColor3 = Library.OutlineColor;
  1668. BorderMode = Enum.BorderMode.Inset;
  1669. Size = UDim2.new(1, 0, 1, 0);
  1670. ZIndex = 6;
  1671. Parent = TextBoxOuter;
  1672. });
  1673.  
  1674. Library:AddToRegistry(TextBoxInner, {
  1675. BackgroundColor3 = 'MainColor';
  1676. BorderColor3 = 'OutlineColor';
  1677. });
  1678.  
  1679. Library:OnHighlight(TextBoxOuter, TextBoxOuter,
  1680. { BorderColor3 = 'AccentColor' },
  1681. { BorderColor3 = 'Black' }
  1682. );
  1683.  
  1684. if type(Info.Tooltip) == 'string' then
  1685. Library:AddToolTip(Info.Tooltip, TextBoxOuter)
  1686. end
  1687.  
  1688. Library:Create('UIGradient', {
  1689. Color = ColorSequence.new({
  1690. ColorSequenceKeypoint.new(0, Color3.new(1, 1, 1)),
  1691. ColorSequenceKeypoint.new(1, Color3.fromRGB(212, 212, 212))
  1692. });
  1693. Rotation = 90;
  1694. Parent = TextBoxInner;
  1695. });
  1696.  
  1697. local Container = Library:Create('Frame', {
  1698. BackgroundTransparency = 1;
  1699. ClipsDescendants = true;
  1700.  
  1701. Position = UDim2.new(0, 5, 0, 0);
  1702. Size = UDim2.new(1, -5, 1, 0);
  1703.  
  1704. ZIndex = 7;
  1705. Parent = TextBoxInner;
  1706. })
  1707.  
  1708. local Box = Library:Create('TextBox', {
  1709. BackgroundTransparency = 1;
  1710.  
  1711. Position = UDim2.fromOffset(0, 0),
  1712. Size = UDim2.fromScale(5, 1),
  1713.  
  1714. Font = Library.Font;
  1715. PlaceholderColor3 = Color3.fromRGB(190, 190, 190);
  1716. PlaceholderText = Info.Placeholder or '';
  1717.  
  1718. Text = Info.Default or '';
  1719. TextColor3 = Library.FontColor;
  1720. TextSize = 14;
  1721. TextStrokeTransparency = 0;
  1722. TextXAlignment = Enum.TextXAlignment.Left;
  1723.  
  1724. ZIndex = 7;
  1725. Parent = Container;
  1726. });
  1727.  
  1728. Library:ApplyTextStroke(Box);
  1729.  
  1730. function Textbox:SetValue(Text)
  1731. if Info.MaxLength and #Text > Info.MaxLength then
  1732. Text = Text:sub(1, Info.MaxLength);
  1733. end;
  1734.  
  1735. if Textbox.Numeric then
  1736. if (not tonumber(Text)) and Text:len() > 0 then
  1737. Text = Textbox.Value
  1738. end
  1739. end
  1740.  
  1741. Textbox.Value = Text;
  1742. Box.Text = Text;
  1743.  
  1744. Library:SafeCallback(Textbox.Callback, Textbox.Value);
  1745. Library:SafeCallback(Textbox.Changed, Textbox.Value);
  1746. end;
  1747.  
  1748. if Textbox.Finished then
  1749. Box.FocusLost:Connect(function(enter)
  1750. if not enter then return end
  1751.  
  1752. Textbox:SetValue(Box.Text);
  1753. Library:AttemptSave();
  1754. end)
  1755. else
  1756. Box:GetPropertyChangedSignal('Text'):Connect(function()
  1757. Textbox:SetValue(Box.Text);
  1758. Library:AttemptSave();
  1759. end);
  1760. end
  1761.  
  1762. -- https://devforum.roblox.com/t/how-to-make-textboxes-follow-current-cursor-position/1368429/6
  1763. -- thank you nicemike40 :)
  1764.  
  1765. local function Update()
  1766. local PADDING = 2
  1767. local reveal = Container.AbsoluteSize.X
  1768.  
  1769. if not Box:IsFocused() or Box.TextBounds.X <= reveal - 2 * PADDING then
  1770. -- we aren't focused, or we fit so be normal
  1771. Box.Position = UDim2.new(0, PADDING, 0, 0)
  1772. else
  1773. -- we are focused and don't fit, so adjust position
  1774. local cursor = Box.CursorPosition
  1775. if cursor ~= -1 then
  1776. -- calculate pixel width of text from start to cursor
  1777. local subtext = string.sub(Box.Text, 1, cursor-1)
  1778. local width = TextService:GetTextSize(subtext, Box.TextSize, Box.Font, Vector2.new(math.huge, math.huge)).X
  1779.  
  1780. -- check if we're inside the box with the cursor
  1781. local currentCursorPos = Box.Position.X.Offset + width
  1782.  
  1783. -- adjust if necessary
  1784. if currentCursorPos < PADDING then
  1785. Box.Position = UDim2.fromOffset(PADDING-width, 0)
  1786. elseif currentCursorPos > reveal - PADDING - 1 then
  1787. Box.Position = UDim2.fromOffset(reveal-width-PADDING-1, 0)
  1788. end
  1789. end
  1790. end
  1791. end
  1792.  
  1793. task.spawn(Update)
  1794.  
  1795. Box:GetPropertyChangedSignal('Text'):Connect(Update)
  1796. Box:GetPropertyChangedSignal('CursorPosition'):Connect(Update)
  1797. Box.FocusLost:Connect(Update)
  1798. Box.Focused:Connect(Update)
  1799.  
  1800. Library:AddToRegistry(Box, {
  1801. TextColor3 = 'FontColor';
  1802. });
  1803.  
  1804. function Textbox:OnChanged(Func)
  1805. Textbox.Changed = Func;
  1806. Func(Textbox.Value);
  1807. end;
  1808.  
  1809. Groupbox:AddBlank(5);
  1810. Groupbox:Resize();
  1811.  
  1812. Options[Idx] = Textbox;
  1813.  
  1814. return Textbox;
  1815. end;
  1816.  
  1817. function Funcs:AddToggle(Idx, Info)
  1818. assert(Info.Text, 'AddInput: Missing `Text` string.')
  1819.  
  1820. local Toggle = {
  1821. Value = Info.Default or false;
  1822. Type = 'Toggle';
  1823.  
  1824. Callback = Info.Callback or function(Value) end;
  1825. Addons = {},
  1826. Risky = Info.Risky,
  1827. };
  1828.  
  1829. local Groupbox = self;
  1830. local Container = Groupbox.Container;
  1831.  
  1832. local ToggleOuter = Library:Create('Frame', {
  1833. BackgroundColor3 = Color3.new(0, 0, 0);
  1834. BorderColor3 = Color3.new(0, 0, 0);
  1835. Size = UDim2.new(0, 13, 0, 13);
  1836. ZIndex = 5;
  1837. Parent = Container;
  1838. });
  1839.  
  1840. Library:AddToRegistry(ToggleOuter, {
  1841. BorderColor3 = 'Black';
  1842. });
  1843.  
  1844. local ToggleInner = Library:Create('Frame', {
  1845. BackgroundColor3 = Library.MainColor;
  1846. BorderColor3 = Library.OutlineColor;
  1847. BorderMode = Enum.BorderMode.Inset;
  1848. Size = UDim2.new(1, 0, 1, 0);
  1849. ZIndex = 6;
  1850. Parent = ToggleOuter;
  1851. });
  1852.  
  1853. Library:AddToRegistry(ToggleInner, {
  1854. BackgroundColor3 = 'MainColor';
  1855. BorderColor3 = 'OutlineColor';
  1856. });
  1857.  
  1858. local ToggleLabel = Library:CreateLabel({
  1859. Size = UDim2.new(0, 216, 1, 0);
  1860. Position = UDim2.new(1, 6, 0, 0);
  1861. TextSize = 14;
  1862. Text = Info.Text;
  1863. TextXAlignment = Enum.TextXAlignment.Left;
  1864. ZIndex = 6;
  1865. Parent = ToggleInner;
  1866. });
  1867.  
  1868. Library:Create('UIListLayout', {
  1869. Padding = UDim.new(0, 4);
  1870. FillDirection = Enum.FillDirection.Horizontal;
  1871. HorizontalAlignment = Enum.HorizontalAlignment.Right;
  1872. SortOrder = Enum.SortOrder.LayoutOrder;
  1873. Parent = ToggleLabel;
  1874. });
  1875.  
  1876. local ToggleRegion = Library:Create('Frame', {
  1877. BackgroundTransparency = 1;
  1878. Size = UDim2.new(0, 170, 1, 0);
  1879. ZIndex = 8;
  1880. Parent = ToggleOuter;
  1881. });
  1882.  
  1883. Library:OnHighlight(ToggleRegion, ToggleOuter,
  1884. { BorderColor3 = 'AccentColor' },
  1885. { BorderColor3 = 'Black' }
  1886. );
  1887.  
  1888. function Toggle:UpdateColors()
  1889. Toggle:Display();
  1890. end;
  1891.  
  1892. if type(Info.Tooltip) == 'string' then
  1893. Library:AddToolTip(Info.Tooltip, ToggleRegion)
  1894. end
  1895.  
  1896. function Toggle:Display()
  1897. ToggleInner.BackgroundColor3 = Toggle.Value and Library.AccentColor or Library.MainColor;
  1898. ToggleInner.BorderColor3 = Toggle.Value and Library.AccentColorDark or Library.OutlineColor;
  1899.  
  1900. Library.RegistryMap[ToggleInner].Properties.BackgroundColor3 = Toggle.Value and 'AccentColor' or 'MainColor';
  1901. Library.RegistryMap[ToggleInner].Properties.BorderColor3 = Toggle.Value and 'AccentColorDark' or 'OutlineColor';
  1902. end;
  1903.  
  1904. function Toggle:OnChanged(Func)
  1905. Toggle.Changed = Func;
  1906. Func(Toggle.Value);
  1907. end;
  1908.  
  1909. function Toggle:SetValue(Bool)
  1910. Bool = (not not Bool);
  1911.  
  1912. Toggle.Value = Bool;
  1913. Toggle:Display();
  1914.  
  1915. for _, Addon in next, Toggle.Addons do
  1916. if Addon.Type == 'KeyPicker' and Addon.SyncToggleState then
  1917. Addon.Toggled = Bool
  1918. Addon:Update()
  1919. end
  1920. end
  1921.  
  1922. Library:SafeCallback(Toggle.Callback, Toggle.Value);
  1923. Library:SafeCallback(Toggle.Changed, Toggle.Value);
  1924. Library:UpdateDependencyBoxes();
  1925. end;
  1926.  
  1927. ToggleRegion.InputBegan:Connect(function(Input)
  1928. if Input.UserInputType == Enum.UserInputType.MouseButton1 and not Library:MouseIsOverOpenedFrame() then
  1929. Toggle:SetValue(not Toggle.Value) -- Why was it not like this from the start?
  1930. Library:AttemptSave();
  1931. end;
  1932. end);
  1933.  
  1934. if Toggle.Risky then
  1935. Library:RemoveFromRegistry(ToggleLabel)
  1936. ToggleLabel.TextColor3 = Library.RiskColor
  1937. Library:AddToRegistry(ToggleLabel, { TextColor3 = 'RiskColor' })
  1938. end
  1939.  
  1940. Toggle:Display();
  1941. Groupbox:AddBlank(Info.BlankSize or 5 + 2);
  1942. Groupbox:Resize();
  1943.  
  1944. Toggle.TextLabel = ToggleLabel;
  1945. Toggle.Container = Container;
  1946. setmetatable(Toggle, BaseAddons);
  1947.  
  1948. Toggles[Idx] = Toggle;
  1949.  
  1950. Library:UpdateDependencyBoxes();
  1951.  
  1952. return Toggle;
  1953. end;
  1954.  
  1955. function Funcs:AddSlider(Idx, Info)
  1956. assert(Info.Default, 'AddSlider: Missing default value.');
  1957. assert(Info.Text, 'AddSlider: Missing slider text.');
  1958. assert(Info.Min, 'AddSlider: Missing minimum value.');
  1959. assert(Info.Max, 'AddSlider: Missing maximum value.');
  1960. assert(Info.Rounding, 'AddSlider: Missing rounding value.');
  1961.  
  1962. local Slider = {
  1963. Value = Info.Default;
  1964. Min = Info.Min;
  1965. Max = Info.Max;
  1966. Rounding = Info.Rounding;
  1967. MaxSize = 232;
  1968. Type = 'Slider';
  1969. Callback = Info.Callback or function(Value) end;
  1970. };
  1971.  
  1972. local Groupbox = self;
  1973. local Container = Groupbox.Container;
  1974.  
  1975. if not Info.Compact then
  1976. Library:CreateLabel({
  1977. Size = UDim2.new(1, 0, 0, 10);
  1978. TextSize = 14;
  1979. Text = Info.Text;
  1980. TextXAlignment = Enum.TextXAlignment.Left;
  1981. TextYAlignment = Enum.TextYAlignment.Bottom;
  1982. ZIndex = 5;
  1983. Parent = Container;
  1984. });
  1985.  
  1986. Groupbox:AddBlank(3);
  1987. end
  1988.  
  1989. local SliderOuter = Library:Create('Frame', {
  1990. BackgroundColor3 = Color3.new(0, 0, 0);
  1991. BorderColor3 = Color3.new(0, 0, 0);
  1992. Size = UDim2.new(1, -4, 0, 13);
  1993. ZIndex = 5;
  1994. Parent = Container;
  1995. });
  1996.  
  1997. Library:AddToRegistry(SliderOuter, {
  1998. BorderColor3 = 'Black';
  1999. });
  2000.  
  2001. local SliderInner = Library:Create('Frame', {
  2002. BackgroundColor3 = Library.MainColor;
  2003. BorderColor3 = Library.OutlineColor;
  2004. BorderMode = Enum.BorderMode.Inset;
  2005. Size = UDim2.new(1, 0, 1, 0);
  2006. ZIndex = 6;
  2007. Parent = SliderOuter;
  2008. });
  2009.  
  2010. Library:AddToRegistry(SliderInner, {
  2011. BackgroundColor3 = 'MainColor';
  2012. BorderColor3 = 'OutlineColor';
  2013. });
  2014.  
  2015. local Fill = Library:Create('Frame', {
  2016. BackgroundColor3 = Library.AccentColor;
  2017. BorderColor3 = Library.AccentColorDark;
  2018. Size = UDim2.new(0, 0, 1, 0);
  2019. ZIndex = 7;
  2020. Parent = SliderInner;
  2021. });
  2022.  
  2023. Library:AddToRegistry(Fill, {
  2024. BackgroundColor3 = 'AccentColor';
  2025. BorderColor3 = 'AccentColorDark';
  2026. });
  2027.  
  2028. local HideBorderRight = Library:Create('Frame', {
  2029. BackgroundColor3 = Library.AccentColor;
  2030. BorderSizePixel = 0;
  2031. Position = UDim2.new(1, 0, 0, 0);
  2032. Size = UDim2.new(0, 1, 1, 0);
  2033. ZIndex = 8;
  2034. Parent = Fill;
  2035. });
  2036.  
  2037. Library:AddToRegistry(HideBorderRight, {
  2038. BackgroundColor3 = 'AccentColor';
  2039. });
  2040.  
  2041. local DisplayLabel = Library:CreateLabel({
  2042. Size = UDim2.new(1, 0, 1, 0);
  2043. TextSize = 14;
  2044. Text = 'Infinite';
  2045. ZIndex = 9;
  2046. Parent = SliderInner;
  2047. });
  2048.  
  2049. Library:OnHighlight(SliderOuter, SliderOuter,
  2050. { BorderColor3 = 'AccentColor' },
  2051. { BorderColor3 = 'Black' }
  2052. );
  2053.  
  2054. if type(Info.Tooltip) == 'string' then
  2055. Library:AddToolTip(Info.Tooltip, SliderOuter)
  2056. end
  2057.  
  2058. function Slider:UpdateColors()
  2059. Fill.BackgroundColor3 = Library.AccentColor;
  2060. Fill.BorderColor3 = Library.AccentColorDark;
  2061. end;
  2062.  
  2063. function Slider:Display()
  2064. local Suffix = Info.Suffix or '';
  2065.  
  2066. if Info.Compact then
  2067. DisplayLabel.Text = Info.Text .. ': ' .. Slider.Value .. Suffix
  2068. elseif Info.HideMax then
  2069. DisplayLabel.Text = string.format('%s', Slider.Value .. Suffix)
  2070. else
  2071. DisplayLabel.Text = string.format('%s/%s', Slider.Value .. Suffix, Slider.Max .. Suffix);
  2072. end
  2073.  
  2074. local X = math.ceil(Library:MapValue(Slider.Value, Slider.Min, Slider.Max, 0, Slider.MaxSize));
  2075. Fill.Size = UDim2.new(0, X, 1, 0);
  2076.  
  2077. HideBorderRight.Visible = not (X == Slider.MaxSize or X == 0);
  2078. end;
  2079.  
  2080. function Slider:OnChanged(Func)
  2081. Slider.Changed = Func;
  2082. Func(Slider.Value);
  2083. end;
  2084.  
  2085. local function Round(Value)
  2086. if Slider.Rounding == 0 then
  2087. return math.floor(Value);
  2088. end;
  2089.  
  2090.  
  2091. return tonumber(string.format('%.' .. Slider.Rounding .. 'f', Value))
  2092. end;
  2093.  
  2094. function Slider:GetValueFromXOffset(X)
  2095. return Round(Library:MapValue(X, 0, Slider.MaxSize, Slider.Min, Slider.Max));
  2096. end;
  2097.  
  2098. function Slider:SetValue(Str)
  2099. local Num = tonumber(Str);
  2100.  
  2101. if (not Num) then
  2102. return;
  2103. end;
  2104.  
  2105. Num = math.clamp(Num, Slider.Min, Slider.Max);
  2106.  
  2107. Slider.Value = Num;
  2108. Slider:Display();
  2109.  
  2110. Library:SafeCallback(Slider.Callback, Slider.Value);
  2111. Library:SafeCallback(Slider.Changed, Slider.Value);
  2112. end;
  2113.  
  2114. SliderInner.InputBegan:Connect(function(Input)
  2115. if Input.UserInputType == Enum.UserInputType.MouseButton1 and not Library:MouseIsOverOpenedFrame() then
  2116. local mPos = Mouse.X;
  2117. local gPos = Fill.Size.X.Offset;
  2118. local Diff = mPos - (Fill.AbsolutePosition.X + gPos);
  2119.  
  2120. while InputService:IsMouseButtonPressed(Enum.UserInputType.MouseButton1) do
  2121. local nMPos = Mouse.X;
  2122. local nX = math.clamp(gPos + (nMPos - mPos) + Diff, 0, Slider.MaxSize);
  2123.  
  2124. local nValue = Slider:GetValueFromXOffset(nX);
  2125. local OldValue = Slider.Value;
  2126. Slider.Value = nValue;
  2127.  
  2128. Slider:Display();
  2129.  
  2130. if nValue ~= OldValue then
  2131. Library:SafeCallback(Slider.Callback, Slider.Value);
  2132. Library:SafeCallback(Slider.Changed, Slider.Value);
  2133. end;
  2134.  
  2135. RenderStepped:Wait();
  2136. end;
  2137.  
  2138. Library:AttemptSave();
  2139. end;
  2140. end);
  2141.  
  2142. Slider:Display();
  2143. Groupbox:AddBlank(Info.BlankSize or 6);
  2144. Groupbox:Resize();
  2145.  
  2146. Options[Idx] = Slider;
  2147.  
  2148. return Slider;
  2149. end;
  2150.  
  2151. function Funcs:AddDropdown(Idx, Info)
  2152. if Info.SpecialType == 'Player' then
  2153. Info.Values = GetPlayersString();
  2154. Info.AllowNull = true;
  2155. elseif Info.SpecialType == 'Team' then
  2156. Info.Values = GetTeamsString();
  2157. Info.AllowNull = true;
  2158. end;
  2159.  
  2160. assert(Info.Values, 'AddDropdown: Missing dropdown value list.');
  2161. assert(Info.AllowNull or Info.Default, 'AddDropdown: Missing default value. Pass `AllowNull` as true if this was intentional.')
  2162.  
  2163. if (not Info.Text) then
  2164. Info.Compact = true;
  2165. end;
  2166.  
  2167. local Dropdown = {
  2168. Values = Info.Values;
  2169. Value = Info.Multi and {};
  2170. Multi = Info.Multi;
  2171. Type = 'Dropdown';
  2172. SpecialType = Info.SpecialType; -- can be either 'Player' or 'Team'
  2173. Callback = Info.Callback or function(Value) end;
  2174. };
  2175.  
  2176. local Groupbox = self;
  2177. local Container = Groupbox.Container;
  2178.  
  2179. local RelativeOffset = 0;
  2180.  
  2181. if not Info.Compact then
  2182. local DropdownLabel = Library:CreateLabel({
  2183. Size = UDim2.new(1, 0, 0, 10);
  2184. TextSize = 14;
  2185. Text = Info.Text;
  2186. TextXAlignment = Enum.TextXAlignment.Left;
  2187. TextYAlignment = Enum.TextYAlignment.Bottom;
  2188. ZIndex = 5;
  2189. Parent = Container;
  2190. });
  2191.  
  2192. Groupbox:AddBlank(3);
  2193. end
  2194.  
  2195. for _, Element in next, Container:GetChildren() do
  2196. if not Element:IsA('UIListLayout') then
  2197. RelativeOffset = RelativeOffset + Element.Size.Y.Offset;
  2198. end;
  2199. end;
  2200.  
  2201. local DropdownOuter = Library:Create('Frame', {
  2202. BackgroundColor3 = Color3.new(0, 0, 0);
  2203. BorderColor3 = Color3.new(0, 0, 0);
  2204. Size = UDim2.new(1, -4, 0, 20);
  2205. ZIndex = 5;
  2206. Parent = Container;
  2207. });
  2208.  
  2209. Library:AddToRegistry(DropdownOuter, {
  2210. BorderColor3 = 'Black';
  2211. });
  2212.  
  2213. local DropdownInner = Library:Create('Frame', {
  2214. BackgroundColor3 = Library.MainColor;
  2215. BorderColor3 = Library.OutlineColor;
  2216. BorderMode = Enum.BorderMode.Inset;
  2217. Size = UDim2.new(1, 0, 1, 0);
  2218. ZIndex = 6;
  2219. Parent = DropdownOuter;
  2220. });
  2221.  
  2222. Library:AddToRegistry(DropdownInner, {
  2223. BackgroundColor3 = 'MainColor';
  2224. BorderColor3 = 'OutlineColor';
  2225. });
  2226.  
  2227. Library:Create('UIGradient', {
  2228. Color = ColorSequence.new({
  2229. ColorSequenceKeypoint.new(0, Color3.new(1, 1, 1)),
  2230. ColorSequenceKeypoint.new(1, Color3.fromRGB(212, 212, 212))
  2231. });
  2232. Rotation = 90;
  2233. Parent = DropdownInner;
  2234. });
  2235.  
  2236. local DropdownArrow = Library:Create('ImageLabel', {
  2237. AnchorPoint = Vector2.new(0, 0.5);
  2238. BackgroundTransparency = 1;
  2239. Position = UDim2.new(1, -16, 0.5, 0);
  2240. Size = UDim2.new(0, 12, 0, 12);
  2241. Image = 'http://www.roblox.com/asset/?id=6282522798';
  2242. ZIndex = 8;
  2243. Parent = DropdownInner;
  2244. });
  2245.  
  2246. local ItemList = Library:CreateLabel({
  2247. Position = UDim2.new(0, 5, 0, 0);
  2248. Size = UDim2.new(1, -5, 1, 0);
  2249. TextSize = 14;
  2250. Text = '--';
  2251. TextXAlignment = Enum.TextXAlignment.Left;
  2252. TextWrapped = true;
  2253. ZIndex = 7;
  2254. Parent = DropdownInner;
  2255. });
  2256.  
  2257. Library:OnHighlight(DropdownOuter, DropdownOuter,
  2258. { BorderColor3 = 'AccentColor' },
  2259. { BorderColor3 = 'Black' }
  2260. );
  2261.  
  2262. if type(Info.Tooltip) == 'string' then
  2263. Library:AddToolTip(Info.Tooltip, DropdownOuter)
  2264. end
  2265.  
  2266. local MAX_DROPDOWN_ITEMS = 8;
  2267.  
  2268. local ListOuter = Library:Create('Frame', {
  2269. BackgroundColor3 = Color3.new(0, 0, 0);
  2270. BorderColor3 = Color3.new(0, 0, 0);
  2271. ZIndex = 20;
  2272. Visible = false;
  2273. Parent = ScreenGui;
  2274. });
  2275.  
  2276. local function RecalculateListPosition()
  2277. ListOuter.Position = UDim2.fromOffset(DropdownOuter.AbsolutePosition.X, DropdownOuter.AbsolutePosition.Y + DropdownOuter.Size.Y.Offset + 1);
  2278. end;
  2279.  
  2280. local function RecalculateListSize(YSize)
  2281. ListOuter.Size = UDim2.fromOffset(DropdownOuter.AbsoluteSize.X, YSize or (MAX_DROPDOWN_ITEMS * 20 + 2))
  2282. end;
  2283.  
  2284. RecalculateListPosition();
  2285. RecalculateListSize();
  2286.  
  2287. DropdownOuter:GetPropertyChangedSignal('AbsolutePosition'):Connect(RecalculateListPosition);
  2288.  
  2289. local ListInner = Library:Create('Frame', {
  2290. BackgroundColor3 = Library.MainColor;
  2291. BorderColor3 = Library.OutlineColor;
  2292. BorderMode = Enum.BorderMode.Inset;
  2293. BorderSizePixel = 0;
  2294. Size = UDim2.new(1, 0, 1, 0);
  2295. ZIndex = 21;
  2296. Parent = ListOuter;
  2297. });
  2298.  
  2299. Library:AddToRegistry(ListInner, {
  2300. BackgroundColor3 = 'MainColor';
  2301. BorderColor3 = 'OutlineColor';
  2302. });
  2303.  
  2304. local Scrolling = Library:Create('ScrollingFrame', {
  2305. BackgroundTransparency = 1;
  2306. BorderSizePixel = 0;
  2307. CanvasSize = UDim2.new(0, 0, 0, 0);
  2308. Size = UDim2.new(1, 0, 1, 0);
  2309. ZIndex = 21;
  2310. Parent = ListInner;
  2311.  
  2312. TopImage = 'rbxasset://textures/ui/Scroll/scroll-middle.png',
  2313. BottomImage = 'rbxasset://textures/ui/Scroll/scroll-middle.png',
  2314.  
  2315. ScrollBarThickness = 3,
  2316. ScrollBarImageColor3 = Library.AccentColor,
  2317. });
  2318.  
  2319. Library:AddToRegistry(Scrolling, {
  2320. ScrollBarImageColor3 = 'AccentColor'
  2321. })
  2322.  
  2323. Library:Create('UIListLayout', {
  2324. Padding = UDim.new(0, 0);
  2325. FillDirection = Enum.FillDirection.Vertical;
  2326. SortOrder = Enum.SortOrder.LayoutOrder;
  2327. Parent = Scrolling;
  2328. });
  2329.  
  2330. function Dropdown:Display()
  2331. local Values = Dropdown.Values;
  2332. local Str = '';
  2333.  
  2334. if Info.Multi then
  2335. for Idx, Value in next, Values do
  2336. if Dropdown.Value[Value] then
  2337. Str = Str .. Value .. ', ';
  2338. end;
  2339. end;
  2340.  
  2341. Str = Str:sub(1, #Str - 2);
  2342. else
  2343. Str = Dropdown.Value or '';
  2344. end;
  2345.  
  2346. ItemList.Text = (Str == '' and '--' or Str);
  2347. end;
  2348.  
  2349. function Dropdown:GetActiveValues()
  2350. if Info.Multi then
  2351. local T = {};
  2352.  
  2353. for Value, Bool in next, Dropdown.Value do
  2354. table.insert(T, Value);
  2355. end;
  2356.  
  2357. return T;
  2358. else
  2359. return Dropdown.Value and 1 or 0;
  2360. end;
  2361. end;
  2362.  
  2363. function Dropdown:BuildDropdownList()
  2364. local Values = Dropdown.Values;
  2365. local Buttons = {};
  2366.  
  2367. for _, Element in next, Scrolling:GetChildren() do
  2368. if not Element:IsA('UIListLayout') then
  2369. Element:Destroy();
  2370. end;
  2371. end;
  2372.  
  2373. local Count = 0;
  2374.  
  2375. for Idx, Value in next, Values do
  2376. local Table = {};
  2377.  
  2378. Count = Count + 1;
  2379.  
  2380. local Button = Library:Create('Frame', {
  2381. BackgroundColor3 = Library.MainColor;
  2382. BorderColor3 = Library.OutlineColor;
  2383. BorderMode = Enum.BorderMode.Middle;
  2384. Size = UDim2.new(1, -1, 0, 20);
  2385. ZIndex = 23;
  2386. Active = true,
  2387. Parent = Scrolling;
  2388. });
  2389.  
  2390. Library:AddToRegistry(Button, {
  2391. BackgroundColor3 = 'MainColor';
  2392. BorderColor3 = 'OutlineColor';
  2393. });
  2394.  
  2395. local ButtonLabel = Library:CreateLabel({
  2396. Active = false;
  2397. Size = UDim2.new(1, -6, 1, 0);
  2398. Position = UDim2.new(0, 6, 0, 0);
  2399. TextSize = 14;
  2400. Text = Value;
  2401. TextXAlignment = Enum.TextXAlignment.Left;
  2402. ZIndex = 25;
  2403. Parent = Button;
  2404. });
  2405.  
  2406. Library:OnHighlight(Button, Button,
  2407. { BorderColor3 = 'AccentColor', ZIndex = 24 },
  2408. { BorderColor3 = 'OutlineColor', ZIndex = 23 }
  2409. );
  2410.  
  2411. local Selected;
  2412.  
  2413. if Info.Multi then
  2414. Selected = Dropdown.Value[Value];
  2415. else
  2416. Selected = Dropdown.Value == Value;
  2417. end;
  2418.  
  2419. function Table:UpdateButton()
  2420. if Info.Multi then
  2421. Selected = Dropdown.Value[Value];
  2422. else
  2423. Selected = Dropdown.Value == Value;
  2424. end;
  2425.  
  2426. ButtonLabel.TextColor3 = Selected and Library.AccentColor or Library.FontColor;
  2427. Library.RegistryMap[ButtonLabel].Properties.TextColor3 = Selected and 'AccentColor' or 'FontColor';
  2428. end;
  2429.  
  2430. ButtonLabel.InputBegan:Connect(function(Input)
  2431. if Input.UserInputType == Enum.UserInputType.MouseButton1 then
  2432. local Try = not Selected;
  2433.  
  2434. if Dropdown:GetActiveValues() == 1 and (not Try) and (not Info.AllowNull) then
  2435. else
  2436. if Info.Multi then
  2437. Selected = Try;
  2438.  
  2439. if Selected then
  2440. Dropdown.Value[Value] = true;
  2441. else
  2442. Dropdown.Value[Value] = nil;
  2443. end;
  2444. else
  2445. Selected = Try;
  2446.  
  2447. if Selected then
  2448. Dropdown.Value = Value;
  2449. else
  2450. Dropdown.Value = nil;
  2451. end;
  2452.  
  2453. for _, OtherButton in next, Buttons do
  2454. OtherButton:UpdateButton();
  2455. end;
  2456. end;
  2457.  
  2458. Table:UpdateButton();
  2459. Dropdown:Display();
  2460.  
  2461. Library:SafeCallback(Dropdown.Callback, Dropdown.Value);
  2462. Library:SafeCallback(Dropdown.Changed, Dropdown.Value);
  2463.  
  2464. Library:AttemptSave();
  2465. end;
  2466. end;
  2467. end);
  2468.  
  2469. Table:UpdateButton();
  2470. Dropdown:Display();
  2471.  
  2472. Buttons[Button] = Table;
  2473. end;
  2474.  
  2475. Scrolling.CanvasSize = UDim2.fromOffset(0, (Count * 20) + 1);
  2476.  
  2477. local Y = math.clamp(Count * 20, 0, MAX_DROPDOWN_ITEMS * 20) + 1;
  2478. RecalculateListSize(Y);
  2479. end;
  2480.  
  2481. function Dropdown:SetValues(NewValues)
  2482. if NewValues then
  2483. Dropdown.Values = NewValues;
  2484. end;
  2485.  
  2486. Dropdown:BuildDropdownList();
  2487. end;
  2488.  
  2489. function Dropdown:OpenDropdown()
  2490. ListOuter.Visible = true;
  2491. Library.OpenedFrames[ListOuter] = true;
  2492. DropdownArrow.Rotation = 180;
  2493. end;
  2494.  
  2495. function Dropdown:CloseDropdown()
  2496. ListOuter.Visible = false;
  2497. Library.OpenedFrames[ListOuter] = nil;
  2498. DropdownArrow.Rotation = 0;
  2499. end;
  2500.  
  2501. function Dropdown:OnChanged(Func)
  2502. Dropdown.Changed = Func;
  2503. Func(Dropdown.Value);
  2504. end;
  2505.  
  2506. function Dropdown:SetValue(Val)
  2507. if Dropdown.Multi then
  2508. local nTable = {};
  2509.  
  2510. for Value, Bool in next, Val do
  2511. if table.find(Dropdown.Values, Value) then
  2512. nTable[Value] = true
  2513. end;
  2514. end;
  2515.  
  2516. Dropdown.Value = nTable;
  2517. else
  2518. if (not Val) then
  2519. Dropdown.Value = nil;
  2520. elseif table.find(Dropdown.Values, Val) then
  2521. Dropdown.Value = Val;
  2522. end;
  2523. end;
  2524.  
  2525. Dropdown:BuildDropdownList();
  2526.  
  2527. Library:SafeCallback(Dropdown.Callback, Dropdown.Value);
  2528. Library:SafeCallback(Dropdown.Changed, Dropdown.Value);
  2529. end;
  2530.  
  2531. DropdownOuter.InputBegan:Connect(function(Input)
  2532. if Input.UserInputType == Enum.UserInputType.MouseButton1 and not Library:MouseIsOverOpenedFrame() then
  2533. if ListOuter.Visible then
  2534. Dropdown:CloseDropdown();
  2535. else
  2536. Dropdown:OpenDropdown();
  2537. end;
  2538. end;
  2539. end);
  2540.  
  2541. InputService.InputBegan:Connect(function(Input)
  2542. if Input.UserInputType == Enum.UserInputType.MouseButton1 then
  2543. local AbsPos, AbsSize = ListOuter.AbsolutePosition, ListOuter.AbsoluteSize;
  2544.  
  2545. if Mouse.X < AbsPos.X or Mouse.X > AbsPos.X + AbsSize.X
  2546. or Mouse.Y < (AbsPos.Y - 20 - 1) or Mouse.Y > AbsPos.Y + AbsSize.Y then
  2547.  
  2548. Dropdown:CloseDropdown();
  2549. end;
  2550. end;
  2551. end);
  2552.  
  2553. Dropdown:BuildDropdownList();
  2554. Dropdown:Display();
  2555.  
  2556. local Defaults = {}
  2557.  
  2558. if type(Info.Default) == 'string' then
  2559. local Idx = table.find(Dropdown.Values, Info.Default)
  2560. if Idx then
  2561. table.insert(Defaults, Idx)
  2562. end
  2563. elseif type(Info.Default) == 'table' then
  2564. for _, Value in next, Info.Default do
  2565. local Idx = table.find(Dropdown.Values, Value)
  2566. if Idx then
  2567. table.insert(Defaults, Idx)
  2568. end
  2569. end
  2570. elseif type(Info.Default) == 'number' and Dropdown.Values[Info.Default] ~= nil then
  2571. table.insert(Defaults, Info.Default)
  2572. end
  2573.  
  2574. if next(Defaults) then
  2575. for i = 1, #Defaults do
  2576. local Index = Defaults[i]
  2577. if Info.Multi then
  2578. Dropdown.Value[Dropdown.Values[Index]] = true
  2579. else
  2580. Dropdown.Value = Dropdown.Values[Index];
  2581. end
  2582.  
  2583. if (not Info.Multi) then break end
  2584. end
  2585.  
  2586. Dropdown:BuildDropdownList();
  2587. Dropdown:Display();
  2588. end
  2589.  
  2590. Groupbox:AddBlank(Info.BlankSize or 5);
  2591. Groupbox:Resize();
  2592.  
  2593. Options[Idx] = Dropdown;
  2594.  
  2595. return Dropdown;
  2596. end;
  2597.  
  2598. function Funcs:AddDependencyBox()
  2599. local Depbox = {
  2600. Dependencies = {};
  2601. };
  2602.  
  2603. local Groupbox = self;
  2604. local Container = Groupbox.Container;
  2605.  
  2606. local Holder = Library:Create('Frame', {
  2607. BackgroundTransparency = 1;
  2608. Size = UDim2.new(1, 0, 0, 0);
  2609. Visible = false;
  2610. Parent = Container;
  2611. });
  2612.  
  2613. local Frame = Library:Create('Frame', {
  2614. BackgroundTransparency = 1;
  2615. Size = UDim2.new(1, 0, 1, 0);
  2616. Visible = true;
  2617. Parent = Holder;
  2618. });
  2619.  
  2620. local Layout = Library:Create('UIListLayout', {
  2621. FillDirection = Enum.FillDirection.Vertical;
  2622. SortOrder = Enum.SortOrder.LayoutOrder;
  2623. Parent = Frame;
  2624. });
  2625.  
  2626. function Depbox:Resize()
  2627. Holder.Size = UDim2.new(1, 0, 0, Layout.AbsoluteContentSize.Y);
  2628. Groupbox:Resize();
  2629. end;
  2630.  
  2631. Layout:GetPropertyChangedSignal('AbsoluteContentSize'):Connect(function()
  2632. Depbox:Resize();
  2633. end);
  2634.  
  2635. Holder:GetPropertyChangedSignal('Visible'):Connect(function()
  2636. Depbox:Resize();
  2637. end);
  2638.  
  2639. function Depbox:Update()
  2640. for _, Dependency in next, Depbox.Dependencies do
  2641. local Elem = Dependency[1];
  2642. local Value = Dependency[2];
  2643.  
  2644. if Elem.Type == 'Toggle' and Elem.Value ~= Value then
  2645. Holder.Visible = false;
  2646. Depbox:Resize();
  2647. return;
  2648. end;
  2649. end;
  2650.  
  2651. Holder.Visible = true;
  2652. Depbox:Resize();
  2653. end;
  2654.  
  2655. function Depbox:SetupDependencies(Dependencies)
  2656. for _, Dependency in next, Dependencies do
  2657. assert(type(Dependency) == 'table', 'SetupDependencies: Dependency is not of type `table`.');
  2658. assert(Dependency[1], 'SetupDependencies: Dependency is missing element argument.');
  2659. assert(Dependency[2] ~= nil, 'SetupDependencies: Dependency is missing value argument.');
  2660. end;
  2661.  
  2662. Depbox.Dependencies = Dependencies;
  2663. Depbox:Update();
  2664. end;
  2665.  
  2666. Depbox.Container = Frame;
  2667.  
  2668. setmetatable(Depbox, BaseGroupbox);
  2669.  
  2670. table.insert(Library.DependencyBoxes, Depbox);
  2671.  
  2672. return Depbox;
  2673. end;
  2674.  
  2675. BaseGroupbox.__index = Funcs;
  2676. BaseGroupbox.__namecall = function(Table, Key, ...)
  2677. return Funcs[Key](...);
  2678. end;
  2679. end;
  2680.  
  2681. -- < Create other UI elements >
  2682. do
  2683. Library.NotificationArea = Library:Create('Frame', {
  2684. BackgroundTransparency = 1;
  2685. Position = UDim2.new(0, 0, 0, 40);
  2686. Size = UDim2.new(0, 300, 0, 200);
  2687. ZIndex = 100;
  2688. Parent = ScreenGui;
  2689. });
  2690.  
  2691. Library:Create('UIListLayout', {
  2692. Padding = UDim.new(0, 4);
  2693. FillDirection = Enum.FillDirection.Vertical;
  2694. SortOrder = Enum.SortOrder.LayoutOrder;
  2695. Parent = Library.NotificationArea;
  2696. });
  2697.  
  2698. local WatermarkOuter = Library:Create('Frame', {
  2699. BorderColor3 = Color3.new(0, 0, 0);
  2700. Position = UDim2.new(0, 100, 0, -25);
  2701. Size = UDim2.new(0, 213, 0, 20);
  2702. ZIndex = 200;
  2703. Visible = false;
  2704. Parent = ScreenGui;
  2705. });
  2706.  
  2707. local WatermarkInner = Library:Create('Frame', {
  2708. BackgroundColor3 = Library.MainColor;
  2709. BorderColor3 = Library.AccentColor;
  2710. BorderMode = Enum.BorderMode.Inset;
  2711. Size = UDim2.new(1, 0, 1, 0);
  2712. ZIndex = 201;
  2713. Parent = WatermarkOuter;
  2714. });
  2715.  
  2716. Library:AddToRegistry(WatermarkInner, {
  2717. BorderColor3 = 'AccentColor';
  2718. });
  2719.  
  2720. local InnerFrame = Library:Create('Frame', {
  2721. BackgroundColor3 = Color3.new(1, 1, 1);
  2722. BorderSizePixel = 0;
  2723. Position = UDim2.new(0, 1, 0, 1);
  2724. Size = UDim2.new(1, -2, 1, -2);
  2725. ZIndex = 202;
  2726. Parent = WatermarkInner;
  2727. });
  2728.  
  2729. local Gradient = Library:Create('UIGradient', {
  2730. Color = ColorSequence.new({
  2731. ColorSequenceKeypoint.new(0, Library:GetDarkerColor(Library.MainColor)),
  2732. ColorSequenceKeypoint.new(1, Library.MainColor),
  2733. });
  2734. Rotation = -90;
  2735. Parent = InnerFrame;
  2736. });
  2737.  
  2738. Library:AddToRegistry(Gradient, {
  2739. Color = function()
  2740. return ColorSequence.new({
  2741. ColorSequenceKeypoint.new(0, Library:GetDarkerColor(Library.MainColor)),
  2742. ColorSequenceKeypoint.new(1, Library.MainColor),
  2743. });
  2744. end
  2745. });
  2746.  
  2747. local WatermarkLabel = Library:CreateLabel({
  2748. Position = UDim2.new(0, 5, 0, 0);
  2749. Size = UDim2.new(1, -4, 1, 0);
  2750. TextSize = 14;
  2751. TextXAlignment = Enum.TextXAlignment.Left;
  2752. ZIndex = 203;
  2753. Parent = InnerFrame;
  2754. });
  2755.  
  2756. Library.Watermark = WatermarkOuter;
  2757. Library.WatermarkText = WatermarkLabel;
  2758. Library:MakeDraggable(Library.Watermark);
  2759.  
  2760.  
  2761.  
  2762. local KeybindOuter = Library:Create('Frame', {
  2763. AnchorPoint = Vector2.new(0, 0.5);
  2764. BorderColor3 = Color3.new(0, 0, 0);
  2765. Position = UDim2.new(0, 10, 0.5, 0);
  2766. Size = UDim2.new(0, 210, 0, 20);
  2767. Visible = false;
  2768. ZIndex = 100;
  2769. Parent = ScreenGui;
  2770. });
  2771.  
  2772. local KeybindInner = Library:Create('Frame', {
  2773. BackgroundColor3 = Library.MainColor;
  2774. BorderColor3 = Library.OutlineColor;
  2775. BorderMode = Enum.BorderMode.Inset;
  2776. Size = UDim2.new(1, 0, 1, 0);
  2777. ZIndex = 101;
  2778. Parent = KeybindOuter;
  2779. });
  2780.  
  2781. Library:AddToRegistry(KeybindInner, {
  2782. BackgroundColor3 = 'MainColor';
  2783. BorderColor3 = 'OutlineColor';
  2784. }, true);
  2785.  
  2786. local ColorFrame = Library:Create('Frame', {
  2787. BackgroundColor3 = Library.AccentColor;
  2788. BorderSizePixel = 0;
  2789. Size = UDim2.new(1, 0, 0, 2);
  2790. ZIndex = 102;
  2791. Parent = KeybindInner;
  2792. });
  2793.  
  2794. Library:AddToRegistry(ColorFrame, {
  2795. BackgroundColor3 = 'AccentColor';
  2796. }, true);
  2797.  
  2798. local KeybindLabel = Library:CreateLabel({
  2799. Size = UDim2.new(1, 0, 0, 20);
  2800. Position = UDim2.fromOffset(5, 2),
  2801. TextXAlignment = Enum.TextXAlignment.Left,
  2802.  
  2803. Text = 'Keybinds';
  2804. ZIndex = 104;
  2805. Parent = KeybindInner;
  2806. });
  2807.  
  2808. local KeybindContainer = Library:Create('Frame', {
  2809. BackgroundTransparency = 1;
  2810. Size = UDim2.new(1, 0, 1, -20);
  2811. Position = UDim2.new(0, 0, 0, 20);
  2812. ZIndex = 1;
  2813. Parent = KeybindInner;
  2814. });
  2815.  
  2816. Library:Create('UIListLayout', {
  2817. FillDirection = Enum.FillDirection.Vertical;
  2818. SortOrder = Enum.SortOrder.LayoutOrder;
  2819. Parent = KeybindContainer;
  2820. });
  2821.  
  2822. Library:Create('UIPadding', {
  2823. PaddingLeft = UDim.new(0, 5),
  2824. Parent = KeybindContainer,
  2825. })
  2826.  
  2827. Library.KeybindFrame = KeybindOuter;
  2828. Library.KeybindContainer = KeybindContainer;
  2829. Library:MakeDraggable(KeybindOuter);
  2830. end;
  2831.  
  2832. function Library:SetWatermarkVisibility(Bool)
  2833. Library.Watermark.Visible = Bool;
  2834. end;
  2835.  
  2836. function Library:SetWatermark(Text)
  2837. local X, Y = Library:GetTextBounds(Text, Library.Font, 14);
  2838. Library.Watermark.Size = UDim2.new(0, X + 15, 0, (Y * 1.5) + 3);
  2839. Library:SetWatermarkVisibility(true)
  2840.  
  2841. Library.WatermarkText.Text = Text;
  2842. end;
  2843.  
  2844. function Library:Notify(Text, Time)
  2845. local XSize, YSize = Library:GetTextBounds(Text, Library.Font, 14);
  2846.  
  2847. YSize = YSize + 7
  2848.  
  2849. local NotifyOuter = Library:Create('Frame', {
  2850. BorderColor3 = Color3.new(0, 0, 0);
  2851. Position = UDim2.new(0, 100, 0, 10);
  2852. Size = UDim2.new(0, 0, 0, YSize);
  2853. ClipsDescendants = true;
  2854. ZIndex = 100;
  2855. Parent = Library.NotificationArea;
  2856. });
  2857.  
  2858. local NotifyInner = Library:Create('Frame', {
  2859. BackgroundColor3 = Library.MainColor;
  2860. BorderColor3 = Library.OutlineColor;
  2861. BorderMode = Enum.BorderMode.Inset;
  2862. Size = UDim2.new(1, 0, 1, 0);
  2863. ZIndex = 101;
  2864. Parent = NotifyOuter;
  2865. });
  2866.  
  2867. Library:AddToRegistry(NotifyInner, {
  2868. BackgroundColor3 = 'MainColor';
  2869. BorderColor3 = 'OutlineColor';
  2870. }, true);
  2871.  
  2872. local InnerFrame = Library:Create('Frame', {
  2873. BackgroundColor3 = Color3.new(1, 1, 1);
  2874. BorderSizePixel = 0;
  2875. Position = UDim2.new(0, 1, 0, 1);
  2876. Size = UDim2.new(1, -2, 1, -2);
  2877. ZIndex = 102;
  2878. Parent = NotifyInner;
  2879. });
  2880.  
  2881. local Gradient = Library:Create('UIGradient', {
  2882. Color = ColorSequence.new({
  2883. ColorSequenceKeypoint.new(0, Library:GetDarkerColor(Library.MainColor)),
  2884. ColorSequenceKeypoint.new(1, Library.MainColor),
  2885. });
  2886. Rotation = -90;
  2887. Parent = InnerFrame;
  2888. });
  2889.  
  2890. Library:AddToRegistry(Gradient, {
  2891. Color = function()
  2892. return ColorSequence.new({
  2893. ColorSequenceKeypoint.new(0, Library:GetDarkerColor(Library.MainColor)),
  2894. ColorSequenceKeypoint.new(1, Library.MainColor),
  2895. });
  2896. end
  2897. });
  2898.  
  2899. local NotifyLabel = Library:CreateLabel({
  2900. Position = UDim2.new(0, 4, 0, 0);
  2901. Size = UDim2.new(1, -4, 1, 0);
  2902. Text = Text;
  2903. TextXAlignment = Enum.TextXAlignment.Left;
  2904. TextSize = 14;
  2905. ZIndex = 103;
  2906. Parent = InnerFrame;
  2907. });
  2908.  
  2909. local LeftColor = Library:Create('Frame', {
  2910. BackgroundColor3 = Library.AccentColor;
  2911. BorderSizePixel = 0;
  2912. Position = UDim2.new(0, -1, 0, -1);
  2913. Size = UDim2.new(0, 3, 1, 2);
  2914. ZIndex = 104;
  2915. Parent = NotifyOuter;
  2916. });
  2917.  
  2918. Library:AddToRegistry(LeftColor, {
  2919. BackgroundColor3 = 'AccentColor';
  2920. }, true);
  2921.  
  2922. pcall(NotifyOuter.TweenSize, NotifyOuter, UDim2.new(0, XSize + 8 + 4, 0, YSize), 'Out', 'Quad', 0.4, true);
  2923.  
  2924. task.spawn(function()
  2925. wait(Time or 5);
  2926.  
  2927. pcall(NotifyOuter.TweenSize, NotifyOuter, UDim2.new(0, 0, 0, YSize), 'Out', 'Quad', 0.4, true);
  2928.  
  2929. wait(0.4);
  2930.  
  2931. NotifyOuter:Destroy();
  2932. end);
  2933. end;
  2934.  
  2935. function Library:CreateWindow(...)
  2936. local Arguments = { ... }
  2937. local Config = { AnchorPoint = Vector2.zero }
  2938.  
  2939. if type(...) == 'table' then
  2940. Config = ...;
  2941. else
  2942. Config.Title = Arguments[1]
  2943. Config.AutoShow = Arguments[2] or false;
  2944. end
  2945.  
  2946. if type(Config.Title) ~= 'string' then Config.Title = 'No title' end
  2947. if type(Config.TabPadding) ~= 'number' then Config.TabPadding = 0 end
  2948. if type(Config.MenuFadeTime) ~= 'number' then Config.MenuFadeTime = 0.2 end
  2949.  
  2950. if typeof(Config.Position) ~= 'UDim2' then Config.Position = UDim2.fromOffset(175, 50) end
  2951. if typeof(Config.Size) ~= 'UDim2' then Config.Size = UDim2.fromOffset(550, 600) end
  2952.  
  2953. if Config.Center then
  2954. Config.AnchorPoint = Vector2.new(0.5, 0.5)
  2955. Config.Position = UDim2.fromScale(0.5, 0.5)
  2956. end
  2957.  
  2958. local Window = {
  2959. Tabs = {};
  2960. };
  2961.  
  2962. local Outer = Library:Create('Frame', {
  2963. AnchorPoint = Config.AnchorPoint,
  2964. BackgroundColor3 = Color3.new(0, 0, 0);
  2965. BorderSizePixel = 0;
  2966. Position = Config.Position,
  2967. Size = Config.Size,
  2968. Visible = false;
  2969. ZIndex = 1;
  2970. Parent = ScreenGui;
  2971. });
  2972.  
  2973. Library:MakeDraggable(Outer, 25);
  2974.  
  2975. local Inner = Library:Create('Frame', {
  2976. BackgroundColor3 = Library.MainColor;
  2977. BorderColor3 = Library.AccentColor;
  2978. BorderMode = Enum.BorderMode.Inset;
  2979. Position = UDim2.new(0, 1, 0, 1);
  2980. Size = UDim2.new(1, -2, 1, -2);
  2981. ZIndex = 1;
  2982. Parent = Outer;
  2983. });
  2984.  
  2985. Library:AddToRegistry(Inner, {
  2986. BackgroundColor3 = 'MainColor';
  2987. BorderColor3 = 'AccentColor';
  2988. });
  2989.  
  2990. local WindowLabel = Library:CreateLabel({
  2991. Position = UDim2.new(0, 7, 0, 0);
  2992. Size = UDim2.new(0, 0, 0, 25);
  2993. Text = Config.Title or '';
  2994. TextXAlignment = Enum.TextXAlignment.Left;
  2995. ZIndex = 1;
  2996. Parent = Inner;
  2997. });
  2998.  
  2999. local MainSectionOuter = Library:Create('Frame', {
  3000. BackgroundColor3 = Library.BackgroundColor;
  3001. BorderColor3 = Library.OutlineColor;
  3002. Position = UDim2.new(0, 8, 0, 25);
  3003. Size = UDim2.new(1, -16, 1, -33);
  3004. ZIndex = 1;
  3005. Parent = Inner;
  3006. });
  3007.  
  3008. Library:AddToRegistry(MainSectionOuter, {
  3009. BackgroundColor3 = 'BackgroundColor';
  3010. BorderColor3 = 'OutlineColor';
  3011. });
  3012.  
  3013. local MainSectionInner = Library:Create('Frame', {
  3014. BackgroundColor3 = Library.BackgroundColor;
  3015. BorderColor3 = Color3.new(0, 0, 0);
  3016. BorderMode = Enum.BorderMode.Inset;
  3017. Position = UDim2.new(0, 0, 0, 0);
  3018. Size = UDim2.new(1, 0, 1, 0);
  3019. ZIndex = 1;
  3020. Parent = MainSectionOuter;
  3021. });
  3022.  
  3023. Library:AddToRegistry(MainSectionInner, {
  3024. BackgroundColor3 = 'BackgroundColor';
  3025. });
  3026.  
  3027. local TabArea = Library:Create('Frame', {
  3028. BackgroundTransparency = 1;
  3029. Position = UDim2.new(0, 8, 0, 8);
  3030. Size = UDim2.new(1, -16, 0, 21);
  3031. ZIndex = 1;
  3032. Parent = MainSectionInner;
  3033. });
  3034.  
  3035. local TabListLayout = Library:Create('UIListLayout', {
  3036. Padding = UDim.new(0, Config.TabPadding);
  3037. FillDirection = Enum.FillDirection.Horizontal;
  3038. SortOrder = Enum.SortOrder.LayoutOrder;
  3039. Parent = TabArea;
  3040. });
  3041.  
  3042. local TabContainer = Library:Create('Frame', {
  3043. BackgroundColor3 = Library.MainColor;
  3044. BorderColor3 = Library.OutlineColor;
  3045. Position = UDim2.new(0, 8, 0, 30);
  3046. Size = UDim2.new(1, -16, 1, -38);
  3047. ZIndex = 2;
  3048. Parent = MainSectionInner;
  3049. });
  3050.  
  3051.  
  3052. Library:AddToRegistry(TabContainer, {
  3053. BackgroundColor3 = 'MainColor';
  3054. BorderColor3 = 'OutlineColor';
  3055. });
  3056.  
  3057. function Window:SetWindowTitle(Title)
  3058. WindowLabel.Text = Title;
  3059. end;
  3060.  
  3061. function Window:AddTab(Name)
  3062. local Tab = {
  3063. Groupboxes = {};
  3064. Tabboxes = {};
  3065. };
  3066.  
  3067. local TabButtonWidth = Library:GetTextBounds(Name, Library.Font, 16);
  3068.  
  3069. local TabButton = Library:Create('Frame', {
  3070. BackgroundColor3 = Library.BackgroundColor;
  3071. BorderColor3 = Library.OutlineColor;
  3072. Size = UDim2.new(0, TabButtonWidth + 8 + 4, 1, 0);
  3073. ZIndex = 1;
  3074. Parent = TabArea;
  3075. });
  3076.  
  3077. Library:AddToRegistry(TabButton, {
  3078. BackgroundColor3 = 'BackgroundColor';
  3079. BorderColor3 = 'OutlineColor';
  3080. });
  3081.  
  3082. local TabButtonLabel = Library:CreateLabel({
  3083. Position = UDim2.new(0, 0, 0, 0);
  3084. Size = UDim2.new(1, 0, 1, -1);
  3085. Text = Name;
  3086. ZIndex = 1;
  3087. Parent = TabButton;
  3088. });
  3089.  
  3090. local Blocker = Library:Create('Frame', {
  3091. BackgroundColor3 = Library.MainColor;
  3092. BorderSizePixel = 0;
  3093. Position = UDim2.new(0, 0, 1, 0);
  3094. Size = UDim2.new(1, 0, 0, 1);
  3095. BackgroundTransparency = 1;
  3096. ZIndex = 3;
  3097. Parent = TabButton;
  3098. });
  3099.  
  3100. Library:AddToRegistry(Blocker, {
  3101. BackgroundColor3 = 'MainColor';
  3102. });
  3103.  
  3104. local TabFrame = Library:Create('Frame', {
  3105. Name = 'TabFrame',
  3106. BackgroundTransparency = 1;
  3107. Position = UDim2.new(0, 0, 0, 0);
  3108. Size = UDim2.new(1, 0, 1, 0);
  3109. Visible = false;
  3110. ZIndex = 2;
  3111. Parent = TabContainer;
  3112. });
  3113.  
  3114. local LeftSide = Library:Create('ScrollingFrame', {
  3115. BackgroundTransparency = 1;
  3116. BorderSizePixel = 0;
  3117. Position = UDim2.new(0, 8 - 1, 0, 8 - 1);
  3118. Size = UDim2.new(0.5, -12 + 2, 0, 507 + 2);
  3119. CanvasSize = UDim2.new(0, 0, 0, 0);
  3120. BottomImage = '';
  3121. TopImage = '';
  3122. ScrollBarThickness = 0;
  3123. ZIndex = 2;
  3124. Parent = TabFrame;
  3125. });
  3126.  
  3127. local RightSide = Library:Create('ScrollingFrame', {
  3128. BackgroundTransparency = 1;
  3129. BorderSizePixel = 0;
  3130. Position = UDim2.new(0.5, 4 + 1, 0, 8 - 1);
  3131. Size = UDim2.new(0.5, -12 + 2, 0, 507 + 2);
  3132. CanvasSize = UDim2.new(0, 0, 0, 0);
  3133. BottomImage = '';
  3134. TopImage = '';
  3135. ScrollBarThickness = 0;
  3136. ZIndex = 2;
  3137. Parent = TabFrame;
  3138. });
  3139.  
  3140. Library:Create('UIListLayout', {
  3141. Padding = UDim.new(0, 8);
  3142. FillDirection = Enum.FillDirection.Vertical;
  3143. SortOrder = Enum.SortOrder.LayoutOrder;
  3144. HorizontalAlignment = Enum.HorizontalAlignment.Center;
  3145. Parent = LeftSide;
  3146. });
  3147.  
  3148. Library:Create('UIListLayout', {
  3149. Padding = UDim.new(0, 8);
  3150. FillDirection = Enum.FillDirection.Vertical;
  3151. SortOrder = Enum.SortOrder.LayoutOrder;
  3152. HorizontalAlignment = Enum.HorizontalAlignment.Center;
  3153. Parent = RightSide;
  3154. });
  3155.  
  3156. for _, Side in next, { LeftSide, RightSide } do
  3157. Side:WaitForChild('UIListLayout'):GetPropertyChangedSignal('AbsoluteContentSize'):Connect(function()
  3158. Side.CanvasSize = UDim2.fromOffset(0, Side.UIListLayout.AbsoluteContentSize.Y);
  3159. end);
  3160. end;
  3161.  
  3162. function Tab:ShowTab()
  3163. for _, Tab in next, Window.Tabs do
  3164. Tab:HideTab();
  3165. end;
  3166.  
  3167. Blocker.BackgroundTransparency = 0;
  3168. TabButton.BackgroundColor3 = Library.MainColor;
  3169. Library.RegistryMap[TabButton].Properties.BackgroundColor3 = 'MainColor';
  3170. TabFrame.Visible = true;
  3171. end;
  3172.  
  3173. function Tab:HideTab()
  3174. Blocker.BackgroundTransparency = 1;
  3175. TabButton.BackgroundColor3 = Library.BackgroundColor;
  3176. Library.RegistryMap[TabButton].Properties.BackgroundColor3 = 'BackgroundColor';
  3177. TabFrame.Visible = false;
  3178. end;
  3179.  
  3180. function Tab:SetLayoutOrder(Position)
  3181. TabButton.LayoutOrder = Position;
  3182. TabListLayout:ApplyLayout();
  3183. end;
  3184.  
  3185. function Tab:AddGroupbox(Info)
  3186. local Groupbox = {};
  3187.  
  3188. local BoxOuter = Library:Create('Frame', {
  3189. BackgroundColor3 = Library.BackgroundColor;
  3190. BorderColor3 = Library.OutlineColor;
  3191. BorderMode = Enum.BorderMode.Inset;
  3192. Size = UDim2.new(1, 0, 0, 507 + 2);
  3193. ZIndex = 2;
  3194. Parent = Info.Side == 1 and LeftSide or RightSide;
  3195. });
  3196.  
  3197. Library:AddToRegistry(BoxOuter, {
  3198. BackgroundColor3 = 'BackgroundColor';
  3199. BorderColor3 = 'OutlineColor';
  3200. });
  3201.  
  3202. local BoxInner = Library:Create('Frame', {
  3203. BackgroundColor3 = Library.BackgroundColor;
  3204. BorderColor3 = Color3.new(0, 0, 0);
  3205. -- BorderMode = Enum.BorderMode.Inset;
  3206. Size = UDim2.new(1, -2, 1, -2);
  3207. Position = UDim2.new(0, 1, 0, 1);
  3208. ZIndex = 4;
  3209. Parent = BoxOuter;
  3210. });
  3211.  
  3212. Library:AddToRegistry(BoxInner, {
  3213. BackgroundColor3 = 'BackgroundColor';
  3214. });
  3215.  
  3216. local Highlight = Library:Create('Frame', {
  3217. BackgroundColor3 = Library.AccentColor;
  3218. BorderSizePixel = 0;
  3219. Size = UDim2.new(1, 0, 0, 2);
  3220. ZIndex = 5;
  3221. Parent = BoxInner;
  3222. });
  3223.  
  3224. Library:AddToRegistry(Highlight, {
  3225. BackgroundColor3 = 'AccentColor';
  3226. });
  3227.  
  3228. local GroupboxLabel = Library:CreateLabel({
  3229. Size = UDim2.new(1, 0, 0, 18);
  3230. Position = UDim2.new(0, 4, 0, 2);
  3231. TextSize = 14;
  3232. Text = Info.Name;
  3233. TextXAlignment = Enum.TextXAlignment.Left;
  3234. ZIndex = 5;
  3235. Parent = BoxInner;
  3236. });
  3237.  
  3238. local Container = Library:Create('Frame', {
  3239. BackgroundTransparency = 1;
  3240. Position = UDim2.new(0, 4, 0, 20);
  3241. Size = UDim2.new(1, -4, 1, -20);
  3242. ZIndex = 1;
  3243. Parent = BoxInner;
  3244. });
  3245.  
  3246. Library:Create('UIListLayout', {
  3247. FillDirection = Enum.FillDirection.Vertical;
  3248. SortOrder = Enum.SortOrder.LayoutOrder;
  3249. Parent = Container;
  3250. });
  3251.  
  3252. function Groupbox:Resize()
  3253. local Size = 0;
  3254.  
  3255. for _, Element in next, Groupbox.Container:GetChildren() do
  3256. if (not Element:IsA('UIListLayout')) and Element.Visible then
  3257. Size = Size + Element.Size.Y.Offset;
  3258. end;
  3259. end;
  3260.  
  3261. BoxOuter.Size = UDim2.new(1, 0, 0, 20 + Size + 2 + 2);
  3262. end;
  3263.  
  3264. Groupbox.Container = Container;
  3265. setmetatable(Groupbox, BaseGroupbox);
  3266.  
  3267. Groupbox:AddBlank(3);
  3268. Groupbox:Resize();
  3269.  
  3270. Tab.Groupboxes[Info.Name] = Groupbox;
  3271.  
  3272. return Groupbox;
  3273. end;
  3274.  
  3275. function Tab:AddLeftGroupbox(Name)
  3276. return Tab:AddGroupbox({ Side = 1; Name = Name; });
  3277. end;
  3278.  
  3279. function Tab:AddRightGroupbox(Name)
  3280. return Tab:AddGroupbox({ Side = 2; Name = Name; });
  3281. end;
  3282.  
  3283. function Tab:AddTabbox(Info)
  3284. local Tabbox = {
  3285. Tabs = {};
  3286. };
  3287.  
  3288. local BoxOuter = Library:Create('Frame', {
  3289. BackgroundColor3 = Library.BackgroundColor;
  3290. BorderColor3 = Library.OutlineColor;
  3291. BorderMode = Enum.BorderMode.Inset;
  3292. Size = UDim2.new(1, 0, 0, 0);
  3293. ZIndex = 2;
  3294. Parent = Info.Side == 1 and LeftSide or RightSide;
  3295. });
  3296.  
  3297. Library:AddToRegistry(BoxOuter, {
  3298. BackgroundColor3 = 'BackgroundColor';
  3299. BorderColor3 = 'OutlineColor';
  3300. });
  3301.  
  3302. local BoxInner = Library:Create('Frame', {
  3303. BackgroundColor3 = Library.BackgroundColor;
  3304. BorderColor3 = Color3.new(0, 0, 0);
  3305. -- BorderMode = Enum.BorderMode.Inset;
  3306. Size = UDim2.new(1, -2, 1, -2);
  3307. Position = UDim2.new(0, 1, 0, 1);
  3308. ZIndex = 4;
  3309. Parent = BoxOuter;
  3310. });
  3311.  
  3312. Library:AddToRegistry(BoxInner, {
  3313. BackgroundColor3 = 'BackgroundColor';
  3314. });
  3315.  
  3316. local Highlight = Library:Create('Frame', {
  3317. BackgroundColor3 = Library.AccentColor;
  3318. BorderSizePixel = 0;
  3319. Size = UDim2.new(1, 0, 0, 2);
  3320. ZIndex = 10;
  3321. Parent = BoxInner;
  3322. });
  3323.  
  3324. Library:AddToRegistry(Highlight, {
  3325. BackgroundColor3 = 'AccentColor';
  3326. });
  3327.  
  3328. local TabboxButtons = Library:Create('Frame', {
  3329. BackgroundTransparency = 1;
  3330. Position = UDim2.new(0, 0, 0, 1);
  3331. Size = UDim2.new(1, 0, 0, 18);
  3332. ZIndex = 5;
  3333. Parent = BoxInner;
  3334. });
  3335.  
  3336. Library:Create('UIListLayout', {
  3337. FillDirection = Enum.FillDirection.Horizontal;
  3338. HorizontalAlignment = Enum.HorizontalAlignment.Left;
  3339. SortOrder = Enum.SortOrder.LayoutOrder;
  3340. Parent = TabboxButtons;
  3341. });
  3342.  
  3343. function Tabbox:AddTab(Name)
  3344. local Tab = {};
  3345.  
  3346. local Button = Library:Create('Frame', {
  3347. BackgroundColor3 = Library.MainColor;
  3348. BorderColor3 = Color3.new(0, 0, 0);
  3349. Size = UDim2.new(0.5, 0, 1, 0);
  3350. ZIndex = 6;
  3351. Parent = TabboxButtons;
  3352. });
  3353.  
  3354. Library:AddToRegistry(Button, {
  3355. BackgroundColor3 = 'MainColor';
  3356. });
  3357.  
  3358. local ButtonLabel = Library:CreateLabel({
  3359. Size = UDim2.new(1, 0, 1, 0);
  3360. TextSize = 14;
  3361. Text = Name;
  3362. TextXAlignment = Enum.TextXAlignment.Center;
  3363. ZIndex = 7;
  3364. Parent = Button;
  3365. });
  3366.  
  3367. local Block = Library:Create('Frame', {
  3368. BackgroundColor3 = Library.BackgroundColor;
  3369. BorderSizePixel = 0;
  3370. Position = UDim2.new(0, 0, 1, 0);
  3371. Size = UDim2.new(1, 0, 0, 1);
  3372. Visible = false;
  3373. ZIndex = 9;
  3374. Parent = Button;
  3375. });
  3376.  
  3377. Library:AddToRegistry(Block, {
  3378. BackgroundColor3 = 'BackgroundColor';
  3379. });
  3380.  
  3381. local Container = Library:Create('Frame', {
  3382. BackgroundTransparency = 1;
  3383. Position = UDim2.new(0, 4, 0, 20);
  3384. Size = UDim2.new(1, -4, 1, -20);
  3385. ZIndex = 1;
  3386. Visible = false;
  3387. Parent = BoxInner;
  3388. });
  3389.  
  3390. Library:Create('UIListLayout', {
  3391. FillDirection = Enum.FillDirection.Vertical;
  3392. SortOrder = Enum.SortOrder.LayoutOrder;
  3393. Parent = Container;
  3394. });
  3395.  
  3396. function Tab:Show()
  3397. for _, Tab in next, Tabbox.Tabs do
  3398. Tab:Hide();
  3399. end;
  3400.  
  3401. Container.Visible = true;
  3402. Block.Visible = true;
  3403.  
  3404. Button.BackgroundColor3 = Library.BackgroundColor;
  3405. Library.RegistryMap[Button].Properties.BackgroundColor3 = 'BackgroundColor';
  3406.  
  3407. Tab:Resize();
  3408. end;
  3409.  
  3410. function Tab:Hide()
  3411. Container.Visible = false;
  3412. Block.Visible = false;
  3413.  
  3414. Button.BackgroundColor3 = Library.MainColor;
  3415. Library.RegistryMap[Button].Properties.BackgroundColor3 = 'MainColor';
  3416. end;
  3417.  
  3418. function Tab:Resize()
  3419. local TabCount = 0;
  3420.  
  3421. for _, Tab in next, Tabbox.Tabs do
  3422. TabCount = TabCount + 1;
  3423. end;
  3424.  
  3425. for _, Button in next, TabboxButtons:GetChildren() do
  3426. if not Button:IsA('UIListLayout') then
  3427. Button.Size = UDim2.new(1 / TabCount, 0, 1, 0);
  3428. end;
  3429. end;
  3430.  
  3431. if (not Container.Visible) then
  3432. return;
  3433. end;
  3434.  
  3435. local Size = 0;
  3436.  
  3437. for _, Element in next, Tab.Container:GetChildren() do
  3438. if (not Element:IsA('UIListLayout')) and Element.Visible then
  3439. Size = Size + Element.Size.Y.Offset;
  3440. end;
  3441. end;
  3442.  
  3443. BoxOuter.Size = UDim2.new(1, 0, 0, 20 + Size + 2 + 2);
  3444. end;
  3445.  
  3446. Button.InputBegan:Connect(function(Input)
  3447. if Input.UserInputType == Enum.UserInputType.MouseButton1 and not Library:MouseIsOverOpenedFrame() then
  3448. Tab:Show();
  3449. Tab:Resize();
  3450. end;
  3451. end);
  3452.  
  3453. Tab.Container = Container;
  3454. Tabbox.Tabs[Name] = Tab;
  3455.  
  3456. setmetatable(Tab, BaseGroupbox);
  3457.  
  3458. Tab:AddBlank(3);
  3459. Tab:Resize();
  3460.  
  3461. -- Show first tab (number is 2 cus of the UIListLayout that also sits in that instance)
  3462. if #TabboxButtons:GetChildren() == 2 then
  3463. Tab:Show();
  3464. end;
  3465.  
  3466. return Tab;
  3467. end;
  3468.  
  3469. Tab.Tabboxes[Info.Name or ''] = Tabbox;
  3470.  
  3471. return Tabbox;
  3472. end;
  3473.  
  3474. function Tab:AddLeftTabbox(Name)
  3475. return Tab:AddTabbox({ Name = Name, Side = 1; });
  3476. end;
  3477.  
  3478. function Tab:AddRightTabbox(Name)
  3479. return Tab:AddTabbox({ Name = Name, Side = 2; });
  3480. end;
  3481.  
  3482. TabButton.InputBegan:Connect(function(Input)
  3483. if Input.UserInputType == Enum.UserInputType.MouseButton1 then
  3484. Tab:ShowTab();
  3485. end;
  3486. end);
  3487.  
  3488. -- This was the first tab added, so we show it by default.
  3489. if #TabContainer:GetChildren() == 1 then
  3490. Tab:ShowTab();
  3491. end;
  3492.  
  3493. Window.Tabs[Name] = Tab;
  3494. return Tab;
  3495. end;
  3496.  
  3497. local ModalElement = Library:Create('TextButton', {
  3498. BackgroundTransparency = 1;
  3499. Size = UDim2.new(0, 0, 0, 0);
  3500. Visible = true;
  3501. Text = '';
  3502. Modal = false;
  3503. Parent = ScreenGui;
  3504. });
  3505.  
  3506. local TransparencyCache = {};
  3507. local Toggled = false;
  3508. local Fading = false;
  3509.  
  3510. function Library:Toggle()
  3511. if Fading then
  3512. return;
  3513. end;
  3514.  
  3515. local FadeTime = Config.MenuFadeTime;
  3516. Fading = true;
  3517. Toggled = (not Toggled);
  3518. ModalElement.Modal = Toggled;
  3519.  
  3520. if Toggled then
  3521. -- A bit scuffed, but if we're going from not toggled -> toggled we want to show the frame immediately so that the fade is visible.
  3522. Outer.Visible = true;
  3523.  
  3524. task.spawn(function()
  3525. -- TODO: add cursor fade?
  3526. local State = InputService.MouseIconEnabled;
  3527.  
  3528. local Cursor = Drawing.new('Triangle');
  3529. Cursor.Thickness = 1;
  3530. Cursor.Filled = true;
  3531. Cursor.Visible = true;
  3532.  
  3533. local CursorOutline = Drawing.new('Triangle');
  3534. CursorOutline.Thickness = 1;
  3535. CursorOutline.Filled = false;
  3536. CursorOutline.Color = Color3.new(0, 0, 0);
  3537. CursorOutline.Visible = true;
  3538.  
  3539. while Toggled and ScreenGui.Parent do
  3540. InputService.MouseIconEnabled = false;
  3541.  
  3542. local mPos = InputService:GetMouseLocation();
  3543.  
  3544. Cursor.Color = Library.AccentColor;
  3545.  
  3546. Cursor.PointA = Vector2.new(mPos.X, mPos.Y);
  3547. Cursor.PointB = Vector2.new(mPos.X + 16, mPos.Y + 6);
  3548. Cursor.PointC = Vector2.new(mPos.X + 6, mPos.Y + 16);
  3549.  
  3550. CursorOutline.PointA = Cursor.PointA;
  3551. CursorOutline.PointB = Cursor.PointB;
  3552. CursorOutline.PointC = Cursor.PointC;
  3553.  
  3554. RenderStepped:Wait();
  3555. end;
  3556.  
  3557. InputService.MouseIconEnabled = State;
  3558.  
  3559. Cursor:Remove();
  3560. CursorOutline:Remove();
  3561. end);
  3562. end;
  3563.  
  3564. for _, Desc in next, Outer:GetDescendants() do
  3565. local Properties = {};
  3566.  
  3567. if Desc:IsA('ImageLabel') then
  3568. table.insert(Properties, 'ImageTransparency');
  3569. table.insert(Properties, 'BackgroundTransparency');
  3570. elseif Desc:IsA('TextLabel') or Desc:IsA('TextBox') then
  3571. table.insert(Properties, 'TextTransparency');
  3572. elseif Desc:IsA('Frame') or Desc:IsA('ScrollingFrame') then
  3573. table.insert(Properties, 'BackgroundTransparency');
  3574. elseif Desc:IsA('UIStroke') then
  3575. table.insert(Properties, 'Transparency');
  3576. end;
  3577.  
  3578. local Cache = TransparencyCache[Desc];
  3579.  
  3580. if (not Cache) then
  3581. Cache = {};
  3582. TransparencyCache[Desc] = Cache;
  3583. end;
  3584.  
  3585. for _, Prop in next, Properties do
  3586. if not Cache[Prop] then
  3587. Cache[Prop] = Desc[Prop];
  3588. end;
  3589.  
  3590. if Cache[Prop] == 1 then
  3591. continue;
  3592. end;
  3593.  
  3594. TweenService:Create(Desc, TweenInfo.new(FadeTime, Enum.EasingStyle.Linear), { [Prop] = Toggled and Cache[Prop] or 1 }):Play();
  3595. end;
  3596. end;
  3597.  
  3598. task.wait(FadeTime);
  3599.  
  3600. Outer.Visible = Toggled;
  3601.  
  3602. Fading = false;
  3603. end
  3604.  
  3605. Library:GiveSignal(InputService.InputBegan:Connect(function(Input, Processed)
  3606. if type(Library.ToggleKeybind) == 'table' and Library.ToggleKeybind.Type == 'KeyPicker' then
  3607. if Input.UserInputType == Enum.UserInputType.Keyboard and Input.KeyCode.Name == Library.ToggleKeybind.Value then
  3608. task.spawn(Library.Toggle)
  3609. end
  3610. elseif Input.KeyCode == Enum.KeyCode.RightControl or (Input.KeyCode == Enum.KeyCode.RightShift and (not Processed)) then
  3611. task.spawn(Library.Toggle)
  3612. end
  3613. end))
  3614.  
  3615. if Config.AutoShow then task.spawn(Library.Toggle) end
  3616.  
  3617. Window.Holder = Outer;
  3618.  
  3619. return Window;
  3620. end;
  3621.  
  3622. local function OnPlayerChange()
  3623. local PlayerList = GetPlayersString();
  3624.  
  3625. for _, Value in next, Options do
  3626. if Value.Type == 'Dropdown' and Value.SpecialType == 'Player' then
  3627. Value:SetValues(PlayerList);
  3628. end;
  3629. end;
  3630. end;
  3631.  
  3632. Players.PlayerAdded:Connect(OnPlayerChange);
  3633. Players.PlayerRemoving:Connect(OnPlayerChange);
  3634.  
  3635. getgenv().Library = Library
  3636. return Library
Add Comment
Please, Sign In to add comment