xxPH4NTOM

Untitled

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