TheRealHeh

Venyx Ui Lib [Repost]

Jul 18th, 2020
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 56.61 KB | None | 0 0
  1. -- init
  2. local player = game.Players.LocalPlayer
  3. local mouse = player:GetMouse()
  4.  
  5. -- services
  6. local input = game:GetService("UserInputService")
  7. local run = game:GetService("RunService")
  8. local tween = game:GetService("TweenService")
  9. local tweeninfo = TweenInfo.new
  10.  
  11. -- additional
  12. local utility = {}
  13.  
  14. -- themes
  15. local objects = {}
  16. local themes = {
  17. Background = Color3.fromRGB(24, 24, 24),
  18. Glow = Color3.fromRGB(0, 0, 0),
  19. Accent = Color3.fromRGB(10, 10, 10),
  20. LightContrast = Color3.fromRGB(20, 20, 20),
  21. DarkContrast = Color3.fromRGB(14, 14, 14),
  22. TextColor = Color3.fromRGB(255, 255, 255)
  23. }
  24.  
  25. do
  26. function utility:Create(instance, properties, children)
  27. local object = Instance.new(instance)
  28.  
  29. for i, v in pairs(properties or {}) do
  30. object[i] = v
  31.  
  32. if typeof(v) == "Color3" then -- save for theme changer later
  33. local theme = utility:Find(themes, v)
  34.  
  35. if theme then
  36. objects[theme] = objects[theme] or {}
  37. objects[theme][i] = objects[theme][i] or setmetatable({}, {_mode = "k"})
  38.  
  39. table.insert(objects[theme][i], object)
  40. end
  41. end
  42. end
  43.  
  44. for i, module in pairs(children or {}) do
  45. module.Parent = object
  46. end
  47.  
  48. return object
  49. end
  50.  
  51. function utility:Tween(instance, properties, duration, ...)
  52. tween:Create(instance, tweeninfo(duration, ...), properties):Play()
  53. end
  54.  
  55. function utility:Wait()
  56. run.RenderStepped:Wait()
  57. return true
  58. end
  59.  
  60. function utility:Find(table, value) -- table.find doesn't work for dictionaries
  61. for i, v in pairs(table) do
  62. if v == value then
  63. return i
  64. end
  65. end
  66. end
  67.  
  68. function utility:Sort(pattern, values)
  69. local new = {}
  70. pattern = pattern:lower()
  71.  
  72. if pattern == "" then
  73. return values
  74. end
  75.  
  76. for i, value in pairs(values) do
  77. if tostring(value):lower():find(pattern) then
  78. table.insert(new, value)
  79. end
  80. end
  81.  
  82. return new
  83. end
  84.  
  85. function utility:Pop(object, shrink)
  86. local clone = object:Clone()
  87.  
  88. clone.AnchorPoint = Vector2.new(0.5, 0.5)
  89. clone.Size = clone.Size - UDim2.new(0, shrink, 0, shrink)
  90. clone.Position = UDim2.new(0.5, 0, 0.5, 0)
  91.  
  92. clone.Parent = object
  93. clone:ClearAllChildren()
  94.  
  95. object.ImageTransparency = 1
  96. utility:Tween(clone, {Size = object.Size}, 0.2)
  97.  
  98. spawn(function()
  99. wait(0.2)
  100.  
  101. object.ImageTransparency = 0
  102. clone:Destroy()
  103. end)
  104.  
  105. return clone
  106. end
  107.  
  108. function utility:InitializeKeybind()
  109. self.keybinds = {}
  110. self.ended = {}
  111.  
  112. input.InputBegan:Connect(function(key)
  113. if self.keybinds[key.KeyCode] then
  114. for i, bind in pairs(self.keybinds[key.KeyCode]) do
  115. bind()
  116. end
  117. end
  118. end)
  119.  
  120. input.InputEnded:Connect(function(key)
  121. if key.UserInputType == Enum.UserInputType.MouseButton1 then
  122. for i, callback in pairs(self.ended) do
  123. callback()
  124. end
  125. end
  126. end)
  127. end
  128.  
  129. function utility:BindToKey(key, callback)
  130.  
  131. self.keybinds[key] = self.keybinds[key] or {}
  132.  
  133. table.insert(self.keybinds[key], callback)
  134.  
  135. return {
  136. UnBind = function()
  137. for i, bind in pairs(self.keybinds[key]) do
  138. if bind == callback then
  139. table.remove(self.keybinds[key], i)
  140. end
  141. end
  142. end
  143. }
  144. end
  145.  
  146. function utility:KeyPressed() -- yield until next key is pressed
  147. local key = input.InputBegan:Wait()
  148.  
  149. while key.UserInputType ~= Enum.UserInputType.Keyboard do
  150. key = input.InputBegan:Wait()
  151. end
  152.  
  153. wait() -- overlapping connection
  154.  
  155. return key
  156. end
  157.  
  158. function utility:DraggingEnabled(frame, parent)
  159.  
  160. parent = parent or frame
  161.  
  162. -- stolen from wally or kiriot, kek
  163. local dragging = false
  164. local dragInput, mousePos, framePos
  165.  
  166. frame.InputBegan:Connect(function(input)
  167. if input.UserInputType == Enum.UserInputType.MouseButton1 then
  168. dragging = true
  169. mousePos = input.Position
  170. framePos = parent.Position
  171.  
  172. input.Changed:Connect(function()
  173. if input.UserInputState == Enum.UserInputState.End then
  174. dragging = false
  175. end
  176. end)
  177. end
  178. end)
  179.  
  180. frame.InputChanged:Connect(function(input)
  181. if input.UserInputType == Enum.UserInputType.MouseMovement then
  182. dragInput = input
  183. end
  184. end)
  185.  
  186. input.InputChanged:Connect(function(input)
  187. if input == dragInput and dragging then
  188. local delta = input.Position - mousePos
  189. parent.Position = UDim2.new(framePos.X.Scale, framePos.X.Offset + delta.X, framePos.Y.Scale, framePos.Y.Offset + delta.Y)
  190. end
  191. end)
  192.  
  193. end
  194.  
  195. function utility:DraggingEnded(callback)
  196. table.insert(self.ended, callback)
  197. end
  198.  
  199. end
  200.  
  201. -- classes
  202.  
  203. local library = {} -- main
  204. local page = {}
  205. local section = {}
  206.  
  207. do
  208. library.__index = library
  209. page.__index = page
  210. section.__index = section
  211.  
  212. -- new classes
  213.  
  214. function library.new(title)
  215. local container = utility:Create("ScreenGui", {
  216. Name = title,
  217. Parent = game.CoreGui
  218. }, {
  219. utility:Create("ImageLabel", {
  220. Name = "Main",
  221. BackgroundTransparency = 1,
  222. Position = UDim2.new(0.25, 0, 0.052435593, 0),
  223. Size = UDim2.new(0, 511, 0, 325),
  224. Image = "rbxassetid://4641149554",
  225. ImageColor3 = themes.Background,
  226. ScaleType = Enum.ScaleType.Slice,
  227. SliceCenter = Rect.new(4, 4, 296, 296)
  228. }, {
  229. utility:Create("ImageLabel", {
  230. Name = "Glow",
  231. BackgroundTransparency = 1,
  232. Position = UDim2.new(0, -15, 0, -15),
  233. Size = UDim2.new(1, 30, 1, 30),
  234. ZIndex = 0,
  235. Image = "rbxassetid://5028857084",
  236. ImageColor3 = themes.Glow,
  237. ScaleType = Enum.ScaleType.Slice,
  238. SliceCenter = Rect.new(24, 24, 276, 276)
  239. }),
  240. utility:Create("ImageLabel", {
  241. Name = "Pages",
  242. BackgroundTransparency = 1,
  243. ClipsDescendants = true,
  244. Position = UDim2.new(0, 0, 0, 38),
  245. Size = UDim2.new(0, 126, 1, -38),
  246. ZIndex = 3,
  247. Image = "rbxassetid://5012534273",
  248. ImageColor3 = themes.DarkContrast,
  249. ScaleType = Enum.ScaleType.Slice,
  250. SliceCenter = Rect.new(4, 4, 296, 296)
  251. }, {
  252. utility:Create("ScrollingFrame", {
  253. Name = "Pages_Container",
  254. Active = true,
  255. BackgroundTransparency = 1,
  256. Position = UDim2.new(0, 0, 0, 10),
  257. Size = UDim2.new(1, 0, 1, -20),
  258. CanvasSize = UDim2.new(0, 0, 0, 314),
  259. ScrollBarThickness = 0
  260. }, {
  261. utility:Create("UIListLayout", {
  262. SortOrder = Enum.SortOrder.LayoutOrder,
  263. Padding = UDim.new(0, 10)
  264. })
  265. })
  266. }),
  267. utility:Create("ImageLabel", {
  268. Name = "TopBar",
  269. BackgroundTransparency = 1,
  270. ClipsDescendants = true,
  271. Size = UDim2.new(1, 0, 0, 38),
  272. ZIndex = 5,
  273. Image = "rbxassetid://4595286933",
  274. ImageColor3 = themes.Accent,
  275. ScaleType = Enum.ScaleType.Slice,
  276. SliceCenter = Rect.new(4, 4, 296, 296)
  277. }, {
  278. utility:Create("TextLabel", { -- title
  279. Name = "Title",
  280. AnchorPoint = Vector2.new(0, 0.5),
  281. BackgroundTransparency = 1,
  282. Position = UDim2.new(0, 12, 0, 19),
  283. Size = UDim2.new(1, -46, 0, 16),
  284. ZIndex = 5,
  285. Font = Enum.Font.GothamBold,
  286. Text = title,
  287. TextColor3 = themes.TextColor,
  288. TextSize = 14,
  289. TextXAlignment = Enum.TextXAlignment.Left
  290. })
  291. })
  292. })
  293. })
  294.  
  295. utility:InitializeKeybind()
  296. utility:DraggingEnabled(container.Main.TopBar, container.Main)
  297.  
  298. return setmetatable({
  299. container = container,
  300. pagesContainer = container.Main.Pages.Pages_Container,
  301. pages = {}
  302. }, library)
  303. end
  304.  
  305. function page.new(library, title, icon)
  306. local button = utility:Create("TextButton", {
  307. Name = title,
  308. Parent = library.pagesContainer,
  309. BackgroundTransparency = 1,
  310. BorderSizePixel = 0,
  311. Size = UDim2.new(1, 0, 0, 26),
  312. ZIndex = 3,
  313. AutoButtonColor = false,
  314. Font = Enum.Font.Gotham,
  315. Text = "",
  316. TextSize = 14
  317. }, {
  318. utility:Create("TextLabel", {
  319. Name = "Title",
  320. AnchorPoint = Vector2.new(0, 0.5),
  321. BackgroundTransparency = 1,
  322. Position = UDim2.new(0, 40, 0.5, 0),
  323. Size = UDim2.new(0, 76, 1, 0),
  324. ZIndex = 3,
  325. Font = Enum.Font.Gotham,
  326. Text = title,
  327. TextColor3 = themes.TextColor,
  328. TextSize = 12,
  329. TextTransparency = 0.65,
  330. TextXAlignment = Enum.TextXAlignment.Left
  331. }),
  332. icon and utility:Create("ImageLabel", {
  333. Name = "Icon",
  334. AnchorPoint = Vector2.new(0, 0.5),
  335. BackgroundTransparency = 1,
  336. Position = UDim2.new(0, 12, 0.5, 0),
  337. Size = UDim2.new(0, 16, 0, 16),
  338. ZIndex = 3,
  339. Image = "rbxassetid://" .. tostring(icon),
  340. ImageColor3 = themes.TextColor,
  341. ImageTransparency = 0.64
  342. }) or {}
  343. })
  344.  
  345. local container = utility:Create("ScrollingFrame", {
  346. Name = title,
  347. Parent = library.container.Main,
  348. Active = true,
  349. BackgroundTransparency = 1,
  350. BorderSizePixel = 0,
  351. Position = UDim2.new(0, 134, 0, 46),
  352. Size = UDim2.new(1, -142, 1, -56),
  353. CanvasSize = UDim2.new(0, 0, 0, 466),
  354. ScrollBarThickness = 3,
  355. ScrollBarImageColor3 = themes.DarkContrast,
  356. Visible = false
  357. }, {
  358. utility:Create("UIListLayout", {
  359. SortOrder = Enum.SortOrder.LayoutOrder,
  360. Padding = UDim.new(0, 10)
  361. })
  362. })
  363.  
  364. return setmetatable({
  365. library = library,
  366. container = container,
  367. button = button,
  368. sections = {}
  369. }, page)
  370. end
  371.  
  372. function section.new(page, title)
  373. local container = utility:Create("ImageLabel", {
  374. Name = title,
  375. Parent = page.container,
  376. BackgroundTransparency = 1,
  377. Size = UDim2.new(1, -10, 0, 28),
  378. ZIndex = 2,
  379. Image = "rbxassetid://5028857472",
  380. ImageColor3 = themes.LightContrast,
  381. ScaleType = Enum.ScaleType.Slice,
  382. SliceCenter = Rect.new(4, 4, 296, 296),
  383. ClipsDescendants = true
  384. }, {
  385. utility:Create("Frame", {
  386. Name = "Container",
  387. Active = true,
  388. BackgroundTransparency = 1,
  389. BorderSizePixel = 0,
  390. Position = UDim2.new(0, 8, 0, 8),
  391. Size = UDim2.new(1, -16, 1, -16)
  392. }, {
  393. utility:Create("TextLabel", {
  394. Name = "Title",
  395. BackgroundTransparency = 1,
  396. Size = UDim2.new(1, 0, 0, 20),
  397. ZIndex = 2,
  398. Font = Enum.Font.GothamSemibold,
  399. Text = title,
  400. TextColor3 = themes.TextColor,
  401. TextSize = 12,
  402. TextXAlignment = Enum.TextXAlignment.Left,
  403. TextTransparency = 1
  404. }),
  405. utility:Create("UIListLayout", {
  406. SortOrder = Enum.SortOrder.LayoutOrder,
  407. Padding = UDim.new(0, 4)
  408. })
  409. })
  410. })
  411.  
  412. return setmetatable({
  413. page = page,
  414. container = container.Container,
  415. colorpickers = {},
  416. modules = {},
  417. binds = {},
  418. lists = {},
  419. }, section)
  420. end
  421.  
  422. function library:addPage(...)
  423.  
  424. local page = page.new(self, ...)
  425. local button = page.button
  426.  
  427. table.insert(self.pages, page)
  428.  
  429. button.MouseButton1Click:Connect(function()
  430. self:SelectPage(page, true)
  431. end)
  432.  
  433. return page
  434. end
  435.  
  436. function page:addSection(...)
  437. local section = section.new(self, ...)
  438.  
  439. table.insert(self.sections, section)
  440.  
  441. return section
  442. end
  443.  
  444. -- functions
  445.  
  446. function library:setTheme(theme, color3)
  447. themes[theme] = color3
  448.  
  449. for property, objects in pairs(objects[theme]) do
  450. for i, object in pairs(objects) do
  451. if not object.Parent or (object.Name == "Button" and object.Parent.Name == "ColorPicker") then
  452. objects[i] = nil -- i can do this because weak tables :D
  453. else
  454. object[property] = color3
  455. end
  456. end
  457. end
  458. end
  459.  
  460. function library:toggle()
  461.  
  462. if self.toggling then
  463. return
  464. end
  465.  
  466. self.toggling = true
  467.  
  468. local container = self.container.Main
  469. local topbar = container.TopBar
  470.  
  471. if self.position then
  472. utility:Tween(container, {
  473. Size = UDim2.new(0, 511, 0, 428),
  474. Position = self.position
  475. }, 0.2)
  476. wait(0.2)
  477.  
  478. utility:Tween(topbar, {Size = UDim2.new(1, 0, 0, 38)}, 0.2)
  479. wait(0.2)
  480.  
  481. container.ClipsDescendants = false
  482. self.position = nil
  483. else
  484. self.position = container.Position
  485. container.ClipsDescendants = true
  486.  
  487. utility:Tween(topbar, {Size = UDim2.new(1, 0, 1, 0)}, 0.2)
  488. wait(0.2)
  489.  
  490. utility:Tween(container, {
  491. Size = UDim2.new(0, 511, 0, 0),
  492. Position = self.position + UDim2.new(0, 0, 0, 428)
  493. }, 0.2)
  494. wait(0.2)
  495. end
  496.  
  497. self.toggling = false
  498. end
  499.  
  500. -- new modules
  501.  
  502. function library:Notify(title, text, callback)
  503.  
  504. -- overwrite last notification
  505. if self.activeNotification then
  506. self.activeNotification = self.activeNotification()
  507. end
  508.  
  509. -- standard create
  510. local notification = utility:Create("ImageLabel", {
  511. Name = "Notification",
  512. Parent = self.container,
  513. BackgroundTransparency = 1,
  514. Size = UDim2.new(0, 200, 0, 60),
  515. Image = "rbxassetid://5028857472",
  516. ImageColor3 = themes.Background,
  517. ScaleType = Enum.ScaleType.Slice,
  518. SliceCenter = Rect.new(4, 4, 296, 296),
  519. ZIndex = 3,
  520. ClipsDescendants = true
  521. }, {
  522. utility:Create("ImageLabel", {
  523. Name = "Flash",
  524. Size = UDim2.new(1, 0, 1, 0),
  525. BackgroundTransparency = 1,
  526. Image = "rbxassetid://4641149554",
  527. ImageColor3 = themes.TextColor,
  528. ZIndex = 5
  529. }),
  530. utility:Create("ImageLabel", {
  531. Name = "Glow",
  532. BackgroundTransparency = 1,
  533. Position = UDim2.new(0, -15, 0, -15),
  534. Size = UDim2.new(1, 30, 1, 30),
  535. ZIndex = 2,
  536. Image = "rbxassetid://5028857084",
  537. ImageColor3 = themes.Glow,
  538. ScaleType = Enum.ScaleType.Slice,
  539. SliceCenter = Rect.new(24, 24, 276, 276)
  540. }),
  541. utility:Create("TextLabel", {
  542. Name = "Title",
  543. BackgroundTransparency = 1,
  544. Position = UDim2.new(0, 10, 0, 8),
  545. Size = UDim2.new(1, -40, 0, 16),
  546. ZIndex = 4,
  547. Font = Enum.Font.GothamSemibold,
  548. TextColor3 = themes.TextColor,
  549. TextSize = 14.000,
  550. TextXAlignment = Enum.TextXAlignment.Left
  551. }),
  552. utility:Create("TextLabel", {
  553. Name = "Text",
  554. BackgroundTransparency = 1,
  555. Position = UDim2.new(0, 10, 1, -24),
  556. Size = UDim2.new(1, -40, 0, 16),
  557. ZIndex = 4,
  558. Font = Enum.Font.Gotham,
  559. TextColor3 = themes.TextColor,
  560. TextSize = 12.000,
  561. TextXAlignment = Enum.TextXAlignment.Left
  562. }),
  563. utility:Create("ImageButton", {
  564. Name = "Accept",
  565. BackgroundTransparency = 1,
  566. Position = UDim2.new(1, -26, 0, 8),
  567. Size = UDim2.new(0, 16, 0, 16),
  568. Image = "rbxassetid://5012538259",
  569. ImageColor3 = themes.TextColor,
  570. ZIndex = 4
  571. }),
  572. utility:Create("ImageButton", {
  573. Name = "Decline",
  574. BackgroundTransparency = 1,
  575. Position = UDim2.new(1, -26, 1, -24),
  576. Size = UDim2.new(0, 16, 0, 16),
  577. Image = "rbxassetid://5012538583",
  578. ImageColor3 = themes.TextColor,
  579. ZIndex = 4
  580. })
  581. })
  582.  
  583. -- dragging
  584. utility:DraggingEnabled(notification)
  585.  
  586. -- position and size
  587. title = title or "Notification"
  588. text = text or ""
  589.  
  590. notification.Title.Text = title
  591. notification.Text.Text = text
  592.  
  593. local padding = 10
  594. local textSize = game:GetService("TextService"):GetTextSize(text, 12, Enum.Font.Gotham, Vector2.new(math.huge, 16))
  595.  
  596. notification.Position = library.lastNotification or UDim2.new(0, padding, 1, -(notification.AbsoluteSize.Y + padding))
  597. notification.Size = UDim2.new(0, 0, 0, 60)
  598.  
  599. utility:Tween(notification, {Size = UDim2.new(0, textSize.X + 70, 0, 60)}, 0.2)
  600. wait(0.2)
  601.  
  602. notification.ClipsDescendants = false
  603. utility:Tween(notification.Flash, {
  604. Size = UDim2.new(0, 0, 0, 60),
  605. Position = UDim2.new(1, 0, 0, 0)
  606. }, 0.2)
  607.  
  608. -- callbacks
  609. local active = true
  610. local close = function()
  611.  
  612. if not active then
  613. return
  614. end
  615.  
  616. active = false
  617. notification.ClipsDescendants = true
  618.  
  619. library.lastNotification = notification.Position
  620. notification.Flash.Position = UDim2.new(0, 0, 0, 0)
  621. utility:Tween(notification.Flash, {Size = UDim2.new(1, 0, 1, 0)}, 0.2)
  622.  
  623. wait(0.2)
  624. utility:Tween(notification, {
  625. Size = UDim2.new(0, 0, 0, 60),
  626. Position = notification.Position + UDim2.new(0, textSize.X + 70, 0, 0)
  627. }, 0.2)
  628.  
  629. wait(0.2)
  630. notification:Destroy()
  631. end
  632.  
  633. self.activeNotification = close
  634.  
  635. notification.Accept.MouseButton1Click:Connect(function()
  636.  
  637. if not active then
  638. return
  639. end
  640.  
  641. if callback then
  642. callback(true)
  643. end
  644.  
  645. close()
  646. end)
  647.  
  648. notification.Decline.MouseButton1Click:Connect(function()
  649.  
  650. if not active then
  651. return
  652. end
  653.  
  654. if callback then
  655. callback(false)
  656. end
  657.  
  658. close()
  659. end)
  660. end
  661.  
  662. function section:addButton(title, callback)
  663. local button = utility:Create("ImageButton", {
  664. Name = "Button",
  665. Parent = self.container,
  666. BackgroundTransparency = 1,
  667. BorderSizePixel = 0,
  668. Size = UDim2.new(1, 0, 0, 30),
  669. ZIndex = 2,
  670. Image = "rbxassetid://5028857472",
  671. ImageColor3 = themes.DarkContrast,
  672. ScaleType = Enum.ScaleType.Slice,
  673. SliceCenter = Rect.new(2, 2, 298, 298)
  674. }, {
  675. utility:Create("TextLabel", {
  676. Name = "Title",
  677. BackgroundTransparency = 1,
  678. Size = UDim2.new(1, 0, 1, 0),
  679. ZIndex = 3,
  680. Font = Enum.Font.Gotham,
  681. Text = title,
  682. TextColor3 = themes.TextColor,
  683. TextSize = 12,
  684. TextTransparency = 0.10000000149012
  685. })
  686. })
  687.  
  688. table.insert(self.modules, button)
  689. --self:Resize()
  690.  
  691. local text = button.Title
  692. local debounce
  693.  
  694. button.MouseButton1Click:Connect(function()
  695.  
  696. if debounce then
  697. return
  698. end
  699.  
  700. -- animation
  701. utility:Pop(button, 10)
  702.  
  703. debounce = true
  704. text.TextSize = 0
  705. utility:Tween(button.Title, {TextSize = 14}, 0.2)
  706.  
  707. wait(0.2)
  708. utility:Tween(button.Title, {TextSize = 12}, 0.2)
  709.  
  710. if callback then
  711. callback(function(...)
  712. self:updateButton(button, ...)
  713. end)
  714. end
  715.  
  716. debounce = false
  717. end)
  718.  
  719. return button
  720. end
  721.  
  722. function section:addToggle(title, default, callback)
  723. local toggle = utility:Create("ImageButton", {
  724. Name = "Toggle",
  725. Parent = self.container,
  726. BackgroundTransparency = 1,
  727. BorderSizePixel = 0,
  728. Size = UDim2.new(1, 0, 0, 30),
  729. ZIndex = 2,
  730. Image = "rbxassetid://5028857472",
  731. ImageColor3 = themes.DarkContrast,
  732. ScaleType = Enum.ScaleType.Slice,
  733. SliceCenter = Rect.new(2, 2, 298, 298)
  734. },{
  735. utility:Create("TextLabel", {
  736. Name = "Title",
  737. AnchorPoint = Vector2.new(0, 0.5),
  738. BackgroundTransparency = 1,
  739. Position = UDim2.new(0, 10, 0.5, 1),
  740. Size = UDim2.new(0.5, 0, 1, 0),
  741. ZIndex = 3,
  742. Font = Enum.Font.Gotham,
  743. Text = title,
  744. TextColor3 = themes.TextColor,
  745. TextSize = 12,
  746. TextTransparency = 0.10000000149012,
  747. TextXAlignment = Enum.TextXAlignment.Left
  748. }),
  749. utility:Create("ImageLabel", {
  750. Name = "Button",
  751. BackgroundTransparency = 1,
  752. BorderSizePixel = 0,
  753. Position = UDim2.new(1, -50, 0.5, -8),
  754. Size = UDim2.new(0, 40, 0, 16),
  755. ZIndex = 2,
  756. Image = "rbxassetid://5028857472",
  757. ImageColor3 = themes.LightContrast,
  758. ScaleType = Enum.ScaleType.Slice,
  759. SliceCenter = Rect.new(2, 2, 298, 298)
  760. }, {
  761. utility:Create("ImageLabel", {
  762. Name = "Frame",
  763. BackgroundTransparency = 1,
  764. Position = UDim2.new(0, 2, 0.5, -6),
  765. Size = UDim2.new(1, -22, 1, -4),
  766. ZIndex = 2,
  767. Image = "rbxassetid://5028857472",
  768. ImageColor3 = themes.TextColor,
  769. ScaleType = Enum.ScaleType.Slice,
  770. SliceCenter = Rect.new(2, 2, 298, 298)
  771. })
  772. })
  773. })
  774.  
  775. table.insert(self.modules, toggle)
  776. --self:Resize()
  777.  
  778. local active = default
  779. self:updateToggle(toggle, nil, active)
  780.  
  781. toggle.MouseButton1Click:Connect(function()
  782. active = not active
  783. self:updateToggle(toggle, nil, active)
  784.  
  785. if callback then
  786. callback(active, function(...)
  787. self:updateToggle(toggle, ...)
  788. end)
  789. end
  790. end)
  791.  
  792. return toggle
  793. end
  794.  
  795. function section:addTextbox(title, default, callback)
  796. local textbox = utility:Create("ImageButton", {
  797. Name = "Textbox",
  798. Parent = self.container,
  799. BackgroundTransparency = 1,
  800. BorderSizePixel = 0,
  801. Size = UDim2.new(1, 0, 0, 30),
  802. ZIndex = 2,
  803. Image = "rbxassetid://5028857472",
  804. ImageColor3 = themes.DarkContrast,
  805. ScaleType = Enum.ScaleType.Slice,
  806. SliceCenter = Rect.new(2, 2, 298, 298)
  807. }, {
  808. utility:Create("TextLabel", {
  809. Name = "Title",
  810. AnchorPoint = Vector2.new(0, 0.5),
  811. BackgroundTransparency = 1,
  812. Position = UDim2.new(0, 10, 0.5, 1),
  813. Size = UDim2.new(0.5, 0, 1, 0),
  814. ZIndex = 3,
  815. Font = Enum.Font.Gotham,
  816. Text = title,
  817. TextColor3 = themes.TextColor,
  818. TextSize = 12,
  819. TextTransparency = 0.10000000149012,
  820. TextXAlignment = Enum.TextXAlignment.Left
  821. }),
  822. utility:Create("ImageLabel", {
  823. Name = "Button",
  824. BackgroundTransparency = 1,
  825. Position = UDim2.new(1, -110, 0.5, -8),
  826. Size = UDim2.new(0, 100, 0, 16),
  827. ZIndex = 2,
  828. Image = "rbxassetid://5028857472",
  829. ImageColor3 = themes.LightContrast,
  830. ScaleType = Enum.ScaleType.Slice,
  831. SliceCenter = Rect.new(2, 2, 298, 298)
  832. }, {
  833. utility:Create("TextBox", {
  834. Name = "Textbox",
  835. BackgroundTransparency = 1,
  836. TextTruncate = Enum.TextTruncate.AtEnd,
  837. Position = UDim2.new(0, 5, 0, 0),
  838. Size = UDim2.new(1, -10, 1, 0),
  839. ZIndex = 3,
  840. Font = Enum.Font.GothamSemibold,
  841. Text = default or "",
  842. TextColor3 = themes.TextColor,
  843. TextSize = 11
  844. })
  845. })
  846. })
  847.  
  848. table.insert(self.modules, textbox)
  849. --self:Resize()
  850.  
  851. local button = textbox.Button
  852. local input = button.Textbox
  853.  
  854. textbox.MouseButton1Click:Connect(function()
  855.  
  856. if textbox.Button.Size ~= UDim2.new(0, 100, 0, 16) then
  857. return
  858. end
  859.  
  860. utility:Tween(textbox.Button, {
  861. Size = UDim2.new(0, 200, 0, 16),
  862. Position = UDim2.new(1, -210, 0.5, -8)
  863. }, 0.2)
  864.  
  865. wait()
  866.  
  867. input.TextXAlignment = Enum.TextXAlignment.Left
  868. input:CaptureFocus()
  869. end)
  870.  
  871. input:GetPropertyChangedSignal("Text"):Connect(function()
  872.  
  873. if button.ImageTransparency == 0 and (button.Size == UDim2.new(0, 200, 0, 16) or button.Size == UDim2.new(0, 100, 0, 16)) then -- i know, i dont like this either
  874. utility:Pop(button, 10)
  875. end
  876.  
  877. if callback then
  878. callback(input.Text, nil, function(...)
  879. self:updateTextbox(textbox, ...)
  880. end)
  881. end
  882. end)
  883.  
  884. input.FocusLost:Connect(function()
  885.  
  886. input.TextXAlignment = Enum.TextXAlignment.Center
  887.  
  888. utility:Tween(textbox.Button, {
  889. Size = UDim2.new(0, 100, 0, 16),
  890. Position = UDim2.new(1, -110, 0.5, -8)
  891. }, 0.2)
  892.  
  893. if callback then
  894. callback(input.Text, true, function(...)
  895. self:updateTextbox(textbox, ...)
  896. end)
  897. end
  898. end)
  899.  
  900. return textbox
  901. end
  902.  
  903. function section:addKeybind(title, default, callback, changedCallback)
  904. local keybind = utility:Create("ImageButton", {
  905. Name = "Keybind",
  906. Parent = self.container,
  907. BackgroundTransparency = 1,
  908. BorderSizePixel = 0,
  909. Size = UDim2.new(1, 0, 0, 30),
  910. ZIndex = 2,
  911. Image = "rbxassetid://5028857472",
  912. ImageColor3 = themes.DarkContrast,
  913. ScaleType = Enum.ScaleType.Slice,
  914. SliceCenter = Rect.new(2, 2, 298, 298)
  915. }, {
  916. utility:Create("TextLabel", {
  917. Name = "Title",
  918. AnchorPoint = Vector2.new(0, 0.5),
  919. BackgroundTransparency = 1,
  920. Position = UDim2.new(0, 10, 0.5, 1),
  921. Size = UDim2.new(1, 0, 1, 0),
  922. ZIndex = 3,
  923. Font = Enum.Font.Gotham,
  924. Text = title,
  925. TextColor3 = themes.TextColor,
  926. TextSize = 12,
  927. TextTransparency = 0.10000000149012,
  928. TextXAlignment = Enum.TextXAlignment.Left
  929. }),
  930. utility:Create("ImageLabel", {
  931. Name = "Button",
  932. BackgroundTransparency = 1,
  933. Position = UDim2.new(1, -110, 0.5, -8),
  934. Size = UDim2.new(0, 100, 0, 16),
  935. ZIndex = 2,
  936. Image = "rbxassetid://5028857472",
  937. ImageColor3 = themes.LightContrast,
  938. ScaleType = Enum.ScaleType.Slice,
  939. SliceCenter = Rect.new(2, 2, 298, 298)
  940. }, {
  941. utility:Create("TextLabel", {
  942. Name = "Text",
  943. BackgroundTransparency = 1,
  944. ClipsDescendants = true,
  945. Size = UDim2.new(1, 0, 1, 0),
  946. ZIndex = 3,
  947. Font = Enum.Font.GothamSemibold,
  948. Text = default and default.Name or "None",
  949. TextColor3 = themes.TextColor,
  950. TextSize = 11
  951. })
  952. })
  953. })
  954.  
  955. table.insert(self.modules, keybind)
  956. --self:Resize()
  957.  
  958. local text = keybind.Button.Text
  959. local button = keybind.Button
  960.  
  961. local animate = function()
  962. if button.ImageTransparency == 0 then
  963. utility:Pop(button, 10)
  964. end
  965. end
  966.  
  967. self.binds[keybind] = {callback = function()
  968. animate()
  969.  
  970. if callback then
  971. callback(function(...)
  972. self:updateKeybind(keybind, ...)
  973. end)
  974. end
  975. end}
  976.  
  977. if default and callback then
  978. self:updateKeybind(keybind, nil, default)
  979. end
  980.  
  981. keybind.MouseButton1Click:Connect(function()
  982.  
  983. animate()
  984.  
  985. if self.binds[keybind].connection then -- unbind
  986. return self:updateKeybind(keybind)
  987. end
  988.  
  989. if text.Text == "None" then -- new bind
  990. text.Text = "..."
  991.  
  992. local key = utility:KeyPressed()
  993.  
  994. self:updateKeybind(keybind, nil, key.KeyCode)
  995. animate()
  996.  
  997. if changedCallback then
  998. changedCallback(key, function(...)
  999. self:updateKeybind(keybind, ...)
  1000. end)
  1001. end
  1002. end
  1003. end)
  1004.  
  1005. return keybind
  1006. end
  1007.  
  1008. function section:addColorPicker(title, default, callback)
  1009. local colorpicker = utility:Create("ImageButton", {
  1010. Name = "ColorPicker",
  1011. Parent = self.container,
  1012. BackgroundTransparency = 1,
  1013. BorderSizePixel = 0,
  1014. Size = UDim2.new(1, 0, 0, 30),
  1015. ZIndex = 2,
  1016. Image = "rbxassetid://5028857472",
  1017. ImageColor3 = themes.DarkContrast,
  1018. ScaleType = Enum.ScaleType.Slice,
  1019. SliceCenter = Rect.new(2, 2, 298, 298)
  1020. },{
  1021. utility:Create("TextLabel", {
  1022. Name = "Title",
  1023. AnchorPoint = Vector2.new(0, 0.5),
  1024. BackgroundTransparency = 1,
  1025. Position = UDim2.new(0, 10, 0.5, 1),
  1026. Size = UDim2.new(0.5, 0, 1, 0),
  1027. ZIndex = 3,
  1028. Font = Enum.Font.Gotham,
  1029. Text = title,
  1030. TextColor3 = themes.TextColor,
  1031. TextSize = 12,
  1032. TextTransparency = 0.10000000149012,
  1033. TextXAlignment = Enum.TextXAlignment.Left
  1034. }),
  1035. utility:Create("ImageButton", {
  1036. Name = "Button",
  1037. BackgroundTransparency = 1,
  1038. BorderSizePixel = 0,
  1039. Position = UDim2.new(1, -50, 0.5, -7),
  1040. Size = UDim2.new(0, 40, 0, 14),
  1041. ZIndex = 2,
  1042. Image = "rbxassetid://5028857472",
  1043. ImageColor3 = Color3.fromRGB(255, 255, 255),
  1044. ScaleType = Enum.ScaleType.Slice,
  1045. SliceCenter = Rect.new(2, 2, 298, 298)
  1046. })
  1047. })
  1048.  
  1049. local tab = utility:Create("ImageLabel", {
  1050. Name = "ColorPicker",
  1051. Parent = self.page.library.container,
  1052. BackgroundTransparency = 1,
  1053. Position = UDim2.new(0.75, 0, 0.400000006, 0),
  1054. Selectable = true,
  1055. AnchorPoint = Vector2.new(0.5, 0.5),
  1056. Size = UDim2.new(0, 162, 0, 169),
  1057. Image = "rbxassetid://5028857472",
  1058. ImageColor3 = themes.Background,
  1059. ScaleType = Enum.ScaleType.Slice,
  1060. SliceCenter = Rect.new(2, 2, 298, 298),
  1061. Visible = false,
  1062. }, {
  1063. utility:Create("ImageLabel", {
  1064. Name = "Glow",
  1065. BackgroundTransparency = 1,
  1066. Position = UDim2.new(0, -15, 0, -15),
  1067. Size = UDim2.new(1, 30, 1, 30),
  1068. ZIndex = 0,
  1069. Image = "rbxassetid://5028857084",
  1070. ImageColor3 = themes.Glow,
  1071. ScaleType = Enum.ScaleType.Slice,
  1072. SliceCenter = Rect.new(22, 22, 278, 278)
  1073. }),
  1074. utility:Create("TextLabel", {
  1075. Name = "Title",
  1076. BackgroundTransparency = 1,
  1077. Position = UDim2.new(0, 10, 0, 8),
  1078. Size = UDim2.new(1, -40, 0, 16),
  1079. ZIndex = 2,
  1080. Font = Enum.Font.GothamSemibold,
  1081. Text = title,
  1082. TextColor3 = themes.TextColor,
  1083. TextSize = 14,
  1084. TextXAlignment = Enum.TextXAlignment.Left
  1085. }),
  1086. utility:Create("ImageButton", {
  1087. Name = "Close",
  1088. BackgroundTransparency = 1,
  1089. Position = UDim2.new(1, -26, 0, 8),
  1090. Size = UDim2.new(0, 16, 0, 16),
  1091. ZIndex = 2,
  1092. Image = "rbxassetid://5012538583",
  1093. ImageColor3 = themes.TextColor
  1094. }),
  1095. utility:Create("Frame", {
  1096. Name = "Container",
  1097. BackgroundTransparency = 1,
  1098. Position = UDim2.new(0, 8, 0, 32),
  1099. Size = UDim2.new(1, -18, 1, -40)
  1100. }, {
  1101. utility:Create("UIListLayout", {
  1102. SortOrder = Enum.SortOrder.LayoutOrder,
  1103. Padding = UDim.new(0, 6)
  1104. }),
  1105. utility:Create("ImageButton", {
  1106. Name = "Canvas",
  1107. BackgroundTransparency = 1,
  1108. BorderColor3 = themes.LightContrast,
  1109. Size = UDim2.new(1, 0, 0, 60),
  1110. AutoButtonColor = false,
  1111. Image = "rbxassetid://5108535320",
  1112. ImageColor3 = Color3.fromRGB(255, 0, 0),
  1113. ScaleType = Enum.ScaleType.Slice,
  1114. SliceCenter = Rect.new(2, 2, 298, 298)
  1115. }, {
  1116. utility:Create("ImageLabel", {
  1117. Name = "White_Overlay",
  1118. BackgroundTransparency = 1,
  1119. Size = UDim2.new(1, 0, 0, 60),
  1120. Image = "rbxassetid://5107152351",
  1121. SliceCenter = Rect.new(2, 2, 298, 298)
  1122. }),
  1123. utility:Create("ImageLabel", {
  1124. Name = "Black_Overlay",
  1125. BackgroundTransparency = 1,
  1126. Size = UDim2.new(1, 0, 0, 60),
  1127. Image = "rbxassetid://5107152095",
  1128. SliceCenter = Rect.new(2, 2, 298, 298)
  1129. }),
  1130. utility:Create("ImageLabel", {
  1131. Name = "Cursor",
  1132. BackgroundColor3 = themes.TextColor,
  1133. AnchorPoint = Vector2.new(0.5, 0.5),
  1134. BackgroundTransparency = 1.000,
  1135. Size = UDim2.new(0, 10, 0, 10),
  1136. Position = UDim2.new(0, 0, 0, 0),
  1137. Image = "rbxassetid://5100115962",
  1138. SliceCenter = Rect.new(2, 2, 298, 298)
  1139. })
  1140. }),
  1141. utility:Create("ImageButton", {
  1142. Name = "Color",
  1143. BackgroundTransparency = 1,
  1144. BorderSizePixel = 0,
  1145. Position = UDim2.new(0, 0, 0, 4),
  1146. Selectable = false,
  1147. Size = UDim2.new(1, 0, 0, 16),
  1148. ZIndex = 2,
  1149. AutoButtonColor = false,
  1150. Image = "rbxassetid://5028857472",
  1151. ScaleType = Enum.ScaleType.Slice,
  1152. SliceCenter = Rect.new(2, 2, 298, 298)
  1153. }, {
  1154. utility:Create("Frame", {
  1155. Name = "Select",
  1156. BackgroundColor3 = themes.TextColor,
  1157. BorderSizePixel = 1,
  1158. Position = UDim2.new(1, 0, 0, 0),
  1159. Size = UDim2.new(0, 2, 1, 0),
  1160. ZIndex = 2
  1161. }),
  1162. utility:Create("UIGradient", { -- rainbow canvas
  1163. Color = ColorSequence.new({
  1164. ColorSequenceKeypoint.new(0.00, Color3.fromRGB(255, 0, 0)),
  1165. ColorSequenceKeypoint.new(0.17, Color3.fromRGB(255, 255, 0)),
  1166. ColorSequenceKeypoint.new(0.33, Color3.fromRGB(0, 255, 0)),
  1167. ColorSequenceKeypoint.new(0.50, Color3.fromRGB(0, 255, 255)),
  1168. ColorSequenceKeypoint.new(0.66, Color3.fromRGB(0, 0, 255)),
  1169. ColorSequenceKeypoint.new(0.82, Color3.fromRGB(255, 0, 255)),
  1170. ColorSequenceKeypoint.new(1.00, Color3.fromRGB(255, 0, 0))
  1171. })
  1172. })
  1173. }),
  1174. utility:Create("Frame", {
  1175. Name = "Inputs",
  1176. BackgroundTransparency = 1,
  1177. Position = UDim2.new(0, 10, 0, 158),
  1178. Size = UDim2.new(1, 0, 0, 16)
  1179. }, {
  1180. utility:Create("UIListLayout", {
  1181. FillDirection = Enum.FillDirection.Horizontal,
  1182. SortOrder = Enum.SortOrder.LayoutOrder,
  1183. Padding = UDim.new(0, 6)
  1184. }),
  1185. utility:Create("ImageLabel", {
  1186. Name = "R",
  1187. BackgroundTransparency = 1,
  1188. BorderSizePixel = 0,
  1189. Size = UDim2.new(0.305, 0, 1, 0),
  1190. ZIndex = 2,
  1191. Image = "rbxassetid://5028857472",
  1192. ImageColor3 = themes.DarkContrast,
  1193. ScaleType = Enum.ScaleType.Slice,
  1194. SliceCenter = Rect.new(2, 2, 298, 298)
  1195. }, {
  1196. utility:Create("TextLabel", {
  1197. Name = "Text",
  1198. BackgroundTransparency = 1,
  1199. Size = UDim2.new(0.400000006, 0, 1, 0),
  1200. ZIndex = 2,
  1201. Font = Enum.Font.Gotham,
  1202. Text = "R:",
  1203. TextColor3 = themes.TextColor,
  1204. TextSize = 10.000
  1205. }),
  1206. utility:Create("TextBox", {
  1207. Name = "Textbox",
  1208. BackgroundTransparency = 1,
  1209. Position = UDim2.new(0.300000012, 0, 0, 0),
  1210. Size = UDim2.new(0.600000024, 0, 1, 0),
  1211. ZIndex = 2,
  1212. Font = Enum.Font.Gotham,
  1213. PlaceholderColor3 = themes.DarkContrast,
  1214. Text = "255",
  1215. TextColor3 = themes.TextColor,
  1216. TextSize = 10.000
  1217. })
  1218. }),
  1219. utility:Create("ImageLabel", {
  1220. Name = "G",
  1221. BackgroundTransparency = 1,
  1222. BorderSizePixel = 0,
  1223. Size = UDim2.new(0.305, 0, 1, 0),
  1224. ZIndex = 2,
  1225. Image = "rbxassetid://5028857472",
  1226. ImageColor3 = themes.DarkContrast,
  1227. ScaleType = Enum.ScaleType.Slice,
  1228. SliceCenter = Rect.new(2, 2, 298, 298)
  1229. }, {
  1230. utility:Create("TextLabel", {
  1231. Name = "Text",
  1232. BackgroundTransparency = 1,
  1233. ZIndex = 2,
  1234. Size = UDim2.new(0.400000006, 0, 1, 0),
  1235. Font = Enum.Font.Gotham,
  1236. Text = "G:",
  1237. TextColor3 = themes.TextColor,
  1238. TextSize = 10.000
  1239. }),
  1240. utility:Create("TextBox", {
  1241. Name = "Textbox",
  1242. BackgroundTransparency = 1,
  1243. Position = UDim2.new(0.300000012, 0, 0, 0),
  1244. Size = UDim2.new(0.600000024, 0, 1, 0),
  1245. ZIndex = 2,
  1246. Font = Enum.Font.Gotham,
  1247. Text = "255",
  1248. TextColor3 = themes.TextColor,
  1249. TextSize = 10.000
  1250. })
  1251. }),
  1252. utility:Create("ImageLabel", {
  1253. Name = "B",
  1254. BackgroundTransparency = 1,
  1255. BorderSizePixel = 0,
  1256. Size = UDim2.new(0.305, 0, 1, 0),
  1257. ZIndex = 2,
  1258. Image = "rbxassetid://5028857472",
  1259. ImageColor3 = themes.DarkContrast,
  1260. ScaleType = Enum.ScaleType.Slice,
  1261. SliceCenter = Rect.new(2, 2, 298, 298)
  1262. }, {
  1263. utility:Create("TextLabel", {
  1264. Name = "Text",
  1265. BackgroundTransparency = 1,
  1266. Size = UDim2.new(0.400000006, 0, 1, 0),
  1267. ZIndex = 2,
  1268. Font = Enum.Font.Gotham,
  1269. Text = "B:",
  1270. TextColor3 = themes.TextColor,
  1271. TextSize = 10.000
  1272. }),
  1273. utility:Create("TextBox", {
  1274. Name = "Textbox",
  1275. BackgroundTransparency = 1,
  1276. Position = UDim2.new(0.300000012, 0, 0, 0),
  1277. Size = UDim2.new(0.600000024, 0, 1, 0),
  1278. ZIndex = 2,
  1279. Font = Enum.Font.Gotham,
  1280. Text = "255",
  1281. TextColor3 = themes.TextColor,
  1282. TextSize = 10.000
  1283. })
  1284. }),
  1285. }),
  1286. utility:Create("ImageButton", {
  1287. Name = "Button",
  1288. BackgroundTransparency = 1,
  1289. BorderSizePixel = 0,
  1290. Size = UDim2.new(1, 0, 0, 20),
  1291. ZIndex = 2,
  1292. Image = "rbxassetid://5028857472",
  1293. ImageColor3 = themes.DarkContrast,
  1294. ScaleType = Enum.ScaleType.Slice,
  1295. SliceCenter = Rect.new(2, 2, 298, 298)
  1296. }, {
  1297. utility:Create("TextLabel", {
  1298. Name = "Text",
  1299. BackgroundTransparency = 1,
  1300. Size = UDim2.new(1, 0, 1, 0),
  1301. ZIndex = 3,
  1302. Font = Enum.Font.Gotham,
  1303. Text = "Submit",
  1304. TextColor3 = themes.TextColor,
  1305. TextSize = 11.000
  1306. })
  1307. })
  1308. })
  1309. })
  1310.  
  1311. utility:DraggingEnabled(tab)
  1312. table.insert(self.modules, colorpicker)
  1313. --self:Resize()
  1314.  
  1315. local allowed = {
  1316. [""] = true
  1317. }
  1318.  
  1319. local canvas = tab.Container.Canvas
  1320. local color = tab.Container.Color
  1321.  
  1322. local canvasSize, canvasPosition = canvas.AbsoluteSize, canvas.AbsolutePosition
  1323. local colorSize, colorPosition = color.AbsoluteSize, color.AbsolutePosition
  1324.  
  1325. local draggingColor, draggingCanvas
  1326.  
  1327. local color3 = default or Color3.fromRGB(255, 255, 255)
  1328. local hue, sat, brightness = 0, 0, 1
  1329. local rgb = {
  1330. r = 255,
  1331. g = 255,
  1332. b = 255
  1333. }
  1334.  
  1335. self.colorpickers[colorpicker] = {
  1336. tab = tab,
  1337. callback = function(prop, value)
  1338. rgb[prop] = value
  1339. hue, sat, brightness = Color3.toHSV(Color3.fromRGB(rgb.r, rgb.g, rgb.b))
  1340. end
  1341. }
  1342.  
  1343. local callback = function(value)
  1344. if callback then
  1345. callback(value, function(...)
  1346. self:updateColorPicker(colorpicker, ...)
  1347. end)
  1348. end
  1349. end
  1350.  
  1351. utility:DraggingEnded(function()
  1352. draggingColor, draggingCanvas = false, false
  1353. end)
  1354.  
  1355. if default then
  1356. self:updateColorPicker(colorpicker, nil, default)
  1357.  
  1358. hue, sat, brightness = Color3.toHSV(default)
  1359. default = Color3.fromHSV(hue, sat, brightness)
  1360.  
  1361. for i, prop in pairs({"r", "g", "b"}) do
  1362. rgb[prop] = default[prop:upper()] * 255
  1363. end
  1364. end
  1365.  
  1366. for i, container in pairs(tab.Container.Inputs:GetChildren()) do -- i know what you are about to say, so shut up
  1367. if container:IsA("ImageLabel") then
  1368. local textbox = container.Textbox
  1369. local focused
  1370.  
  1371. textbox.Focused:Connect(function()
  1372. focused = true
  1373. end)
  1374.  
  1375. textbox.FocusLost:Connect(function()
  1376. focused = false
  1377.  
  1378. if not tonumber(textbox.Text) then
  1379. textbox.Text = math.floor(rgb[container.Name:lower()])
  1380. end
  1381. end)
  1382.  
  1383. textbox:GetPropertyChangedSignal("Text"):Connect(function()
  1384. local text = textbox.Text
  1385.  
  1386. if not allowed[text] and not tonumber(text) then
  1387. textbox.Text = text:sub(1, #text - 1)
  1388. elseif focused and not allowed[text] then
  1389. rgb[container.Name:lower()] = math.clamp(tonumber(textbox.Text), 0, 255)
  1390.  
  1391. local color3 = Color3.fromRGB(rgb.r, rgb.g, rgb.b)
  1392. hue, sat, brightness = Color3.toHSV(color3)
  1393.  
  1394. self:updateColorPicker(colorpicker, nil, color3)
  1395. callback(color3)
  1396. end
  1397. end)
  1398. end
  1399. end
  1400.  
  1401. canvas.MouseButton1Down:Connect(function()
  1402. draggingCanvas = true
  1403.  
  1404. while draggingCanvas do
  1405.  
  1406. local x, y = mouse.X, mouse.Y
  1407.  
  1408. sat = math.clamp((x - canvasPosition.X) / canvasSize.X, 0, 1)
  1409. brightness = 1 - math.clamp((y - canvasPosition.Y) / canvasSize.Y, 0, 1)
  1410.  
  1411. color3 = Color3.fromHSV(hue, sat, brightness)
  1412.  
  1413. for i, prop in pairs({"r", "g", "b"}) do
  1414. rgb[prop] = color3[prop:upper()] * 255
  1415. end
  1416.  
  1417. self:updateColorPicker(colorpicker, nil, {hue, sat, brightness}) -- roblox is literally retarded
  1418. utility:Tween(canvas.Cursor, {Position = UDim2.new(sat, 0, 1 - brightness, 0)}, 0.1) -- overwrite
  1419.  
  1420. callback(color3)
  1421. utility:Wait()
  1422. end
  1423. end)
  1424.  
  1425. color.MouseButton1Down:Connect(function()
  1426. draggingColor = true
  1427.  
  1428. while draggingColor do
  1429.  
  1430. hue = 1 - math.clamp(1 - ((mouse.X - colorPosition.X) / colorSize.X), 0, 1)
  1431. color3 = Color3.fromHSV(hue, sat, brightness)
  1432.  
  1433. for i, prop in pairs({"r", "g", "b"}) do
  1434. rgb[prop] = color3[prop:upper()] * 255
  1435. end
  1436.  
  1437. local x = hue -- hue is updated
  1438. self:updateColorPicker(colorpicker, nil, {hue, sat, brightness}) -- roblox is literally retarded
  1439. utility:Tween(tab.Container.Color.Select, {Position = UDim2.new(x, 0, 0, 0)}, 0.1) -- overwrite
  1440.  
  1441. callback(color3)
  1442. utility:Wait()
  1443. end
  1444. end)
  1445.  
  1446. -- click events
  1447. local button = colorpicker.Button
  1448. local toggle, debounce, animate
  1449.  
  1450. lastColor = Color3.fromHSV(hue, sat, brightness)
  1451. animate = function(visible, overwrite)
  1452.  
  1453. if overwrite then
  1454.  
  1455. if not toggle then
  1456. return
  1457. end
  1458.  
  1459. if debounce then
  1460. while debounce do
  1461. utility:Wait()
  1462. end
  1463. end
  1464. elseif not overwrite then
  1465. if debounce then
  1466. return
  1467. end
  1468.  
  1469. if button.ImageTransparency == 0 then
  1470. utility:Pop(button, 10)
  1471. end
  1472. end
  1473.  
  1474. toggle = visible
  1475. debounce = true
  1476.  
  1477. if visible then
  1478.  
  1479. if self.page.library.activePicker and self.page.library.activePicker ~= animate then
  1480. self.page.library.activePicker(nil, true)
  1481. end
  1482.  
  1483. self.page.library.activePicker = animate
  1484. lastColor = Color3.fromHSV(hue, sat, brightness)
  1485.  
  1486. local x1, x2 = button.AbsoluteSize.X / 2, 162--tab.AbsoluteSize.X
  1487. local px, py = button.AbsolutePosition.X, button.AbsolutePosition.Y
  1488.  
  1489. tab.ClipsDescendants = true
  1490. tab.Visible = true
  1491. tab.Size = UDim2.new(0, 0, 0, 0)
  1492.  
  1493. tab.Position = UDim2.new(0, x1 + x2 + px, 0, py)
  1494. utility:Tween(tab, {Size = UDim2.new(0, 162, 0, 169)}, 0.2)
  1495.  
  1496. -- update size and position
  1497. wait(0.2)
  1498. tab.ClipsDescendants = false
  1499.  
  1500. canvasSize, canvasPosition = canvas.AbsoluteSize, canvas.AbsolutePosition
  1501. colorSize, colorPosition = color.AbsoluteSize, color.AbsolutePosition
  1502. else
  1503. utility:Tween(tab, {Size = UDim2.new(0, 0, 0, 0)}, 0.2)
  1504. tab.ClipsDescendants = true
  1505.  
  1506. wait(0.2)
  1507. tab.Visible = false
  1508. end
  1509.  
  1510. debounce = false
  1511. end
  1512.  
  1513. local toggleTab = function()
  1514. animate(not toggle)
  1515. end
  1516.  
  1517. button.MouseButton1Click:Connect(toggleTab)
  1518. colorpicker.MouseButton1Click:Connect(toggleTab)
  1519.  
  1520. tab.Container.Button.MouseButton1Click:Connect(function()
  1521. animate()
  1522. end)
  1523.  
  1524. tab.Close.MouseButton1Click:Connect(function()
  1525. self:updateColorPicker(colorpicker, nil, lastColor)
  1526. animate()
  1527. end)
  1528.  
  1529. return colorpicker
  1530. end
  1531.  
  1532. function section:addSlider(title, default, min, max, callback)
  1533. local slider = utility:Create("ImageButton", {
  1534. Name = "Slider",
  1535. Parent = self.container,
  1536. BackgroundTransparency = 1,
  1537. BorderSizePixel = 0,
  1538. Position = UDim2.new(0.292817682, 0, 0.299145311, 0),
  1539. Size = UDim2.new(1, 0, 0, 50),
  1540. ZIndex = 2,
  1541. Image = "rbxassetid://5028857472",
  1542. ImageColor3 = themes.DarkContrast,
  1543. ScaleType = Enum.ScaleType.Slice,
  1544. SliceCenter = Rect.new(2, 2, 298, 298)
  1545. }, {
  1546. utility:Create("TextLabel", {
  1547. Name = "Title",
  1548. BackgroundTransparency = 1,
  1549. Position = UDim2.new(0, 10, 0, 6),
  1550. Size = UDim2.new(0.5, 0, 0, 16),
  1551. ZIndex = 3,
  1552. Font = Enum.Font.Gotham,
  1553. Text = title,
  1554. TextColor3 = themes.TextColor,
  1555. TextSize = 12,
  1556. TextTransparency = 0.10000000149012,
  1557. TextXAlignment = Enum.TextXAlignment.Left
  1558. }),
  1559. utility:Create("TextBox", {
  1560. Name = "TextBox",
  1561. BackgroundTransparency = 1,
  1562. BorderSizePixel = 0,
  1563. Position = UDim2.new(1, -30, 0, 6),
  1564. Size = UDim2.new(0, 20, 0, 16),
  1565. ZIndex = 3,
  1566. Font = Enum.Font.GothamSemibold,
  1567. Text = default or min,
  1568. TextColor3 = themes.TextColor,
  1569. TextSize = 12,
  1570. TextXAlignment = Enum.TextXAlignment.Right
  1571. }),
  1572. utility:Create("TextLabel", {
  1573. Name = "Slider",
  1574. BackgroundTransparency = 1,
  1575. Position = UDim2.new(0, 10, 0, 28),
  1576. Size = UDim2.new(1, -20, 0, 16),
  1577. ZIndex = 3,
  1578. Text = "",
  1579. }, {
  1580. utility:Create("ImageLabel", {
  1581. Name = "Bar",
  1582. AnchorPoint = Vector2.new(0, 0.5),
  1583. BackgroundTransparency = 1,
  1584. Position = UDim2.new(0, 0, 0.5, 0),
  1585. Size = UDim2.new(1, 0, 0, 4),
  1586. ZIndex = 3,
  1587. Image = "rbxassetid://5028857472",
  1588. ImageColor3 = themes.LightContrast,
  1589. ScaleType = Enum.ScaleType.Slice,
  1590. SliceCenter = Rect.new(2, 2, 298, 298)
  1591. }, {
  1592. utility:Create("ImageLabel", {
  1593. Name = "Fill",
  1594. BackgroundTransparency = 1,
  1595. Size = UDim2.new(0.8, 0, 1, 0),
  1596. ZIndex = 3,
  1597. Image = "rbxassetid://5028857472",
  1598. ImageColor3 = themes.TextColor,
  1599. ScaleType = Enum.ScaleType.Slice,
  1600. SliceCenter = Rect.new(2, 2, 298, 298)
  1601. }, {
  1602. utility:Create("ImageLabel", {
  1603. Name = "Circle",
  1604. AnchorPoint = Vector2.new(0.5, 0.5),
  1605. BackgroundTransparency = 1,
  1606. ImageTransparency = 1.000,
  1607. ImageColor3 = themes.TextColor,
  1608. Position = UDim2.new(1, 0, 0.5, 0),
  1609. Size = UDim2.new(0, 10, 0, 10),
  1610. ZIndex = 3,
  1611. Image = "rbxassetid://4608020054"
  1612. })
  1613. })
  1614. })
  1615. })
  1616. })
  1617.  
  1618. table.insert(self.modules, slider)
  1619. --self:Resize()
  1620.  
  1621. local allowed = {
  1622. [""] = true,
  1623. ["-"] = true
  1624. }
  1625.  
  1626. local textbox = slider.TextBox
  1627. local circle = slider.Slider.Bar.Fill.Circle
  1628.  
  1629. local value = default or min
  1630. local dragging, last
  1631.  
  1632. local callback = function(value)
  1633. if callback then
  1634. callback(value, function(...)
  1635. self:updateSlider(slider, ...)
  1636. end)
  1637. end
  1638. end
  1639.  
  1640. self:updateSlider(slider, nil, value, min, max)
  1641.  
  1642. utility:DraggingEnded(function()
  1643. dragging = false
  1644. end)
  1645.  
  1646. slider.MouseButton1Down:Connect(function(input)
  1647. dragging = true
  1648.  
  1649. while dragging do
  1650. utility:Tween(circle, {ImageTransparency = 0}, 0.1)
  1651.  
  1652. value = self:updateSlider(slider, nil, nil, min, max, value)
  1653. callback(value)
  1654.  
  1655. utility:Wait()
  1656. end
  1657.  
  1658. wait(0.5)
  1659. utility:Tween(circle, {ImageTransparency = 1}, 0.2)
  1660. end)
  1661.  
  1662. textbox.FocusLost:Connect(function()
  1663. if not tonumber(textbox.Text) then
  1664. value = self:updateSlider(slider, nil, default or min, min, max)
  1665. callback(value)
  1666. end
  1667. end)
  1668.  
  1669. textbox:GetPropertyChangedSignal("Text"):Connect(function()
  1670. local text = textbox.Text
  1671.  
  1672. if not allowed[text] and not tonumber(text) then
  1673. textbox.Text = text:sub(1, #text - 1)
  1674. elseif not allowed[text] then
  1675. value = self:updateSlider(slider, nil, tonumber(text) or value, min, max)
  1676. callback(value)
  1677. end
  1678. end)
  1679.  
  1680. return slider
  1681. end
  1682.  
  1683. function section:addDropdown(title, list, callback)
  1684. local dropdown = utility:Create("Frame", {
  1685. Name = "Dropdown",
  1686. Parent = self.container,
  1687. BackgroundTransparency = 1,
  1688. Size = UDim2.new(1, 0, 0, 30),
  1689. ClipsDescendants = true
  1690. }, {
  1691. utility:Create("UIListLayout", {
  1692. SortOrder = Enum.SortOrder.LayoutOrder,
  1693. Padding = UDim.new(0, 4)
  1694. }),
  1695. utility:Create("ImageLabel", {
  1696. Name = "Search",
  1697. BackgroundTransparency = 1,
  1698. BorderSizePixel = 0,
  1699. Size = UDim2.new(1, 0, 0, 30),
  1700. ZIndex = 2,
  1701. Image = "rbxassetid://5028857472",
  1702. ImageColor3 = themes.DarkContrast,
  1703. ScaleType = Enum.ScaleType.Slice,
  1704. SliceCenter = Rect.new(2, 2, 298, 298)
  1705. }, {
  1706. utility:Create("TextBox", {
  1707. Name = "TextBox",
  1708. AnchorPoint = Vector2.new(0, 0.5),
  1709. BackgroundTransparency = 1,
  1710. TextTruncate = Enum.TextTruncate.AtEnd,
  1711. Position = UDim2.new(0, 10, 0.5, 1),
  1712. Size = UDim2.new(1, -42, 1, 0),
  1713. ZIndex = 3,
  1714. Font = Enum.Font.Gotham,
  1715. Text = title,
  1716. TextColor3 = themes.TextColor,
  1717. TextSize = 12,
  1718. TextTransparency = 0.10000000149012,
  1719. TextXAlignment = Enum.TextXAlignment.Left
  1720. }),
  1721. utility:Create("ImageButton", {
  1722. Name = "Button",
  1723. BackgroundTransparency = 1,
  1724. BorderSizePixel = 0,
  1725. Position = UDim2.new(1, -28, 0.5, -9),
  1726. Size = UDim2.new(0, 18, 0, 18),
  1727. ZIndex = 3,
  1728. Image = "rbxassetid://5012539403",
  1729. ImageColor3 = themes.TextColor,
  1730. SliceCenter = Rect.new(2, 2, 298, 298)
  1731. })
  1732. }),
  1733. utility:Create("ImageLabel", {
  1734. Name = "List",
  1735. BackgroundTransparency = 1,
  1736. BorderSizePixel = 0,
  1737. Size = UDim2.new(1, 0, 1, -34),
  1738. ZIndex = 2,
  1739. Image = "rbxassetid://5028857472",
  1740. ImageColor3 = themes.Background,
  1741. ScaleType = Enum.ScaleType.Slice,
  1742. SliceCenter = Rect.new(2, 2, 298, 298)
  1743. }, {
  1744. utility:Create("ScrollingFrame", {
  1745. Name = "Frame",
  1746. Active = true,
  1747. BackgroundTransparency = 1,
  1748. BorderSizePixel = 0,
  1749. Position = UDim2.new(0, 4, 0, 4),
  1750. Size = UDim2.new(1, -8, 1, -8),
  1751. CanvasPosition = Vector2.new(0, 28),
  1752. CanvasSize = UDim2.new(0, 0, 0, 120),
  1753. ZIndex = 2,
  1754. ScrollBarThickness = 3,
  1755. ScrollBarImageColor3 = themes.DarkContrast
  1756. }, {
  1757. utility:Create("UIListLayout", {
  1758. SortOrder = Enum.SortOrder.LayoutOrder,
  1759. Padding = UDim.new(0, 4)
  1760. })
  1761. })
  1762. })
  1763. })
  1764.  
  1765. table.insert(self.modules, dropdown)
  1766. --self:Resize()
  1767.  
  1768. local search = dropdown.Search
  1769. local focused
  1770.  
  1771. list = list or {}
  1772.  
  1773. search.Button.MouseButton1Click:Connect(function()
  1774. if search.Button.Rotation == 0 then
  1775. self:updateDropdown(dropdown, nil, list, callback)
  1776. else
  1777. self:updateDropdown(dropdown, nil, nil, callback)
  1778. end
  1779. end)
  1780.  
  1781. search.TextBox.Focused:Connect(function()
  1782. if search.Button.Rotation == 0 then
  1783. self:updateDropdown(dropdown, nil, list, callback)
  1784. end
  1785.  
  1786. focused = true
  1787. end)
  1788.  
  1789. search.TextBox.FocusLost:Connect(function()
  1790. focused = false
  1791. end)
  1792.  
  1793. search.TextBox:GetPropertyChangedSignal("Text"):Connect(function()
  1794. if focused then
  1795. local list = utility:Sort(search.TextBox.Text, list)
  1796. list = #list ~= 0 and list
  1797.  
  1798. self:updateDropdown(dropdown, nil, list, callback)
  1799. end
  1800. end)
  1801.  
  1802. dropdown:GetPropertyChangedSignal("Size"):Connect(function()
  1803. self:Resize()
  1804. end)
  1805.  
  1806. return dropdown
  1807. end
  1808.  
  1809. -- class functions
  1810.  
  1811. function library:SelectPage(page, toggle)
  1812.  
  1813. if toggle and self.focusedPage == page then -- already selected
  1814. return
  1815. end
  1816.  
  1817. local button = page.button
  1818.  
  1819. if toggle then
  1820. -- page button
  1821. button.Title.TextTransparency = 0
  1822. button.Title.Font = Enum.Font.GothamSemibold
  1823.  
  1824. if button:FindFirstChild("Icon") then
  1825. button.Icon.ImageTransparency = 0
  1826. end
  1827.  
  1828. -- update selected page
  1829. local focusedPage = self.focusedPage
  1830. self.focusedPage = page
  1831.  
  1832. if focusedPage then
  1833. self:SelectPage(focusedPage)
  1834. end
  1835.  
  1836. -- sections
  1837. local existingSections = focusedPage and #focusedPage.sections or 0
  1838. local sectionsRequired = #page.sections - existingSections
  1839.  
  1840. page:Resize()
  1841.  
  1842. for i, section in pairs(page.sections) do
  1843. section.container.Parent.ImageTransparency = 0
  1844. end
  1845.  
  1846. if sectionsRequired < 0 then -- "hides" some sections
  1847. for i = existingSections, #page.sections + 1, -1 do
  1848. local section = focusedPage.sections[i].container.Parent
  1849.  
  1850. utility:Tween(section, {ImageTransparency = 1}, 0.1)
  1851. end
  1852. end
  1853.  
  1854. wait(0.1)
  1855. page.container.Visible = true
  1856.  
  1857. if focusedPage then
  1858. focusedPage.container.Visible = false
  1859. end
  1860.  
  1861. if sectionsRequired > 0 then -- "creates" more section
  1862. for i = existingSections + 1, #page.sections do
  1863. local section = page.sections[i].container.Parent
  1864.  
  1865. section.ImageTransparency = 1
  1866. utility:Tween(section, {ImageTransparency = 0}, 0.05)
  1867. end
  1868. end
  1869.  
  1870. wait(0.05)
  1871.  
  1872. for i, section in pairs(page.sections) do
  1873.  
  1874. utility:Tween(section.container.Title, {TextTransparency = 0}, 0.1)
  1875. section:Resize(true)
  1876.  
  1877. wait(0.05)
  1878. end
  1879.  
  1880. wait(0.05)
  1881. page:Resize(true)
  1882. else
  1883. -- page button
  1884. button.Title.Font = Enum.Font.Gotham
  1885. button.Title.TextTransparency = 0.65
  1886.  
  1887. if button:FindFirstChild("Icon") then
  1888. button.Icon.ImageTransparency = 0.65
  1889. end
  1890.  
  1891. -- sections
  1892. for i, section in pairs(page.sections) do
  1893. utility:Tween(section.container.Parent, {Size = UDim2.new(1, -10, 0, 28)}, 0.1)
  1894. utility:Tween(section.container.Title, {TextTransparency = 1}, 0.1)
  1895. end
  1896.  
  1897. wait(0.1)
  1898.  
  1899. page.lastPosition = page.container.CanvasPosition.Y
  1900. page:Resize()
  1901. end
  1902. end
  1903.  
  1904. function page:Resize(scroll)
  1905. local padding = 10
  1906. local size = 0
  1907.  
  1908. for i, section in pairs(self.sections) do
  1909. size = size + section.container.Parent.AbsoluteSize.Y + padding
  1910. end
  1911.  
  1912. self.container.CanvasSize = UDim2.new(0, 0, 0, size)
  1913. self.container.ScrollBarImageTransparency = size > self.container.AbsoluteSize.Y
  1914.  
  1915. if scroll then
  1916. utility:Tween(self.container, {CanvasPosition = Vector2.new(0, self.lastPosition or 0)}, 0.2)
  1917. end
  1918. end
  1919.  
  1920. function section:Resize(smooth)
  1921.  
  1922. if self.page.library.focusedPage ~= self.page then
  1923. return
  1924. end
  1925.  
  1926. local padding = 4
  1927. local size = (4 * padding) + self.container.Title.AbsoluteSize.Y -- offset
  1928.  
  1929. for i, module in pairs(self.modules) do
  1930. size = size + module.AbsoluteSize.Y + padding
  1931. end
  1932.  
  1933. if smooth then
  1934. utility:Tween(self.container.Parent, {Size = UDim2.new(1, -10, 0, size)}, 0.05)
  1935. else
  1936. self.container.Parent.Size = UDim2.new(1, -10, 0, size)
  1937. self.page:Resize()
  1938. end
  1939. end
  1940.  
  1941. function section:getModule(info)
  1942.  
  1943. if table.find(self.modules, info) then
  1944. return info
  1945. end
  1946.  
  1947. for i, module in pairs(self.modules) do
  1948. if (module:FindFirstChild("Title") or module:FindFirstChild("TextBox", true)).Text == info then
  1949. return module
  1950. end
  1951. end
  1952.  
  1953. error("No module found under "..tostring(info))
  1954. end
  1955.  
  1956. -- updates
  1957.  
  1958. function section:updateButton(button, title)
  1959. button = self:getModule(button)
  1960.  
  1961. button.Title.Text = title
  1962. end
  1963.  
  1964. function section:updateToggle(toggle, title, value)
  1965. toggle = self:getModule(toggle)
  1966.  
  1967. local position = {
  1968. In = UDim2.new(0, 2, 0.5, -6),
  1969. Out = UDim2.new(0, 20, 0.5, -6)
  1970. }
  1971.  
  1972. local frame = toggle.Button.Frame
  1973. value = value and "Out" or "In"
  1974.  
  1975. if title then
  1976. toggle.Title.Text = title
  1977. end
  1978.  
  1979. utility:Tween(frame, {
  1980. Size = UDim2.new(1, -22, 1, -9),
  1981. Position = position[value] + UDim2.new(0, 0, 0, 2.5)
  1982. }, 0.2)
  1983.  
  1984. wait(0.1)
  1985. utility:Tween(frame, {
  1986. Size = UDim2.new(1, -22, 1, -4),
  1987. Position = position[value]
  1988. }, 0.1)
  1989. end
  1990.  
  1991. function section:updateTextbox(textbox, title, value)
  1992. textbox = self:getModule(textbox)
  1993.  
  1994. if title then
  1995. textbox.Title.Text = title
  1996. end
  1997.  
  1998. if value then
  1999. textbox.Button.Textbox.Text = value
  2000. end
  2001.  
  2002. end
  2003.  
  2004. function section:updateKeybind(keybind, title, key)
  2005. keybind = self:getModule(keybind)
  2006.  
  2007. local text = keybind.Button.Text
  2008. local bind = self.binds[keybind]
  2009.  
  2010. if title then
  2011. keybind.Title.Text = title
  2012. end
  2013.  
  2014. if bind.connection then
  2015. bind.connection = bind.connection:UnBind()
  2016. end
  2017.  
  2018. if key then
  2019. self.binds[keybind].connection = utility:BindToKey(key, bind.callback)
  2020. text.Text = key.Name
  2021. else
  2022. text.Text = "None"
  2023. end
  2024. end
  2025.  
  2026. function section:updateColorPicker(colorpicker, title, color)
  2027. colorpicker = self:getModule(colorpicker)
  2028.  
  2029. local picker = self.colorpickers[colorpicker]
  2030. local tab = picker.tab
  2031. local callback = picker.callback
  2032.  
  2033. if title then
  2034. colorpicker.Title.Text = title
  2035. tab.Title.Text = title
  2036. end
  2037.  
  2038. local color3
  2039. local hue, sat, brightness
  2040.  
  2041. if type(color) == "table" then -- roblox is literally retarded x2
  2042. hue, sat, brightness = unpack(color)
  2043. color3 = Color3.fromHSV(hue, sat, brightness)
  2044. else
  2045. color3 = color
  2046. hue, sat, brightness = Color3.toHSV(color3)
  2047. end
  2048.  
  2049. utility:Tween(colorpicker.Button, {ImageColor3 = color3}, 0.5)
  2050. utility:Tween(tab.Container.Color.Select, {Position = UDim2.new(hue, 0, 0, 0)}, 0.1)
  2051.  
  2052. utility:Tween(tab.Container.Canvas, {ImageColor3 = Color3.fromHSV(hue, 1, 1)}, 0.5)
  2053. utility:Tween(tab.Container.Canvas.Cursor, {Position = UDim2.new(sat, 0, 1 - brightness)}, 0.5)
  2054.  
  2055. for i, container in pairs(tab.Container.Inputs:GetChildren()) do
  2056. if container:IsA("ImageLabel") then
  2057. local value = math.clamp(color3[container.Name], 0, 1) * 255
  2058.  
  2059. container.Textbox.Text = math.floor(value)
  2060. --callback(container.Name:lower(), value)
  2061. end
  2062. end
  2063. end
  2064.  
  2065. function section:updateSlider(slider, title, value, min, max, lvalue)
  2066. slider = self:getModule(slider)
  2067.  
  2068. if title then
  2069. slider.Title.Text = title
  2070. end
  2071.  
  2072. local bar = slider.Slider.Bar
  2073. local percent = (mouse.X - bar.AbsolutePosition.X) / bar.AbsoluteSize.X
  2074.  
  2075. if value then -- support negative ranges
  2076. percent = (value - min) / (max - min)
  2077. end
  2078.  
  2079. percent = math.clamp(percent, 0, 1)
  2080. value = value or math.floor(min + (max - min) * percent)
  2081.  
  2082. slider.TextBox.Text = value
  2083. utility:Tween(bar.Fill, {Size = UDim2.new(percent, 0, 1, 0)}, 0.1)
  2084.  
  2085. if value ~= lvalue and slider.ImageTransparency == 0 then
  2086. utility:Pop(slider, 10)
  2087. end
  2088.  
  2089. return value
  2090. end
  2091.  
  2092. function section:updateDropdown(dropdown, title, list, callback)
  2093. dropdown = self:getModule(dropdown)
  2094.  
  2095. if title then
  2096. dropdown.Search.TextBox.Text = title
  2097. end
  2098.  
  2099. local entries = 0
  2100.  
  2101. utility:Pop(dropdown.Search, 10)
  2102.  
  2103. for i, button in pairs(dropdown.List.Frame:GetChildren()) do
  2104. if button:IsA("ImageButton") then
  2105. button:Destroy()
  2106. end
  2107. end
  2108.  
  2109. for i, value in pairs(list or {}) do
  2110. local button = utility:Create("ImageButton", {
  2111. Parent = dropdown.List.Frame,
  2112. BackgroundTransparency = 1,
  2113. BorderSizePixel = 0,
  2114. Size = UDim2.new(1, 0, 0, 30),
  2115. ZIndex = 2,
  2116. Image = "rbxassetid://5028857472",
  2117. ImageColor3 = themes.DarkContrast,
  2118. ScaleType = Enum.ScaleType.Slice,
  2119. SliceCenter = Rect.new(2, 2, 298, 298)
  2120. }, {
  2121. utility:Create("TextLabel", {
  2122. BackgroundTransparency = 1,
  2123. Position = UDim2.new(0, 10, 0, 0),
  2124. Size = UDim2.new(1, -10, 1, 0),
  2125. ZIndex = 3,
  2126. Font = Enum.Font.Gotham,
  2127. Text = value,
  2128. TextColor3 = themes.TextColor,
  2129. TextSize = 12,
  2130. TextXAlignment = "Left",
  2131. TextTransparency = 0.10000000149012
  2132. })
  2133. })
  2134.  
  2135. button.MouseButton1Click:Connect(function()
  2136. if callback then
  2137. callback(value, function(...)
  2138. self:updateDropdown(dropdown, ...)
  2139. end)
  2140. end
  2141.  
  2142. self:updateDropdown(dropdown, value, nil, callback)
  2143. end)
  2144.  
  2145. entries = entries + 1
  2146. end
  2147.  
  2148. local frame = dropdown.List.Frame
  2149.  
  2150. utility:Tween(dropdown, {Size = UDim2.new(1, 0, 0, (entries == 0 and 30) or math.clamp(entries, 0, 3) * 34 + 38)}, 0.3)
  2151. utility:Tween(dropdown.Search.Button, {Rotation = list and 180 or 0}, 0.3)
  2152.  
  2153. if entries > 3 then
  2154.  
  2155. for i, button in pairs(dropdown.List.Frame:GetChildren()) do
  2156. if button:IsA("ImageButton") then
  2157. button.Size = UDim2.new(1, -6, 0, 30)
  2158. end
  2159. end
  2160.  
  2161. frame.CanvasSize = UDim2.new(0, 0, 0, (entries * 34) - 4)
  2162. frame.ScrollBarImageTransparency = 0
  2163. else
  2164. frame.CanvasSize = UDim2.new(0, 0, 0, 0)
  2165. frame.ScrollBarImageTransparency = 1
  2166. end
  2167. end
  2168. end
  2169.  
  2170. print("dino was here :\)")
  2171. return library
Add Comment
Please, Sign In to add comment