Advertisement
GUI_Maker_Roblox

RT

Apr 13th, 2025
16
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 64.84 KB | None | 0 0
  1. local RunService = game:GetService("RunService")
  2. local UserInputService = game:GetService("UserInputService")
  3.  
  4. local ScreenGui = game:GetObjects("rbxassetid://99852798675591")[1]
  5. ScreenGui.Enabled = false
  6. ScreenGui.Parent = cloneref(game.Players.LocalPlayer:WaitForChild("PlayerGui"))
  7.  
  8. local Library = {
  9. sizeX = 800,
  10. sizeY = 600,
  11. tabSizeX = 200,
  12.  
  13. dragging = false,
  14. sliderDragging = false,
  15. firstTabDebounce = false,
  16. firstSubTabDebounce = false,
  17. processedEvent = false,
  18. managerCreated = false, -- Using this as a check to clean up unused Addon objects
  19. lineIndex = 0,
  20.  
  21. Connections = {},
  22. Addons = {}, -- To store addon frames to clean up unused ones later, this is my solution to this problem, if you can find a better solution then just create a pull request, thanks.
  23. Exclusions = {},
  24. SectionFolder = {
  25. Left = {},
  26. Right = {},
  27. },
  28. Flags = {
  29. Toggle = {},
  30. Slider = {},
  31. TextBox = {},
  32. Keybind = {},
  33. Dropdown = {},
  34. ColorPicker = {},
  35. },
  36. Theme = {},
  37. DropdownSizes = {}, -- to store previous opened dropdown size to resize scrollingFrame canvassize
  38. }
  39. Library.__index = Library
  40.  
  41. shared.Flags = Library.Flags
  42.  
  43. local Connections = Library.Connections
  44. local Exclusions = Library.Exclusions
  45.  
  46. local Assets = ScreenGui.Assets
  47. local Modules = {
  48. Dropdown = loadstring(game:HttpGetAsync("https://raw.githubusercontent.com/L3nyFromV3rm/Leny-UI/refs/heads/main/Modules/Dropdown.lua", true))(),
  49. Toggle = loadstring(game:HttpGetAsync("https://raw.githubusercontent.com/L3nyFromV3rm/Leny-UI/refs/heads/main/Modules/Toggle.lua", true))(),
  50. Popup = loadstring(game:HttpGetAsync("https://raw.githubusercontent.com/L3nyFromV3rm/Leny-UI/refs/heads/main/Modules/Popup.lua", true))(),
  51. Slider = loadstring(game:HttpGetAsync("https://raw.githubusercontent.com/L3nyFromV3rm/Leny-UI/refs/heads/main/Modules/Slider.lua", true))(),
  52. Keybind = loadstring(game:HttpGetAsync("https://raw.githubusercontent.com/L3nyFromV3rm/Leny-UI/refs/heads/main/Modules/Keybind.lua", true))(),
  53. TextBox = loadstring(game:HttpGetAsync("https://raw.githubusercontent.com/L3nyFromV3rm/Leny-UI/refs/heads/main/Modules/TextBox.lua", true))(),
  54. Navigation = loadstring(game:HttpGetAsync("https://raw.githubusercontent.com/L3nyFromV3rm/Leny-UI/refs/heads/main/Modules/Navigation.lua", true))(),
  55. ColorPicker = loadstring(game:HttpGetAsync("https://raw.githubusercontent.com/L3nyFromV3rm/Leny-UI/refs/heads/main/Modules/ColorPicker.lua", true))(),
  56. }
  57.  
  58. local Utility = loadstring(game:HttpGetAsync("https://raw.githubusercontent.com/L3nyFromV3rm/Leny-UI/refs/heads/main/Modules/Utility.lua", true))()
  59. local Theme = loadstring(game:HttpGetAsync("https://raw.githubusercontent.com/L3nyFromV3rm/Leny-UI/refs/heads/main/Modules/Theme.lua", true))()
  60. Library.Theme = Theme
  61.  
  62. local Popups = ScreenGui.Popups
  63.  
  64. -- Set default size for UI
  65. local Glow = ScreenGui.Glow
  66. Glow.Size = UDim2.fromOffset(Library.sizeX, Library.sizeY)
  67.  
  68. local Background = Glow.Background
  69.  
  70. local Tabs = Background.Tabs
  71. local Filler = Tabs.Filler
  72. local Resize = Filler.Resize
  73. local Line = Filler.Line
  74. local Title = Tabs.Frame.Title
  75.  
  76. -- Tab resizing stuff
  77. local tabResizing = false
  78. Resize.MouseButton1Down:Connect(function()
  79. tabResizing = true
  80. end)
  81.  
  82. local touchMoved = UserInputService.TouchMoved:Connect(function()
  83. if tabResizing then
  84. local newSizeX = math.clamp(((input.Position.X - Glow.AbsolutePosition.X) / Glow.AbsoluteSize.X) * Glow.AbsoluteSize.X, 72, 208)
  85. Utility:tween(Tabs, {Size = UDim2.new(0, newSizeX, 1, 0)}, 0.2):Play()
  86. Utility:tween(Background.Pages, {Size = UDim2.new(1, -newSizeX, 1, 0)}, 0.2):Play()
  87. end
  88. end)
  89.  
  90. local inputChanged = UserInputService.InputChanged:Connect(function(input)
  91. if tabResizing and input.UserInputType == Enum.UserInputType.MouseMovement then
  92. local newSizeX = math.clamp(((input.Position.X - Glow.AbsolutePosition.X) / Glow.AbsoluteSize.X) * Glow.AbsoluteSize.X, 72, 208)
  93. Utility:tween(Tabs, {Size = UDim2.new(0, newSizeX, 1, 0)}, 0.2):Play()
  94. Utility:tween(Background.Pages, {Size = UDim2.new(1, -newSizeX, 1, 0)}, 0.2):Play()
  95. end
  96. end)
  97.  
  98. local touchEnded = UserInputService.TouchEnded:Connect(function(input)
  99. if tabResizing then
  100. tabResizing = false
  101. end
  102. end)
  103.  
  104. table.insert(Connections, inputChanged)
  105.  
  106. Resize.InputEnded:Connect(function(input)
  107. if input.UserInputType == Enum.UserInputType.MouseButton1 then
  108. tabResizing = false
  109. end
  110. end)
  111.  
  112. -- Mobile compatibility
  113. Glow:GetPropertyChangedSignal("AbsoluteSize"):Connect(function()
  114. for _, data in ipairs(Library.SectionFolder.Right) do
  115. if Glow.AbsoluteSize.X <= 660 then
  116. data.folders.Right.Visible = false
  117. data.folders.Left.Size = UDim2.fromScale(1, 1)
  118. data.object.Parent = data.folders.Left
  119. else
  120. data.folders.Left.Size = UDim2.new(0.5, -7, 1, 0)
  121. data.folders.Right.Visible = true
  122. data.object.Parent = data.folders.Right
  123. end
  124. end
  125.  
  126. for _, data in ipairs(Library.SectionFolder.Left) do
  127. if Glow.AbsoluteSize.X <= 660 then
  128. data.folders.Right.Visible = false
  129. data.folders.Left.Size = UDim2.fromScale(1, 1)
  130. else
  131. data.folders.Left.Size = UDim2.new(0.5, -7, 1, 0)
  132. data.folders.Right.Visible = true
  133. end
  134. end
  135. end)
  136.  
  137. function Library.new(options)
  138. Utility:validateOptions(options, {
  139. sizeX = {Default = Library.sizeX, ExpectedType = "number"},
  140. sizeY = {Default = Library.sizeY, ExpectedType = "number"},
  141. tabSizeX = {Default = Library.tabSizeX, ExpectedType = "number"},
  142. title = {Default = "Leny", ExpectedType = "string"},
  143. PrimaryBackgroundColor = {Default = Library.Theme.PrimaryBackgroundColor, ExpectedType = "Color3"},
  144. SecondaryBackgroundColor = {Default = Library.Theme.SecondaryBackgroundColor, ExpectedType = "Color3"},
  145. TertiaryBackgroundColor = {Default = Library.Theme.TertiaryBackgroundColor, ExpectedType = "Color3"},
  146. TabBackgroundColor = {Default = Library.Theme.TabBackgroundColor, ExpectedType = "Color3"},
  147. PrimaryTextColor = {Default = Library.Theme.PrimaryTextColor, ExpectedType = "Color3"},
  148. SecondaryTextColor = {Default = Library.Theme.SecondaryTextColor, ExpectedType = "Color3"},
  149. PrimaryColor = {Default = Library.Theme.PrimaryColor, ExpectedType = "Color3"},
  150. ScrollingBarImageColor = {Default = Library.Theme.ScrollingBarImageColor, ExpectedType = "Color3"},
  151. Line = {Default = Library.Theme.Line, ExpectedType = "Color3"},
  152. })
  153.  
  154. Library.tabSizeX = math.clamp(options.tabSizeX, 72, 208)
  155. Library.sizeX = options.sizeX
  156. Library.sizeY = options.sizeY
  157. Library.Theme.PrimaryBackgroundColor = options.PrimaryBackgroundColor
  158. Library.Theme.SecondaryBackgroundColor = options.SecondaryBackgroundColor
  159. Library.Theme.TertiaryBackgroundColor = options.TertiaryBackgroundColor -- new
  160. Library.Theme.TabBackgroundColor = options.TabBackgroundColor
  161. Library.Theme.PrimaryTextColor = options.PrimaryTextColor
  162. Library.Theme.SecondaryTextColor = options.SecondaryTextColor
  163. Library.Theme.PrimaryColor = options.PrimaryColor
  164. Library.Theme.ScrollingBarImageColor = options.ScrollingBarImageColor
  165. Library.Theme.Line = options.Line
  166.  
  167. ScreenGui.Enabled = true
  168. Title.Text = options.title
  169. Glow.Size = UDim2.fromOffset(options.sizeX, options.sizeY)
  170. end
  171.  
  172. function Library:createAddons(text, imageButton, scrollingFrame, additionalAddons)
  173. local Addon = Assets.Elements.Addons:Clone()
  174. Addon.Size = UDim2.fromOffset(scrollingFrame.AbsoluteSize.X * 0.5, Addon.Inner.UIListLayout.AbsoluteContentSize.Y)
  175. table.insert(self.Addons, Addon)
  176.  
  177. local Inner = Addon.Inner
  178.  
  179. local TextLabel = Inner.TextLabel
  180. TextLabel.Text = text .. " Addons"
  181.  
  182. local PopupContext = Utility:validateContext({
  183. Popup = {Value = Addon, ExpectedType = "Instance"},
  184. Target = {Value = imageButton, ExpectedType = "Instance"},
  185. Library = {Value = Library, ExpectedType = "table"},
  186. TransparentObjects = {Value = Utility:getTransparentObjects(Addon), ExpectedType = "table"},
  187. ScrollingFrame = {Value = scrollingFrame, ExpectedType = "Instance"},
  188. Popups = {Value = Popups, ExpectedType = "Instance"},
  189. Inner = {Value = Inner, ExpectedType = "Instance"},
  190. PositionPadding = {Value = 18 + 7, ExpectedType = "number"},
  191. SizePadding = {Value = 30, ExpectedType = "number"},
  192. })
  193.  
  194. Theme:registerToObjects({
  195. {object = Addon, property = "BackgroundColor3", theme = {"Line"}},
  196. {object = Inner, property = "BackgroundColor3", theme = {"PrimaryBackgroundColor"}},
  197. {object = TextLabel, property = "TextColor3", theme = {"PrimaryTextColor"}},
  198. })
  199.  
  200. local Popup = Modules.Popup.new(PopupContext)
  201. imageButton.MouseButton1Down:Connect(Popup:togglePopup())
  202. Popup:hidePopupOnClickingOutside()
  203.  
  204. local DefaultAddons = {
  205. createToggle = function(self, options)
  206. Library:createToggle(options, Addon.Inner, scrollingFrame)
  207. end,
  208.  
  209. createSlider = function(self, options)
  210. Library:createSlider(options, Addon.Inner, scrollingFrame)
  211. end,
  212.  
  213. createDropdown = function(self, options)
  214. options.default = {} -- need to do this for some reason since I clearly implied that default was as table value but guess not?
  215. Library:createDropdown(options, Addon.Inner, scrollingFrame)
  216. end,
  217.  
  218. createPicker = function(self, options)
  219. Library:createPicker(options, Addon.Inner, scrollingFrame, true)
  220. end,
  221.  
  222. createKeybind = function(self, options)
  223. Library:createKeybind(options, Addon.Inner, scrollingFrame)
  224. end,
  225.  
  226. createButton = function(self, options)
  227. Library:createButton(options, Addon.Inner, scrollingFrame)
  228. end,
  229.  
  230. createTextBox = function(self, options)
  231. Library:createTextBox(options, Addon.Inner, scrollingFrame)
  232. end,
  233. }
  234.  
  235. for key, value in pairs(additionalAddons or {}) do
  236. DefaultAddons[key] = value
  237. end
  238.  
  239. return setmetatable({}, {
  240. __index = function(table, key)
  241. local originalFunction = DefaultAddons[key]
  242.  
  243. if type(originalFunction) == "function" then
  244. return function(...)
  245. -- Show imageButton if the index name is "create"
  246. if string.match(key, "create") then
  247. if Addon.Parent == nil then
  248. Addon.Parent = Popups
  249. end
  250.  
  251. imageButton.Visible = true
  252. end
  253.  
  254. -- updateTransparentObjects again to account for the new creation of element after the call.
  255. return originalFunction(...), Popup:updateTransparentObjects(Addon)
  256. end
  257. else
  258. return originalFunction
  259. end
  260. end,
  261.  
  262. __newindex = function(table, key, value)
  263. DefaultAddons[key] = value
  264. end
  265. })
  266. end
  267.  
  268. function Library:destroy()
  269. for _, rbxSignals in ipairs(Connections) do
  270. rbxSignals:disconnect()
  271. end
  272. task.wait(0.1)
  273. ScreenGui:Destroy()
  274. end
  275.  
  276. function Library:createLabel(options: table)
  277. Utility:validateOptions(options, {
  278. text = {Default = "Main", ExpectedType = "string"},
  279. })
  280.  
  281. options.text = string.upper(options.text)
  282.  
  283. local ScrollingFrame = Background.Tabs.Frame.ScrollingFrame
  284.  
  285. local Line = Assets.Tabs.Line:Clone()
  286. Line.Visible = true
  287. Line.BackgroundColor3 = Theme.Line
  288. Line.Parent = ScrollingFrame
  289.  
  290. local TextLabel = Assets.Tabs.TextLabel:Clone()
  291. TextLabel.Visible = true
  292. TextLabel.Text = options.text
  293. TextLabel.Parent = ScrollingFrame
  294.  
  295. for _, line in ipairs(ScrollingFrame:GetChildren()) do
  296. if line.Name ~= "Line" then
  297. continue
  298. end
  299.  
  300. self.lineIndex += 1
  301.  
  302. if self.lineIndex == 1 then
  303. line:Destroy()
  304. end
  305. end
  306.  
  307. Theme:registerToObjects({
  308. {object = TextLabel, property = "TextColor3", theme = {"SecondaryTextColor"}},
  309. {object = Line, property = "BackgroundColor3", theme = {"Line"}},
  310. })
  311. end
  312.  
  313. function Library:createTab(options: table)
  314. Utility:validateOptions(options, {
  315. text = {Default = "Tab", ExpectedType = "string"},
  316. icon = {Default = "124718082122263", ExpectedType = "string"},
  317. })
  318.  
  319. -- Change tab size depending on Library.tabSizeX, maybe make resizer for tabs later
  320. Background.Tabs.Size = UDim2.new(0, Library.tabSizeX, 1, 0)
  321. Background.Pages.Size = UDim2.new(1, -Library.tabSizeX, 1, 0)
  322.  
  323. local ScrollingFrame = Background.Tabs.Frame.ScrollingFrame
  324.  
  325. local Tab = Assets.Tabs.Tab:Clone()
  326. Tab.Visible = true
  327. Tab.Parent = ScrollingFrame
  328.  
  329. local ImageButton = Tab.ImageButton
  330.  
  331. local Icon = ImageButton.Icon
  332. Icon.Image = "rbxassetid://" .. options.icon
  333.  
  334. local TextButton = ImageButton.TextButton
  335. TextButton.Text = options.text
  336.  
  337. local Page = Assets.Pages.Page:Clone()
  338. Page.Parent = Background.Pages
  339.  
  340. local Frame = Page.Frame
  341. local PageLine = Frame.Line
  342.  
  343. local CurrentTabLabel = Frame.CurrentTabLabel
  344. CurrentTabLabel.Text = options.text
  345. CurrentTabLabel.TextColor3 = Theme.PrimaryTextColor
  346.  
  347. local SubTabs = Page.SubTabs
  348. local SubLine = SubTabs.Line
  349.  
  350. local function tweenTabAssets(tab: Instance, icon: Instance, textButton: Instance, color: textColor3, backgroundColor3: Color3, backgroundTransparency: number, textTransparency: number, imageTransparency: number)
  351. Utility:tween(tab, {BackgroundColor3 = backgroundColor3, BackgroundTransparency = backgroundTransparency}, 0.5):Play()
  352. Utility:tween(icon, {ImageTransparency = imageTransparency, ImageColor3 = color}, 0.5):Play()
  353. Utility:tween(textButton, {TextColor3 = color, TextTransparency = textTransparency}, 0.5):Play()
  354. end
  355.  
  356. local function fadeAnimation()
  357. local function tweenFadeAndPage(fade: Instance, backgroundTransparency: number, textTransparency: number, paddingY: number)
  358. Utility:tween(fade, {BackgroundTransparency = backgroundTransparency}, 0.2):Play()
  359. Utility:tween(CurrentTabLabel.UIPadding, {PaddingBottom = UDim.new(0, paddingY)}, 0.2):Play()
  360. end
  361.  
  362. for _, subPage in ipairs(Page:GetChildren()) do
  363. if subPage.Name == "SubPage" and subPage.Visible and subPage:FindFirstChild("ScrollingFrame") then
  364. Utility:tween(subPage.ScrollingFrame.UIPadding, {PaddingTop = UDim.new(0, 10)}, 0.2):Play()
  365.  
  366. task.delay(0.2, function()
  367. Utility:tween(subPage.ScrollingFrame.UIPadding, {PaddingTop = UDim.new(0, 0)}, 0.2):Play()
  368. end)
  369. end
  370. end
  371.  
  372. local Fade = Assets.Pages.Fade:Clone()
  373. Fade.BackgroundTransparency = 1
  374. Fade.Visible = true
  375. Fade.Parent = Background.Pages
  376.  
  377. tweenFadeAndPage(Fade, 0, 1, 14)
  378.  
  379. task.delay(0.2, function()
  380. tweenFadeAndPage(Fade, 1, 0, 0)
  381. task.wait(0.2)
  382. Fade:Destroy()
  383. end)
  384. end
  385.  
  386. local Context = Utility:validateContext({
  387. Page = {Value = Page, ExpectedType = "Instance"},
  388. Pages = {Value = Background.Pages, ExpectedType = "Instance"},
  389. Popups = {Value = Popups, ExpectedType = "Instance"},
  390. ScrollingFrame = {Value = Background.Tabs.Frame.ScrollingFrame, ExpectedType = "Instance"},
  391. animation = {Value = fadeAnimation, ExpectedType = "function"},
  392.  
  393. tweenTabOn = {Value = function()
  394. tweenTabAssets(Tab, Icon, TextButton, Theme.PrimaryColor, Theme.TabBackgroundColor, 0, 0, 0)
  395. end, ExpectedType = "function"},
  396.  
  397. tweenTabsOff = {Value = function(tab)
  398. tweenTabAssets(tab, tab.ImageButton.Icon, tab.ImageButton.TextButton, Theme.SecondaryTextColor, Theme.TabBackgroundColor, 1, 0, 0)
  399. end, ExpectedType = "function"},
  400.  
  401. hoverOn = {Value = function()
  402. tweenTabAssets(Tab, Icon, TextButton, Theme.PrimaryColor, Theme.TabBackgroundColor, 0.16, 0.3, 0.3)
  403. end, ExpectedType = "function"},
  404.  
  405. hoverOff = {Value = function()
  406. tweenTabAssets(Tab, Icon, TextButton, Theme.SecondaryTextColor, Theme.TabBackgroundColor, 1, 0, 0)
  407. end, ExpectedType = "function"},
  408. })
  409.  
  410. local Navigation = Modules.Navigation.new(Context)
  411.  
  412. -- this is stupid but anyways!!!
  413. if not self.firstTabDebounce then
  414. Navigation:enableFirstTab()
  415. self.firstTabDebounce = true
  416. end
  417.  
  418. ScrollingFrame.UIListLayout:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(function()
  419. ScrollingFrame.CanvasSize = UDim2.new(0, 0, 0, ScrollingFrame.UIListLayout.AbsoluteContentSize.Y + ScrollingFrame.UIListLayout.Padding.Offset)
  420. end)
  421.  
  422. ImageButton.MouseButton1Down:Connect(Navigation:selectTab())
  423. Icon.MouseButton1Down:Connect(Navigation:selectTab())
  424. TextButton.MouseButton1Down:Connect(Navigation:selectTab())
  425. ImageButton.MouseEnter:Connect(Navigation:hoverEffect(true))
  426. ImageButton.MouseLeave:Connect(Navigation:hoverEffect(false))
  427.  
  428. Theme:registerToObjects({
  429. {object = Tab, property = "BackgroundColor3", theme = {"TabBackgroundColor"}},
  430. {object = Icon, property = "ImageColor3", theme = {"SecondaryTextColor", "PrimaryColor"}},
  431. {object = TextButton, property = "TextColor3", theme = {"SecondaryTextColor", "PrimaryColor"}},
  432. {object = Frame, property = "BackgroundColor3", theme = {"PrimaryBackgroundColor"}},
  433. {object = SubTabs, property = "BackgroundColor3", theme = {"PrimaryBackgroundColor"}},
  434. {object = PageLine, property = "BackgroundColor3", theme = {"Line"}},
  435. {object = SubLine, property = "BackgroundColor3", theme = {"Line"}},
  436. {object = CurrentTabLabel, property = "TextColor3", theme = {"PrimaryTextColor"}},
  437. }, "Tab")
  438.  
  439. local PassingContext = setmetatable({Page = Page}, Library)
  440. return PassingContext
  441. end
  442.  
  443. function Library:createSubTab(options: table)
  444. -- Use provided options, or fall back to defaults if not provided
  445. Utility:validateOptions(options, {
  446. sectionStyle = {Default = "Double", ExpectedType = "string"},
  447. text = {Default = "SubTab", ExpectedType = "string"},
  448. })
  449.  
  450. local Moveable = self.Page.SubTabs.Frame.Moveable
  451. local Underline, ScrollingFrame = Moveable.Underline, Moveable.Parent.ScrollingFrame
  452.  
  453. local SubPage = Assets.Pages.SubPage:Clone()
  454. SubPage.Parent = self.Page
  455.  
  456. local Left, Right = SubPage.ScrollingFrame.Left, SubPage.ScrollingFrame.Right
  457.  
  458. local SubTab = Assets.Pages.SubTab:Clone()
  459. SubTab.Visible = true
  460. SubTab.Text = options.text
  461. SubTab.TextColor3 = Theme.SecondaryTextColor
  462. SubTab.Parent = ScrollingFrame
  463.  
  464. local TextService = game:GetService("TextService")
  465. SubTab.Size = UDim2.new(0, TextService:GetTextSize(options.text, 15, Enum.Font.MontserratMedium, SubTab.AbsoluteSize).X, 1, 0)
  466.  
  467. -- Calculate subTab position to position underline
  468. local subTabIndex, subTabPosition = 0, 0
  469.  
  470. for index, subTab in ipairs(ScrollingFrame:GetChildren()) do
  471. if subTab.Name ~= "SubTab" then
  472. continue
  473. end
  474.  
  475. subTabIndex += 1
  476.  
  477. if subTabIndex == 1 then
  478. subTabPosition = 0
  479. else
  480. local condition, object = Utility:lookBeforeChildOfObject(index, ScrollingFrame, "SubTab")
  481. subTabPosition += subTab.Size.X.Offset + ScrollingFrame.UIListLayout.Padding.Offset
  482.  
  483. if condition then
  484. subTabPosition -= (subTab.Size.X.Offset - object.Size.X.Offset)
  485. end
  486. end
  487. end
  488.  
  489. local function tweenSubTabAssets(subTab, underline, textColor, textTransparency: number, disableUnderlineTween: boolean)
  490. Utility:tween(subTab, {TextColor3 = textColor, TextTransparency = textTransparency}, 0.2):Play()
  491.  
  492. if not disableUnderlineTween then
  493. Utility:tween(underline, {BackgroundColor3 = Theme.PrimaryColor, Position = UDim2.new(0, subTabPosition, 1, 0), Size = UDim2.new(0, subTab.Size.X.Offset, 0, 2)}, 0.2):Play()
  494. end
  495. end
  496.  
  497. local function autoCanvasSizeSubPageScrollingFrame()
  498. local max = math.max(Left.UIListLayout.AbsoluteContentSize.Y, Right.UIListLayout.AbsoluteContentSize.Y)
  499. SubPage.ScrollingFrame.CanvasSize = UDim2.new(0, 0, 0, max)
  500. end
  501.  
  502. local function updateSectionAnimation()
  503. Utility:tween(SubPage.ScrollingFrame.UIPadding, {PaddingTop = UDim.new(0, 10)}, 0.2):Play()
  504.  
  505. task.delay(0.2, function()
  506. Utility:tween(SubPage.ScrollingFrame.UIPadding, {PaddingTop = UDim.new(0, 0)}, 0.2):Play()
  507. end)
  508. end
  509.  
  510. local Context = Utility:validateContext({
  511. Page = {Value = SubPage, ExpectedType = "Instance"},
  512. Pages = {Value = self.Page, ExpectedType = "Instance"},
  513. Popups = {Value = Popups, ExpectedType = "Instance"},
  514. ScrollingFrame = {Value = ScrollingFrame, ExpectedType = "Instance"},
  515. animation = {Value = updateSectionAnimation, ExpectedType = "function"},
  516.  
  517. tweenTabOn = {Value = function()
  518. tweenSubTabAssets(SubTab, Underline, Theme.PrimaryColor, 0, false)
  519. end, ExpectedType = "function"},
  520.  
  521. tweenTabsOff = {Value = function(subTab)
  522. tweenSubTabAssets(subTab, Underline, Theme.SecondaryTextColor, 0, true)
  523. end, ExpectedType = "function"},
  524.  
  525. hoverOn = {Value = function()
  526. tweenSubTabAssets(SubTab, Underline, Theme.PrimaryColor, 0.3, true)
  527. end, ExpectedType = "function"},
  528.  
  529. hoverOff = {Value = function()
  530. tweenSubTabAssets(SubTab, Underline, Theme.SecondaryTextColor, 0, true)
  531. end, ExpectedType = "function"},
  532. })
  533.  
  534. local Navigation = Modules.Navigation.new(Context)
  535.  
  536. if not self.firstSubTabDebounce then
  537. Navigation:enableFirstTab()
  538. self.firstSubTabDebounce = true
  539. end
  540.  
  541. Left.UIListLayout:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(autoCanvasSizeSubPageScrollingFrame)
  542. Right.UIListLayout:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(autoCanvasSizeSubPageScrollingFrame)
  543.  
  544. SubTab.MouseButton1Down:Connect(Navigation:selectTab())
  545. SubTab.MouseEnter:Connect(Navigation:hoverEffect(true))
  546. SubTab.MouseLeave:Connect(Navigation:hoverEffect(false))
  547.  
  548. Theme:registerToObjects({
  549. {object = Underline, property = "BackgroundColor3", theme = {"PrimaryColor"}},
  550. {object = SubTab, property = "TextColor3", theme = {"SecondaryTextColor", "PrimaryColor"}},
  551. {object = SubPage.ScrollingFrame, property = "ScrollBarImageColor3", theme = {"ScrollingBarImageColor"}}
  552. }, "SubTab")
  553.  
  554. local PassingContext = setmetatable({Left = Left, Right = Right, sectionStyle = options.sectionStyle}, Library)
  555. return PassingContext
  556. end
  557.  
  558. function Library:createSection(options: table)
  559. Utility:validateOptions(options, {
  560. text = {Default = "Section", ExpectedType = "string"},
  561. position = {Default = "Left", ExpectedType = "string"},
  562. })
  563.  
  564. local Section = Assets.Pages.Section:Clone()
  565. Section.Visible = true
  566. Section.Parent = self[options.position]
  567.  
  568. -- Change section style
  569. local screenSize = workspace.CurrentCamera.ViewportSize
  570. if self.sectionStyle == "Single" or (screenSize.X <= 740 and screenSize.Y <= 590) or self.sizeX <= 660 then
  571. if (options.position == "Right") then
  572. table.insert(self.SectionFolder.Right, {folders = {Left = self.Left, Right = self.Right}, object = Section})
  573. end
  574.  
  575. self.Right.Visible = false
  576. self.Left.Size = UDim2.fromScale(1, 1)
  577. Section.Parent = self.Left
  578. end
  579.  
  580. -- Store objects to change section style depending on the size of the UI
  581. if (options.position == "Right" and self.sectionStyle ~= "Single") then
  582. table.insert(self.SectionFolder.Right, {folders = {Left = self.Left, Right = self.Right}, object = Section})
  583. end
  584.  
  585. if (options.position == "Left" and self.sectionStyle ~= "Single") then
  586. table.insert(self.SectionFolder.Left, {folders = {Left = self.Left, Right = self.Right}, object = Section})
  587. end
  588.  
  589. local Inner = Section.Inner
  590.  
  591. local TextLabel = Inner.TextLabel
  592. TextLabel.Text = options.text
  593.  
  594. -- Auto size section
  595. Section.Inner.UIListLayout:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(function()
  596. Section.Size = UDim2.new(1, 0, 0, Section.Inner.UIListLayout.AbsoluteContentSize.Y + 28)
  597. end)
  598.  
  599. Theme:registerToObjects({
  600. {object = Section, property = "BackgroundColor3", theme = {"Line"}},
  601. {object = Inner, property = "BackgroundColor3", theme = {"PrimaryBackgroundColor"}},
  602. {object = TextLabel, property = "TextColor3", theme = {"PrimaryTextColor"}},
  603. })
  604.  
  605. local PassingContext = setmetatable({Section = Inner, ScrollingFrame = Section.Parent.Parent}, Library)
  606. return PassingContext
  607. end
  608.  
  609. function Library:createToggle(options: table, parent, scrollingFrame)
  610. Utility:validateOptions(options, {
  611. text = {Default = "Toggle", ExpectedType = "string"},
  612. state = {Default = false, ExpectedType = "boolean"},
  613. callback = {Default = function() end, ExpectedType = "function"}
  614. })
  615.  
  616. scrollingFrame = self.ScrollingFrame or scrollingFrame
  617.  
  618. local Toggle = Assets.Elements.Toggle:Clone()
  619. Toggle.Visible = true
  620. Toggle.Parent = parent or self.Section
  621.  
  622. local TextLabel = Toggle.TextLabel
  623. TextLabel.Text = options.text
  624.  
  625. local ImageButton = TextLabel.ImageButton
  626. local TextButton = TextLabel.TextButton
  627. local Background = TextButton.Background
  628. local Circle = Background.Circle
  629.  
  630. local function tweenToggleAssets(backgroundColor: Color3, circleColor: Color3, anchorPoint: Vector2, position: UDim2)
  631. Utility:tween(Background, {BackgroundColor3 = backgroundColor}, 0.2):Play()
  632. Utility:tween(Circle, {BackgroundColor3 = circleColor, AnchorPoint = anchorPoint, Position = position}, 0.2):Play()
  633. end
  634.  
  635. local circleOn = false
  636.  
  637. local Context = Utility:validateContext({
  638. state = {Value = options.state, ExpectedType = "boolean"},
  639. callback = {Value = options.callback, ExpectedType = "function"},
  640.  
  641. switchOff = {Value = function()
  642. tweenToggleAssets(Theme.SecondaryBackgroundColor, Theme.PrimaryBackgroundColor, Vector2.new(0, 0.5), UDim2.fromScale(0, 0.5), 0.2)
  643. circleOn = false
  644. end, ExpectedType = "function"},
  645.  
  646. switchOn = {Value = function()
  647. tweenToggleAssets(Theme.PrimaryColor, Theme.TertiaryBackgroundColor, Vector2.new(1, 0.5), UDim2.fromScale(1, 0.5), 0.2)
  648. circleOn = true
  649. end, ExpectedType = "function"}
  650. })
  651.  
  652. local Toggle = Modules.Toggle.new(Context)
  653. Toggle:updateState({state = options.state})
  654. TextButton.MouseButton1Down:Connect(Toggle:switch())
  655.  
  656. Theme:registerToObjects({
  657. {object = TextLabel, property = "TextColor3", theme = {"SecondaryTextColor"}},
  658. {object = Background, property = "BackgroundColor3", theme = {"PrimaryColor", "SecondaryBackgroundColor"}},
  659. {object = Circle, property = "BackgroundColor3", theme = {"TertiaryBackgroundColor", "PrimaryBackgroundColor"}, circleOn = circleOn},
  660. {object = ImageButton, property = "ImageColor3", theme = {"SecondaryTextColor"}},
  661. })
  662.  
  663. shared.Flags.Toggle[options.text] = {
  664. getState = function(self)
  665. return Context.state
  666. end,
  667.  
  668. updateState = function(self, options: table)
  669. Toggle:updateState(options)
  670. end,
  671. }
  672.  
  673. return self:createAddons(options.text, ImageButton, scrollingFrame, {
  674. getState = function(self)
  675. return Context.state
  676. end,
  677.  
  678. updateState = function(self, options: table)
  679. Toggle:updateState(options)
  680. end,
  681. })
  682. end
  683.  
  684. function Library:createSlider(options: table, parent, scrollingFrame)
  685. Utility:validateOptions(options, {
  686. text = {Default = "Slider", ExpectedType = "string"},
  687. min = {Default = 0, ExpectedType = "number"},
  688. max = {Default = 100, ExpectedType = "number"},
  689. step = {Default = 1, ExpectedType = "number"},
  690. callback = {Default = function() end, ExpectedType = "function"}
  691. })
  692.  
  693. options.default = options.default or options.min
  694. options.value = options.default
  695. scrollingFrame = self.ScrollingFrame or scrollingFrame
  696.  
  697. local Slider = Assets.Elements.Slider:Clone()
  698. Slider.Visible = true
  699. Slider.Parent = parent or self.Section
  700.  
  701. local TextLabel = Slider.TextButton.TextLabel
  702. local ImageButton = TextLabel.ImageButton
  703. local TextBox = TextLabel.TextBox
  704.  
  705. local Line = Slider.Line
  706. local TextButton = Slider.TextButton
  707. local Fill = Line.Fill
  708.  
  709. local TextLabel = TextButton.TextLabel
  710. TextLabel.Text = options.text
  711.  
  712. local Circle = Fill.Circle
  713. local InnerCircle = Circle.InnerCircle
  714. local CurrentValueLabel = Circle.TextButton.CurrentValueLabel
  715.  
  716. local function tweenSliderInfoAssets(transparency: number)
  717. local TextBoundsX = math.clamp(CurrentValueLabel.TextBounds.X + 14, 10, 200)
  718. Utility:tween(CurrentValueLabel, {Size = UDim2.fromOffset(TextBoundsX, 20), BackgroundTransparency = transparency, TextTransparency = transparency}):Play()
  719. end
  720.  
  721. local Context = Utility:validateContext({
  722. min = {Value = options.min, ExpectedType = "number"},
  723. max = {Value = options.max, ExpectedType = "number"},
  724. step = {Value = options.step, ExpectedType = "number"},
  725. value = {Value = options.default, ExpectedType = "number"},
  726. callback = {Value = options.callback, ExpectedType = "function"},
  727. Line = {Value = Line, ExpectedType = "Instance"},
  728. TextBox = {Value = TextLabel.TextBox, ExpectedType = "Instance"},
  729. Library = {Value = Library, ExpectedType = "table"},
  730. CurrentValueLabel = {Value = CurrentValueLabel, ExpectedType = "Instance"},
  731. Connections = {Value = Connections, ExpectedType = "table"},
  732.  
  733. autoSizeTextBox = {Value = function()
  734. local TextBoundsX = math.clamp(TextLabel.TextBox.TextBounds.X + 14, 10, 200)
  735. Utility:tween(TextLabel.TextBox, {Size = UDim2.fromOffset(TextBoundsX, 20)}, 0.2):Play()
  736. end, ExpectedType = "function"},
  737.  
  738. updateFill = {Value = function(sizeX)
  739. Utility:tween(Line.Fill, {Size = UDim2.fromScale(sizeX, 1)}, 0.2):Play()
  740. end, ExpectedType = "function"},
  741.  
  742. showInfo = {Value = function()
  743. tweenSliderInfoAssets(0)
  744. end, ExpectedType = "function"},
  745.  
  746. dontShowInfo ={Value = function()
  747. tweenSliderInfoAssets(1)
  748. end, ExpectedType = "function"},
  749. })
  750.  
  751. local Slider = Modules.Slider.new(Context)
  752. Slider:handleSlider()
  753.  
  754. Theme:registerToObjects({
  755. {object = TextLabel, property = "TextColor3", theme = {"SecondaryTextColor"}},
  756. {object = Line, property = "BackgroundColor3", theme = {"SecondaryBackgroundColor"}},
  757. {object = Fill, property = "BackgroundColor3", theme = {"PrimaryColor"}},
  758. {object = Circle, property = "BackgroundColor3", theme = {"PrimaryColor"}},
  759. {object = ImageButton, property = "ImageColor3", theme = {"SecondaryTextColor"}},
  760. {object = TextBox, property = "BackgroundColor3", theme = {"SecondaryBackgroundColor"}},
  761. {object = TextBox, property = "TextColor3", theme = {"SecondaryTextColor"}},
  762. {object = CurrentValueLabel, property = "TextColor3", theme = {"TertiaryBackgroundColor"}},
  763. {object = CurrentValueLabel, property = "BackgroundColor3", theme = {"PrimaryColor"}},
  764. {object = InnerCircle, property = "BackgroundColor3", theme = {"TertiaryBackgroundColor"}},
  765. })
  766.  
  767. Fill.BackgroundColor3 = Theme.PrimaryColor
  768. Circle.BackgroundColor3 = Theme.PrimaryColor
  769. InnerCircle.BackgroundColor3 = Theme.TertiaryBackgroundColor
  770. CurrentValueLabel.BackgroundColor3 = Theme.PrimaryColor
  771.  
  772. shared.Flags.Slider[options.text] = {
  773. getValue = function(self)
  774. return Context.value
  775. end,
  776.  
  777. updateValue = function(self, options: table)
  778. Slider:updateValue(options)
  779. end,
  780. }
  781.  
  782. return self:createAddons(options.text, ImageButton, scrollingFrame, {
  783. getValue = function(self)
  784. return Context.value
  785. end,
  786.  
  787. updateValue = function(self, options: table)
  788. Slider:updateValue(options)
  789. end,
  790. })
  791. end
  792.  
  793. function Library:createPicker(options: table, parent, scrollingFrame, isPickerBoolean)
  794. Utility:validateOptions(options, {
  795. text = {Default = "Picker", ExpectedType = "string"},
  796. default = {Default = Color3.fromRGB(255, 0, 0), ExpectedType = "Color3"},
  797. color = {Default = Color3.fromRGB(255, 0, 0), ExpectedType = "Color3"},
  798. callback = {Default = function() end, ExpectedType = "function"},
  799. })
  800.  
  801. isPickerBoolean = isPickerBoolean or false
  802. options.color = options.default
  803. scrollingFrame = self.ScrollingFrame or scrollingFrame
  804.  
  805. local Picker = Assets.Elements.Picker:Clone()
  806. Picker.Visible = true
  807. Picker.Parent = parent or self.Section
  808.  
  809. local TextLabel = Picker.TextLabel
  810. TextLabel.Text = options.text
  811.  
  812. local ImageButton = TextLabel.ImageButton
  813. local Background = TextLabel.Background
  814. local TextButton = Background.TextButton
  815.  
  816. local ColorPicker = Assets.Elements.ColorPicker:Clone()
  817. ColorPicker.Parent = Popups
  818.  
  819. -- Put transparent objects to not be visible to make cool effect later!!
  820. local ColorPickerTransparentObjects = Utility:getTransparentObjects(ColorPicker)
  821.  
  822. for _, data in ipairs(ColorPickerTransparentObjects) do
  823. data.object[data.property] = 1
  824. end
  825.  
  826. local Inner = ColorPicker.Inner
  827. local HSV = Inner.HSV
  828. local Slider = Inner.Slider
  829. local Submit = Inner.Submit
  830. local Hex = Inner.HexAndRGB.Hex
  831. local RGB = Inner.HexAndRGB.RGB
  832.  
  833. local PopupContext = Utility:validateContext({
  834. Popup = {Value = ColorPicker, ExpectedType = "Instance"},
  835. Target = {Value = Background, ExpectedType = "Instance"},
  836. Library = {Value = Library, ExpectedType = "table"},
  837. TransparentObjects = {Value = ColorPickerTransparentObjects, ExpectedType = "table"},
  838. Popups = {Value = Popups, ExpectedType = "Instance"},
  839. isPicker = {Value = isPickerBoolean, ExpectedType = "boolean"},
  840. ScrollingFrame = {Value = scrollingFrame, ExpectedType = "Instance"},
  841. PositionPadding = {Value = 18 + 7, ExpectedType = "number"},
  842. Connections = {Value = Connections, ExpectedType = "table"},
  843. SizePadding = {Value = 14, ExpectedType = "number"},
  844. })
  845.  
  846. local Popup = Modules.Popup.new(PopupContext)
  847. TextButton.MouseButton1Down:Connect(Popup:togglePopup())
  848. Popup:hidePopupOnClickingOutside()
  849.  
  850. local ColorPickerContext = Utility:validateContext({
  851. ColorPicker = {Value = ColorPicker, ExpectedType = "Instance"},
  852. Hex = {Value = Hex, ExpectedType = "Instance"},
  853. RGB = {Value = RGB, ExpectedType = "Instance"},
  854. Slider = {Value = Slider, ExpectedType = "Instance"},
  855. HSV = {Value = HSV, ExpectedType = "Instance"},
  856. Submit = {Value = Submit, ExpectedType = "Instance"},
  857. Background = {Value = Background, ExpectedType = "Instance"},
  858. Connections = {Value = Connections, ExpectedType = "table"},
  859. color = {Value = options.color, ExpectedType = "Color3"},
  860. callback = {Value = options.callback, ExpectedType = "function"},
  861.  
  862. submitAnimation = {Value = function()
  863. Utility:tween(Submit.TextLabel, {BackgroundTransparency = 0}, 0.2):Play()
  864. Utility:tween(Submit.TextLabel, {TextColor3 = Theme.PrimaryColor, TextTransparency = 0}, 0.2):Play()
  865.  
  866. task.delay(0.2, function()
  867. Utility:tween(Submit.TextLabel, {TextColor3 = Theme.SecondaryTextColor, TextTransparency = 0}, 0.2):Play()
  868. Utility:tween(Submit.TextLabel, {BackgroundTransparency = 0.3}, 0.2):Play()
  869. end)
  870. end, ExpectedType = "function"},
  871.  
  872. hoveringOn = {Value = function()
  873. Utility:tween(Submit.TextLabel, {BackgroundTransparency = 0.3}, 0.2):Play()
  874. Utility:tween(Submit.TextLabel, {TextColor3 = Theme.PrimaryColor, TextTransparency = 0.3}, 0.2):Play()
  875. end, ExpectedType = "function"},
  876.  
  877. hoveringOff = {Value = function()
  878. Utility:tween(Submit.TextLabel, {BackgroundTransparency = 0}, 0.2):Play()
  879. Utility:tween(Submit.TextLabel, {TextColor3 = Theme.SecondaryTextColor, TextTransparency = 0}, 0.2):Play()
  880. end, ExpectedType = "function"},
  881. })
  882.  
  883. Theme:registerToObjects({
  884. {object = TextLabel, property = "TextColor3", theme = {"SecondaryTextColor"}},
  885. {object = ColorPicker, property = "BackgroundColor3", theme = {"Line"}},
  886. {object = ImageButton, property = "ImageColor3", theme = {"SecondaryTextColor"}},
  887. {object = Inner, property = "BackgroundColor3", theme = {"PrimaryBackgroundColor"}},
  888. {object = Submit, property = "BackgroundColor3", theme = {"SecondaryBackgroundColor"}},
  889. {object = Hex, property = "BackgroundColor3", theme = {"SecondaryBackgroundColor"}},
  890. {object = RGB, property = "BackgroundColor3", theme = {"SecondaryBackgroundColor"}},
  891. {object = Submit.TextLabel, property = "BackgroundColor3", theme = {"SecondaryBackgroundColor"}}
  892. })
  893.  
  894. local ColorPicker = Modules.ColorPicker.new(ColorPickerContext)
  895. ColorPicker:handleColorPicker()
  896.  
  897. shared.Flags.ColorPicker[options.text] = {
  898. getColor = function(self)
  899. return ColorPickerContext.color
  900. end,
  901.  
  902. updateColor = function(self, options: table)
  903. ColorPicker:updateColor(options)
  904. end,
  905. }
  906.  
  907. return self:createAddons(options.text, ImageButton, scrollingFrame, {
  908. getColor = function(self)
  909. return ColorPickerContext.color
  910. end,
  911.  
  912. updateColor = function(self, options: table)
  913. ColorPicker:updateColor(options)
  914. end,
  915. })
  916. end
  917.  
  918. function Library:createDropdown(options: table, parent, scrollingFrame)
  919. Utility:validateOptions(options, {
  920. text = {Default = "Dropdown", ExpectedType = "string"},
  921. list = {Default = {"Option 1", "Option 2"}, ExpectedType = "table"},
  922. default = {Default = {}, ExpectedType = "table"},
  923. multiple = {Default = false, ExpectedType = "boolean"},
  924. callback = {Default = function() end, ExpectedType = "function"},
  925. })
  926.  
  927. scrollingFrame = self.ScrollingFrame or scrollingFrame
  928.  
  929. local Dropdown = Assets.Elements.Dropdown:Clone()
  930. Dropdown.Visible = true
  931. Dropdown.Parent = parent or self.Section
  932.  
  933. local TextLabel = Dropdown.TextLabel
  934. TextLabel.Text = options.text
  935.  
  936. local ImageButton = TextLabel.ImageButton
  937. local Box = Dropdown.Box
  938.  
  939. local TextButton = Box.TextButton
  940. TextButton.Text = table.concat(options.default, ", ")
  941.  
  942. if options.default[1] == nil then
  943. TextButton.Text = "None"
  944. end
  945.  
  946. local List = Dropdown.List
  947. local Inner = List.Inner
  948. local DropButtons = Inner.ScrollingFrame
  949. local Search = Inner.TextBox
  950.  
  951. -- Auto size ScrollingFrame and List
  952. DropButtons.UIListLayout:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(function()
  953. DropButtons.CanvasSize = UDim2.new(0, 0, 0, DropButtons.UIListLayout.AbsoluteContentSize.Y + Inner.UIListLayout.Padding.Offset)
  954. DropButtons.Size = UDim2.new(1, 0, 0, math.clamp(DropButtons.UIListLayout.AbsoluteContentSize.Y + Inner.UIListLayout.Padding.Offset, 0, 164))
  955.  
  956. if List.Size.Y.Offset > 0 then
  957. Utility:tween(List, {Size = UDim2.new(1, 0, 0, math.clamp(Inner.UIListLayout.AbsoluteContentSize.Y, 0, 210))}, 0.2):Play()
  958.  
  959. for index, value in ipairs(self.DropdownSizes) do
  960. scrollingFrame.CanvasSize = scrollingFrame.CanvasSize - value.size
  961. scrollingFrame.CanvasSize = scrollingFrame.CanvasSize + UDim2.new(0, 0, 0, math.clamp(Inner.UIListLayout.AbsoluteContentSize.Y, 0, 210))
  962. table.remove(Library.DropdownSizes, index)
  963. table.insert(Library.DropdownSizes, {object = Dropdown, size = UDim2.new(0, 0, 0, math.clamp(Inner.UIListLayout.AbsoluteContentSize.Y, 0, 210))})
  964. end
  965. end
  966. end)
  967.  
  968. -- As long we don't spam it were good i guess when changing canvassize when tweened but let's not do that
  969. local function toggleList()
  970. if List.Size.Y.Offset <= 0 then
  971. for index, value in ipairs(Library.DropdownSizes) do
  972. if value.object ~= Dropdown then
  973. scrollingFrame.CanvasSize = scrollingFrame.CanvasSize - value.size
  974. table.remove(Library.DropdownSizes, index)
  975. end
  976. end
  977.  
  978. -- Hide current open dropdowns and make sure enabled dropdown is on top
  979. for _, object in ipairs(scrollingFrame:GetDescendants()) do
  980. if object.Name == "Section" then
  981. object.ZIndex = 1
  982. end
  983.  
  984. if object.Name == "List" and object ~= List then
  985. object.Parent.ZIndex = 1
  986. Utility:tween(object, {Size = UDim2.new(1, 0, 0, 0)}, 0.2):Play()
  987. end
  988. end
  989.  
  990. for _, object in ipairs(Popups:GetDescendants()) do
  991. if object.Name == "List" and object ~= List then
  992. object.Parent.ZIndex = 1
  993. Utility:tween(object, {Size = UDim2.new(1, 0, 0, 0)}, 0.2):Play()
  994. end
  995. end
  996.  
  997. Dropdown.ZIndex = 2
  998.  
  999. if self.Section then
  1000. self.Section.Parent.ZIndex = 2
  1001. end
  1002.  
  1003. Utility:tween(List, {Size = UDim2.new(1, 0, 0, math.clamp(Inner.UIListLayout.AbsoluteContentSize.Y, 0, 210))}, 0.2):Play()
  1004. table.insert(Library.DropdownSizes, {object = Dropdown, size = UDim2.new(0, 0, 0, math.clamp(Inner.UIListLayout.AbsoluteContentSize.Y, 0, 210))})
  1005.  
  1006. scrollingFrame.CanvasSize = scrollingFrame.CanvasSize + UDim2.new(0, 0, 0, math.clamp(Inner.UIListLayout.AbsoluteContentSize.Y, 0, 210))
  1007. else
  1008. Utility:tween(List, {Size = UDim2.new(1, 0, 0, 0)}, 0.2):Play()
  1009.  
  1010. for index, value in ipairs(Library.DropdownSizes) do
  1011. if value.object == Dropdown then
  1012. scrollingFrame.CanvasSize = scrollingFrame.CanvasSize - value.size
  1013. table.remove(Library.DropdownSizes, index)
  1014. end
  1015. end
  1016. end
  1017. end
  1018.  
  1019. local function createDropButton(value)
  1020. local DropButton = Assets.Elements.DropButton:Clone()
  1021. DropButton.Visible = true
  1022. DropButton.Parent = DropButtons
  1023.  
  1024. local TextButton = DropButton.TextButton
  1025. local Background = TextButton.Background
  1026. local Checkmark = TextButton.Checkmark
  1027.  
  1028. local TextLabel = DropButton.TextLabel
  1029. TextLabel.Text = tostring(value)
  1030.  
  1031. Theme:registerToObjects({
  1032. {object = TextLabel, property = "TextColor3", theme = {"SecondaryTextColor"}},
  1033. {object = Background, property = "BackgroundColor3", theme = {"PrimaryColor", "SecondaryBackgroundColor"}},
  1034. {object = Checkmark, property = "ImageColor3", theme = {"TertiaryBackgroundColor"}},
  1035. })
  1036.  
  1037. return TextButton
  1038. end
  1039.  
  1040. local function tweenDropButton(dropButton: Instance, backgroundColor: Color3, imageTransparency: number)
  1041. Utility:tween(dropButton.Background, {BackgroundColor3 = backgroundColor}, 0.2, "Circular", "InOut"):Play()
  1042. Utility:tween(dropButton.Checkmark, {ImageTransparency = imageTransparency}, 0.3):Play()
  1043. end
  1044.  
  1045. local Context = Utility:validateContext({
  1046. text = {Value = options.text, ExpectedType = "string"},
  1047. default = {Value = options.default, ExpectedType = "table"},
  1048. list = {Value = options.list, ExpectedType = "table"},
  1049. callback = {Value = options.callback, ExpectedType = "function"},
  1050. TextButton = {Value = TextButton, ExpectedType = "Instance"},
  1051. DropButtons = {Value = DropButtons, ExpectedType = "Instance"},
  1052. createDropButton = {Value = createDropButton, ExpectedType = "function"},
  1053. ScrollingFrame = {Value = scrollingFrame, ExpectedType = "Instance"},
  1054. multiple = {Value = options.multiple, ExpectedType = "boolean"},
  1055.  
  1056. tweenDropButtonOn = {Value = function(dropButton)
  1057. tweenDropButton(dropButton, Theme.PrimaryColor, 0)
  1058. end, ExpectedType = "function"},
  1059.  
  1060. tweenDropButtonOff = {Value = function(dropButton)
  1061. tweenDropButton(dropButton, Theme.SecondaryBackgroundColor, 1)
  1062. end, ExpectedType = "function"},
  1063. })
  1064.  
  1065. TextButton.MouseButton1Down:Connect(toggleList)
  1066.  
  1067. -- Search drop buttons function
  1068. Search:GetPropertyChangedSignal("Text"):Connect(function()
  1069. for _, dropButton in ipairs(DropButtons:GetChildren()) do
  1070. if not dropButton:IsA("Frame") then
  1071. continue
  1072. end
  1073.  
  1074. if Search.Text == "" or string.match(string.lower(dropButton.TextLabel.Text), string.lower(Search.Text)) then
  1075. dropButton.Visible = true
  1076. else
  1077. dropButton.Visible = false
  1078. end
  1079. end
  1080. end)
  1081.  
  1082. local Dropdown = Modules.Dropdown.new(Context)
  1083. Dropdown:handleDropdown()
  1084.  
  1085. Theme:registerToObjects({
  1086. {object = ImageButton, property = "ImageColor3", theme = {"SecondaryTextColor"}},
  1087. {object = TextLabel, property = "TextColor3", theme = {"SecondaryTextColor"}},
  1088. {object = Box, property = "BackgroundColor3", theme = {"SecondaryBackgroundColor"}},
  1089. {object = TextButton, property = "TextColor3", theme = {"SecondaryTextColor"}},
  1090. {object = List, property = "BackgroundColor3", theme = {"Line"}},
  1091. {object = Inner, property = "BackgroundColor3", theme = {"PrimaryBackgroundColor"}},
  1092. {object = Search, property = "TextColor3", theme = {"SecondaryTextColor"}},
  1093. {object = Search, property = "PlaceholderColor3", theme = {"SecondaryTextColor"}},
  1094. {object = Search, property = "BackgroundColor3", theme = {"SecondaryBackgroundColor"}},
  1095. {object = Search.Parent, property = "BackgroundColor3", theme = {"SecondaryBackgroundColor"}},
  1096. })
  1097.  
  1098. List.BackgroundColor3 = Theme.Line
  1099. Inner.BackgroundColor3 = Theme.PrimaryBackgroundColor
  1100. Box.BackgroundColor3 = Theme.SecondaryBackgroundColor
  1101. Search.BackgroundColor3 = Theme.SecondaryBackgroundColor
  1102.  
  1103. shared.Flags.Dropdown[options.text] = {
  1104. getList = function()
  1105. return Context.list
  1106. end,
  1107.  
  1108. getValue = function()
  1109. return Dropdown:getValue()
  1110. end,
  1111.  
  1112. updateList = function(self, options: table)
  1113. Dropdown:updateList(options)
  1114. end,
  1115. }
  1116.  
  1117. return self:createAddons(options.text, ImageButton, scrollingFrame, {
  1118. getList = function()
  1119. return Context.list
  1120. end,
  1121.  
  1122. getValue = function()
  1123. return Dropdown:getValue()
  1124. end,
  1125.  
  1126. updateList = function(self, options: table)
  1127. Dropdown:updateList(options)
  1128. end,
  1129. })
  1130. end
  1131.  
  1132. function Library:createKeybind(options: table, parent, scrollingFrame)
  1133. Utility:validateOptions(options, {
  1134. text = {Default = "Keybind", ExpectedType = "string"},
  1135. default = {Default = "None", ExpectedType = "string"},
  1136. onHeld = {Default = false, ExpectedType = "boolean"},
  1137. callback = {Default = function() end, ExpectedType = "function"},
  1138. })
  1139.  
  1140. scrollingFrame = self.ScrollingFrame or scrollingFrame
  1141.  
  1142. local Keybind = Assets.Elements.Keybind:Clone()
  1143. Keybind.Visible = true
  1144. Keybind.Parent = parent or self.Section
  1145.  
  1146. local TextLabel = Keybind.TextLabel
  1147. TextLabel.Text = options.text
  1148.  
  1149. local ImageButton = TextLabel.ImageButton
  1150. local Background = TextLabel.Background
  1151.  
  1152. local TextButton = Background.TextButton
  1153.  
  1154. if not table.find(self.Exclusions, options.default) then
  1155. TextButton.Text = options.default
  1156. else
  1157. TextButton.Text = "None"
  1158. warn("You already have this key binded")
  1159. end
  1160.  
  1161. if options.default ~= "None" then
  1162. table.insert(Exclusions, options.default)
  1163. end
  1164.  
  1165. local Context = Utility:validateContext({
  1166. default = {Value = options.default, ExpectedType = "string"},
  1167. callback = {Value = options.callback, ExpectedType = "function"},
  1168. Background = {Value = TextButton.Parent, ExpectedType = "Instance"},
  1169. TextButton = {Value = TextButton, ExpectedType = "Instance"},
  1170. Connections = {Value = Connections, ExpectedType = "table"},
  1171. Library = {Value = Library, ExpectedType = "table"},
  1172. onHeld = {Value = options.onHeld, ExpectedType = "boolean"},
  1173. Exclusions = {Value = Exclusions, ExpectedType = "table"},
  1174.  
  1175. autoSizeBackground = {Value = function()
  1176. local TextBoundsX = math.clamp(TextButton.TextBounds.X + 14, 10, 200)
  1177. Utility:tween(TextButton.Parent, {Size = UDim2.fromOffset(TextBoundsX, 20)}, 0.2):Play()
  1178. end, ExpectedType = "function"},
  1179. })
  1180.  
  1181. local Keybind = Modules.Keybind.new(Context)
  1182. Keybind:handleKeybind()
  1183.  
  1184. Theme:registerToObjects({
  1185. {object = TextLabel, property = "TextColor3", theme = {"SecondaryTextColor"}},
  1186. {object = ImageButton, property = "ImageColor3", theme = {"SecondaryTextColor"}},
  1187. {object = Background, property = "BackgroundColor3", theme = {"SecondaryBackgroundColor"}},
  1188. {object = TextButton, property = "TextColor3", theme = {"SecondaryTextColor"}}
  1189. })
  1190.  
  1191. shared.Flags.Keybind[options.text] = {
  1192. getKeybind = function(self)
  1193. return TextButton.Text
  1194. end,
  1195.  
  1196. updateKeybind = function(self, options: table)
  1197. Keybind:updateKeybind(options)
  1198. end,
  1199. }
  1200.  
  1201. return self:createAddons(options.text, ImageButton, scrollingFrame, {
  1202. getKeybind = function(self)
  1203. return TextButton.Text
  1204. end,
  1205.  
  1206. updateKeybind = function(self, options: table)
  1207. Keybind:updateKeybind(options)
  1208. end,
  1209. })
  1210. end
  1211.  
  1212. -- Rushed this, later put it into a module like the other elements, even though it's simple.
  1213. function Library:createButton(options: table, parent, scrollingFrame)
  1214. Utility:validateOptions(options, {
  1215. text = {Default = "Button", ExpectedType = "string"},
  1216. callback = {Default = function() end, ExpectedType = "function"},
  1217. })
  1218.  
  1219. scrollingFrame = self.ScrollingFrame or scrollingFrame
  1220.  
  1221. local Button = Assets.Elements.Button:Clone()
  1222. Button.Visible = true
  1223. Button.Parent = parent or self.Section
  1224.  
  1225. local Background = Button.Background
  1226.  
  1227. local TextButton = Background.TextButton
  1228. TextButton.Text = options.text
  1229.  
  1230. TextButton.MouseButton1Down:Connect(function()
  1231. Utility:tween(Background, {BackgroundTransparency = 0}, 0.2):Play()
  1232. Utility:tween(TextButton, {TextColor3 = Theme.PrimaryColor, TextTransparency = 0}, 0.2):Play()
  1233.  
  1234. task.delay(0.2, function()
  1235. Utility:tween(TextButton, {TextColor3 = Theme.SecondaryTextColor, TextTransparency = 0}, 0.2):Play()
  1236. Utility:tween(Background, {BackgroundTransparency = 0.3}, 0.2):Play()
  1237. end)
  1238.  
  1239. options.callback()
  1240. end)
  1241.  
  1242. Background.MouseEnter:Connect(function(input)
  1243. Utility:tween(Background, {BackgroundTransparency = 0.3}, 0.2):Play()
  1244. Utility:tween(TextButton, {TextColor3 = Theme.PrimaryColor, TextTransparency = 0.3}, 0.2):Play()
  1245. end)
  1246.  
  1247. Background.MouseLeave:Connect(function()
  1248. Utility:tween(Background, {BackgroundTransparency = 0}, 0.2):Play()
  1249. Utility:tween(TextButton, {TextColor3 = Theme.SecondaryTextColor, TextTransparency = 0}, 0.2):Play()
  1250. end)
  1251.  
  1252. Theme:registerToObjects({
  1253. {object = Background, property = "BackgroundColor3", theme = {"SecondaryBackgroundColor"}},
  1254. {object = TextButton, property = "TextColor3", theme = {"SecondaryTextColor"}},
  1255. })
  1256. end
  1257.  
  1258. -- Redo textbox later
  1259. function Library:createTextBox(options: table, parent, scrollingFrame)
  1260. Utility:validateOptions(options, {
  1261. text = {Default = "Textbox", ExpectedType = "string"},
  1262. default = {Default = "", ExpectedType = "string"},
  1263. callback = {Default = function() end, ExpectedType = "function"},
  1264. })
  1265.  
  1266. scrollingFrame = self.ScrollingFrame or scrollingFrame
  1267.  
  1268. local TextBox = Assets.Elements.TextBox:Clone()
  1269. TextBox.Visible = true
  1270. TextBox.Parent = parent or self.Section
  1271.  
  1272. local TextLabel = TextBox.TextLabel
  1273. TextLabel.Text = options.text
  1274.  
  1275. local ImageButton = TextLabel.ImageButton
  1276.  
  1277. local Box = TextLabel.TextBox
  1278. Box.Text = options.default
  1279.  
  1280. local Context = Utility:validateContext({
  1281. default = {Value = options.default, ExpectedType = "string"},
  1282. callback = {Value = options.callback, ExpectedType = "function"},
  1283. TextBox = {Value = Box, ExpectedType = "Instance"},
  1284.  
  1285. autoSizeTextBox = {Value = function()
  1286. local TextBoundsX = math.clamp(Box.TextBounds.X + 14, 0, 100)
  1287. Utility:tween(Box, {Size = UDim2.fromOffset(TextBoundsX, 20)}, 0.2):Play()
  1288. end, ExpectedType = "function"}
  1289. })
  1290.  
  1291. local TextBox = Modules.TextBox.new(Context)
  1292. TextBox:handleTextBox()
  1293.  
  1294. Theme:registerToObjects({
  1295. {object = TextLabel, property = "TextColor3", theme = {"SecondaryTextColor"}},
  1296. {object = Box, property = "TextColor3", theme = {"SecondaryTextColor"}},
  1297. {object = Box, property = "BackgroundColor3", theme = {"SecondaryBackgroundColor"}},
  1298. })
  1299.  
  1300. shared.Flags.TextBox[options.text] = {
  1301. getText = function(self)
  1302. return Box.Text
  1303. end,
  1304.  
  1305. updateText = function(self, options: table)
  1306. Box.Text = options.text or ""
  1307. Context.callback(Box.Text)
  1308. end,
  1309. }
  1310.  
  1311. return self:createAddons(options.text, ImageButton, scrollingFrame, {
  1312. getText = function(self)
  1313. return Box.Text
  1314. end,
  1315.  
  1316. updateText = function(self, options: table)
  1317. Box.Text = options.text or ""
  1318. Context.callback(Box.Text)
  1319. end,
  1320. })
  1321. end
  1322.  
  1323. -- Later put this into a module, but this is fine if it's put here anyways.
  1324. local ChildRemoved = false
  1325. function Library:notify(options: table)
  1326. Utility:validateOptions(options, {
  1327. title = {Default = "Notification", ExpectedType = "string"},
  1328. text = {Default = "Hello world", ExpectedType = "string"},
  1329. duration = {Default = 3, ExpectedType = "number"},
  1330. maxSizeX = {Default = 300, ExpectedType = "number"},
  1331. scaleX = {Default = 0.165, ExpectedType = "number"},
  1332. sizeY = {Default = 100, ExpectedType = "number"},
  1333. })
  1334.  
  1335. local Notification = Assets.Elements.Notification:Clone()
  1336. Notification.Visible = true
  1337. Notification.Parent = ScreenGui.Notifications
  1338. Notification.Size = UDim2.new(options.scaleX, 0, 0, options.sizeY)
  1339. Notification.UISizeConstraint.MaxSize = Vector2.new(options.maxSizeX, 9e9)
  1340.  
  1341. local Title = Notification.Title
  1342. Title.Text = options.title
  1343.  
  1344. local Body = Notification.Body
  1345. Body.Text = options.text
  1346.  
  1347. local Line = Notification.Line
  1348.  
  1349. -- Put transparent objects to not be visible to make cool effect
  1350. local NotificationTransparentObjects = Utility:getTransparentObjects(Notification)
  1351.  
  1352. for _, data in ipairs(NotificationTransparentObjects) do
  1353. data.object[data.property] = 1
  1354. end
  1355.  
  1356. Notification.BackgroundTransparency = 1
  1357.  
  1358. -- Get back NotificationTransparentObjects again and make it visible now with cool effect!!
  1359. for _, data in ipairs(NotificationTransparentObjects) do
  1360. Utility:tween(data.object, {[data.property] = 0}, 0.2):Play()
  1361. end
  1362.  
  1363. Utility:tween(Notification, {["BackgroundTransparency"] = 0}, 0.2):Play()
  1364.  
  1365. local notificationPosition = -24
  1366. local notificationSize = 0
  1367. local PADDING_Y = 14
  1368.  
  1369. for index, notification in ipairs(ScreenGui.Notifications:GetChildren()) do
  1370. if index == 1 then
  1371. notificationSize = notification.AbsoluteSize.Y
  1372. Utility:tween(notification, {Position = UDim2.new(1, -24, 1, notificationPosition)}, 0.2):Play()
  1373. continue
  1374. end
  1375.  
  1376. -- Current notification position
  1377. notificationPosition -= notificationSize + PADDING_Y
  1378. -- Update notification size for next time to get proper position
  1379. notificationSize = notification.Size.Y.Offset
  1380. Notification.Position = UDim2.new(1, Notification.Position.X.Offset, 1, notificationPosition)
  1381. end
  1382.  
  1383. -- Update notification position when notification is removed
  1384. if not ChildRemoved then
  1385. ScreenGui.Notifications.ChildRemoved:Connect(function(child)
  1386. for index, notification in ipairs(ScreenGui.Notifications:GetChildren()) do
  1387. if index == 1 then
  1388. notificationPosition = -14
  1389. notificationSize = notification.AbsoluteSize.Y
  1390. Utility:tween(notification, {Position = UDim2.new(1, -24, 1, notificationPosition)}, 0.2):Play()
  1391. continue
  1392. end
  1393.  
  1394. -- Current notification position
  1395. notificationPosition -= notificationSize + PADDING_Y
  1396. -- Update notification size for next time to get proper position
  1397. notificationSize = notification.AbsoluteSize.Y
  1398. Utility:tween(notification, {Position = UDim2.new(1, -24, 1, notificationPosition)}, 0.2):Play()
  1399. end
  1400. end)
  1401.  
  1402. ChildRemoved = true
  1403. end
  1404.  
  1405. -- Auto remove notification after a delay
  1406. task.delay(options.duration, function()
  1407. if Notification then
  1408. for _, data in ipairs(Utility:getTransparentObjects(Notification)) do
  1409. Utility:tween(data.object, {[data.property] = 1}, 0.2):Play()
  1410. end
  1411.  
  1412. Utility:tween(Notification, {["BackgroundTransparency"] = 1}, 0.2):Play()
  1413.  
  1414. task.wait(0.2)
  1415. Notification:Destroy()
  1416. end
  1417. end)
  1418.  
  1419. -- Show notification
  1420. Utility:tween(Notification, {Position = UDim2.new(1, -24, 1, notificationPosition)}, 0.2):Play()
  1421. task.wait(0.2)
  1422.  
  1423. -- Register to Theme
  1424. Theme:registerToObjects({
  1425. {object = Notification, property = "BackgroundColor3", theme = {"SecondaryBackgroundColor"}},
  1426. {object = Title, property = "BackgroundColor3", theme = {"PrimaryBackgroundColor"}},
  1427. {object = Title, property = "TextColor3", theme = {"PrimaryTextColor"}},
  1428. {object = Line, property = "BackgroundColor3", theme = {"Line"}},
  1429. {object = Body, property = "TextColor3", theme = {"SecondaryTextColor"}},
  1430. })
  1431. end
  1432.  
  1433. -- Save Manager, Theme Manager, UI settings
  1434. function Library:createManager(options: table)
  1435. Utility:validateOptions(options, {
  1436. folderName = {Default = "Leny", ExpectedType = "string"},
  1437. icon = {Default = "124718082122263", ExpectedType = "string"}
  1438. })
  1439.  
  1440. local function getJsons()
  1441. local jsons = {}
  1442. for _, file in ipairs(listfiles(options.folderName)) do
  1443. if not string.match(file, "Theme") and not string.match(file, "autoload") then
  1444. file = string.gsub(file, options.folderName .. "\\", "")
  1445. file = string.gsub(file, ".json", "")
  1446. table.insert(jsons, file)
  1447. end
  1448. end
  1449.  
  1450. return jsons
  1451. end
  1452.  
  1453. local function getThemeJsons()
  1454. local themeJsons = {}
  1455. for _, file in ipairs(listfiles(options.folderName .. "/Theme")) do
  1456. file = string.gsub(file, options.folderName .. "/Theme" .. "\\", "")
  1457. file = string.gsub(file, ".json", "")
  1458. table.insert(themeJsons, file)
  1459. end
  1460.  
  1461. return themeJsons
  1462. end
  1463.  
  1464. local function getSavedData()
  1465. local SavedData = {
  1466. Dropdown = {},
  1467. Toggle = {},
  1468. Keybind = {},
  1469. Slider = {},
  1470. TextBox = {},
  1471. ColorPicker = {},
  1472. }
  1473.  
  1474. local Excluded = {"Line", "PrimaryColor", "PrimaryTextColor", "SecondaryTextColor", "PrimaryBackgroundColor", "SecondaryBackgroundColor", "TertiaryBackgroundColor", "ScrollingBarImageColor", "TabBackgroundColor"}
  1475.  
  1476. for elementType, elementData in pairs(shared.Flags) do
  1477. for elementName, addon in pairs(elementData) do
  1478. if elementType == "Dropdown" and typeof(addon) == "table" and addon.getList and addon.getValue then
  1479. SavedData.Dropdown[elementName] = {list = addon:getList(), value = addon:getValue()}
  1480. end
  1481.  
  1482. if elementType == "Toggle" and typeof(addon) == "table" and addon.getState then
  1483. SavedData.Toggle[elementName] = {state = addon:getState()}
  1484. end
  1485.  
  1486. if elementType == "Slider" and typeof(addon) == "table" and addon.getValue then
  1487. SavedData.Slider[elementName] = {value = addon:getValue()}
  1488. end
  1489.  
  1490. if elementType == "Keybind" and typeof(addon) == "table" and addon.getKeybind then
  1491. SavedData.Keybind[elementName] = {keybind = addon:getKeybind()}
  1492. end
  1493.  
  1494. if elementType == "TextBox" and typeof(addon) == "table" and addon.getText then
  1495. SavedData.TextBox[elementName] = {text = addon:getText()}
  1496. end
  1497.  
  1498. if not table.find(Excluded, elementName) and elementType == "ColorPicker" and typeof(addon) == "table" and addon.getColor then
  1499. SavedData.ColorPicker[elementName] = {color = {addon:getColor().R * 255, addon:getColor().G * 255, addon:getColor().B * 255}}
  1500. end
  1501. end
  1502. end
  1503.  
  1504. return SavedData
  1505. end
  1506.  
  1507. local function getThemeData()
  1508. local SavedData = {
  1509. ColorPicker = {},
  1510. }
  1511.  
  1512. for elementType, elementData in pairs(shared.Flags) do
  1513. for elementName, addon in pairs(elementData) do
  1514. for _, themeName in ipairs({"Line", "PrimaryColor", "PrimaryTextColor", "SecondaryTextColor", "PrimaryBackgroundColor", "SecondaryBackgroundColor", "TertiaryBackgroundColor", "ScrollingBarImageColor", "TabBackgroundColor"}) do
  1515. if elementName == themeName and elementType == "ColorPicker" and typeof(addon) == "table" and addon.getColor then
  1516. SavedData.ColorPicker[elementName] = {color = {addon:getColor().R * 255, addon:getColor().G * 255, addon:getColor().B * 255}}
  1517. end
  1518. end
  1519. end
  1520. end
  1521.  
  1522. return SavedData
  1523. end
  1524.  
  1525. local function loadSaveConfig(fileName: string)
  1526. local decoded = game:GetService("HttpService"):JSONDecode(readfile(options.folderName .. "/" .. fileName .. ".json"))
  1527.  
  1528. for elementType, elementData in pairs(shared.Flags) do
  1529. for elementName, _ in pairs(elementData) do
  1530. if elementType == "Dropdown" and decoded.Dropdown[elementName] and elementName ~= "Configs" then
  1531. shared.Flags.Dropdown[elementName]:updateList({list = decoded.Dropdown.list, default = decoded.Dropdown.value})
  1532. end
  1533.  
  1534. if elementType == "Toggle" and decoded.Toggle[elementName] then
  1535. shared.Flags.Toggle[elementName]:updateState({state = decoded.Toggle[elementName].state})
  1536. end
  1537.  
  1538. if elementType == "Slider" and decoded.Slider[elementName] then
  1539. shared.Flags.Slider[elementName]:updateValue({value = decoded.Slider[elementName].value})
  1540. end
  1541.  
  1542. if elementType == "Keybind" and decoded.Keybind[elementName] then
  1543. shared.Flags.Keybind[elementName]:updateKeybind({bind = decoded.Keybind[elementName].keybind})
  1544. end
  1545.  
  1546. if elementType == "TextBox" and decoded.TextBox[elementName] then
  1547. shared.Flags.TextBox[elementName]:updateText({text = decoded.TextBox[elementName].text})
  1548. end
  1549.  
  1550. if elementType == "ColorPicker" and decoded.ColorPicker[elementName] then
  1551. shared.Flags.ColorPicker[elementName]:updateColor({color = Color3.fromRGB(unpack(decoded.ColorPicker[elementName].color))})
  1552. end
  1553. end
  1554. end
  1555. end
  1556.  
  1557. local function loadThemeConfig(fileName: string)
  1558. local decoded = game:GetService("HttpService"):JSONDecode(readfile(options.folderName .. "/" .. "Theme/" .. fileName .. ".json"))
  1559.  
  1560. for elementType, elementData in pairs(shared.Flags) do
  1561. for elementName, _ in pairs(elementData) do
  1562. if elementType == "ColorPicker" and decoded.ColorPicker[elementName] then
  1563. shared.Flags.ColorPicker[elementName]:updateColor({color = Color3.fromRGB(unpack(decoded.ColorPicker[elementName].color))})
  1564. end
  1565. end
  1566. end
  1567. end
  1568.  
  1569. local UI = Library:createTab({text = "UI", icon = options.icon})
  1570. local Page = UI:createSubTab({text = "Page 1"})
  1571. local UI = Page:createSection({text = "UI"})
  1572. local SaveManager = Page:createSection({position = "Right", text = "Save Manager"})
  1573. local ThemeManager = Page:createSection({position = "Right", text = "Theme Manager"})
  1574.  
  1575. -- Create color pickers to change UI color
  1576. UI:createPicker({
  1577. text = "SecondaryTextColor",
  1578. default = Theme.SecondaryTextColor,
  1579. callback = function(color)
  1580. Theme:setTheme("SecondaryTextColor", color)
  1581. end,
  1582. })
  1583.  
  1584. UI:createPicker({
  1585. text = "PrimaryTextColor",
  1586. default = Theme.PrimaryTextColor,
  1587. callback = function(color)
  1588. Theme:setTheme("PrimaryTextColor", color)
  1589. end,
  1590. })
  1591.  
  1592. UI:createPicker({
  1593. text = "PrimaryBackgroundColor",
  1594. default = Theme.PrimaryBackgroundColor,
  1595. callback = function(color)
  1596. Theme:setTheme("PrimaryBackgroundColor", color)
  1597. end,
  1598. })
  1599.  
  1600. UI:createPicker({
  1601. text = "SecondaryBackgroundColor",
  1602. default = Theme.SecondaryBackgroundColor,
  1603. callback = function(color)
  1604. Theme:setTheme("SecondaryBackgroundColor", color)
  1605. end,
  1606. })
  1607.  
  1608. UI:createPicker({
  1609. text = "TabBackgroundColor",
  1610. default = Theme.TabBackgroundColor,
  1611. callback = function(color)
  1612. Theme:setTheme("TabBackgroundColor", color)
  1613. end,
  1614. })
  1615.  
  1616. UI:createPicker({
  1617. text = "PrimaryColor",
  1618. default = Theme.PrimaryColor,
  1619. callback = function(color)
  1620. Theme:setTheme("PrimaryColor", color)
  1621. end,
  1622. })
  1623.  
  1624. UI:createPicker({
  1625. text = "Outline",
  1626. default = Theme.Line,
  1627. callback = function(color)
  1628. Theme:setTheme("Line", color)
  1629. end,
  1630. })
  1631.  
  1632. UI:createPicker({
  1633. text = "TertiaryBackgroundColor",
  1634. default = Theme.TertiaryBackgroundColor,
  1635. callback = function(color)
  1636. Theme:setTheme("TertiaryBackgroundColor", color)
  1637. end,
  1638. })
  1639.  
  1640. UI:createPicker({
  1641. text = "SecondaryTextColor",
  1642. default = Theme.SecondaryTextColor,
  1643. callback = function(color)
  1644. Theme:setTheme("SecondaryTextColor", color)
  1645. end,
  1646. })
  1647.  
  1648. UI:createPicker({
  1649. text = "ScrollingBarImageColor",
  1650. default = Theme.ScrollingBarImageColor,
  1651. callback = function(color)
  1652. Theme:setTheme("ScrollingBarImageColor", color)
  1653. end,
  1654. })
  1655.  
  1656. UI:createKeybind({
  1657. text = "Hide UI",
  1658. default = "Insert",
  1659. callback = function()
  1660. ScreenGui.Enabled = not ScreenGui.Enabled
  1661. end,
  1662. })
  1663.  
  1664. UI:createButton({text = "Destroy UI", callback = function() Library:destroy() end})
  1665.  
  1666. -- File system
  1667. if not isfolder(options.folderName) then
  1668. makefolder(options.folderName)
  1669. end
  1670.  
  1671. if not isfolder(options.folderName .. "/Theme") then
  1672. makefolder(options.folderName .. "/Theme")
  1673. end
  1674.  
  1675. local configName = SaveManager:createTextBox({text = "Config Name"})
  1676. local jsons = getJsons()
  1677.  
  1678. SaveManager:createButton({text = "Create Config", callback = function()
  1679. local SavedData = getSavedData()
  1680. local encoded = game:GetService("HttpService"):JSONEncode(SavedData)
  1681. writefile(options.folderName .. "/" .. configName:getText() .. ".json", encoded)
  1682.  
  1683. if shared.Flags.Dropdown["Configs"] then
  1684. shared.Flags.Dropdown["Configs"]:updateList({list = getJsons(), default = {shared.Flags.Dropdown["Configs"]:getValue()}})
  1685. end
  1686. end})
  1687.  
  1688. local Configs = SaveManager:createDropdown({text = "Configs", list = jsons})
  1689.  
  1690. SaveManager:createButton({text = "Save/Overwrite Config", callback = function()
  1691. local SavedData = getSavedData()
  1692. local encoded = game:GetService("HttpService"):JSONEncode(SavedData)
  1693. writefile(options.folderName .. "/" .. Configs:getValue() .. ".json", encoded)
  1694. Configs:updateList({list = getJsons(), default = {Configs:getValue()}})
  1695. end,})
  1696.  
  1697. SaveManager:createButton({
  1698. text = "Load Config",
  1699. callback = function()
  1700. loadSaveConfig(Configs:getValue())
  1701. end
  1702. })
  1703.  
  1704. -- Auto load
  1705. SaveManager:createButton({
  1706. text = "Set as Auto Load",
  1707. callback = function()
  1708. writefile(options.folderName .. "/autoload.txt", Configs:getValue())
  1709. end
  1710. })
  1711.  
  1712. if isfile(options.folderName .. "/autoload.txt") then
  1713. loadConfig(readfile(options.folderName .. "/autoload.txt"))
  1714. end
  1715.  
  1716. local themeConfigName = ThemeManager:createTextBox({text = "Theme Config Name"})
  1717.  
  1718. ThemeManager:createButton({
  1719. text = "Create Theme Config",
  1720. callback = function()
  1721. local ThemeData = getThemeData()
  1722. local encoded = game:GetService("HttpService"):JSONEncode(ThemeData)
  1723. writefile(options.folderName .. "/" .. "Theme/" .. themeConfigName:getText() .. ".json", encoded)
  1724.  
  1725. if shared.Flags.Dropdown["Theme Configs"] then
  1726. shared.Flags.Dropdown["Theme Configs"]:updateList({list = getThemeJsons(), default = {shared.Flags.Dropdown["Theme Configs"]:getValue()}})
  1727. end
  1728. end
  1729. })
  1730.  
  1731. local ThemeConfigs = ThemeManager:createDropdown({
  1732. text = "Theme Configs",
  1733. list = getThemeJsons(),
  1734. })
  1735.  
  1736. ThemeManager:createButton({
  1737. text = "Save Theme Config",
  1738. callback = function()
  1739. local ThemeData = getThemeData()
  1740. local encoded = game:GetService("HttpService"):JSONEncode(ThemeData)
  1741. writefile(options.folderName .. "/" .. "Theme/" .. ThemeConfigs:getValue() .. ".json", encoded)
  1742. ThemeConfigs:updateList({list = getThemeJsons(), default = {ThemeConfigs:getValue()}})
  1743. end
  1744. })
  1745.  
  1746. ThemeManager:createButton({
  1747. text = "Load Theme Config",
  1748. callback = function()
  1749. loadThemeConfig(ThemeConfigs:getValue())
  1750. end
  1751. })
  1752.  
  1753. self.managerCreated = true
  1754. end
  1755.  
  1756. -- Set users theme choice or default theme when initiliazed, could make this cleaner lol, but nah.
  1757. Theme:registerToObjects({
  1758. {object = Glow, property = "ImageColor3", theme = {"PrimaryBackgroundColor"}},
  1759. {object = Background, property = "BackgroundColor3", theme = {"SecondaryBackgroundColor"}},
  1760. {object = Line , property = "BackgroundColor3", theme = {"Line"}},
  1761. {object = Tabs , property = "BackgroundColor3", theme = {"PrimaryBackgroundColor"}},
  1762. {object = Filler , property = "BackgroundColor3", theme = {"PrimaryBackgroundColor"}},
  1763. {object = Title , property = "TextColor3", theme = {"PrimaryTextColor"}},
  1764. {object = Assets.Pages.Fade, property = "BackgroundColor3", theme = {"PrimaryBackgroundColor"}},
  1765. })
  1766.  
  1767. -- Make UI Draggable and Resizable
  1768. Utility:draggable(Library, Glow)
  1769. Utility:resizable(Library, Glow.Background.Pages.Resize, Glow)
  1770.  
  1771. return Library
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement