GO0GL3_CHR0M3

new ui lib

Nov 22nd, 2021 (edited)
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 106.00 KB | None | 0 0
  1. local library = {}
  2.  
  3. local TweenService = game:GetService("TweenService")
  4. function library:tween(...) TweenService:Create(...):Play() end
  5.  
  6. local uis = game:GetService("UserInputService")
  7.  
  8. function library:create(Object, Properties, Parent)
  9. local Obj = Instance.new(Object)
  10.  
  11. for i,v in pairs (Properties) do
  12. Obj[i] = v
  13. end
  14. if Parent ~= nil then
  15. Obj.Parent = Parent
  16. end
  17.  
  18. return Obj
  19. end
  20.  
  21. local text_service = game:GetService("TextService")
  22. function library:get_text_size(...)
  23. return text_service:GetTextSize(...)
  24. end
  25.  
  26. function library:console(func)
  27. func(("\n"):rep(57))
  28. end
  29.  
  30. library.signal = loadstring(game:HttpGet("https://raw.githubusercontent.com/Quenty/NevermoreEngine/version2/Modules/Shared/Events/Signal.lua"))()
  31.  
  32. local local_player = game:GetService("Players").LocalPlayer
  33. local mouse = local_player:GetMouse()
  34.  
  35. local http = game:GetService("HttpService")
  36. local rs = game:GetService("RunService")
  37.  
  38. function library:set_draggable(gui)
  39. local UserInputService = game:GetService("UserInputService")
  40.  
  41. local dragging
  42. local dragInput
  43. local dragStart
  44. local startPos
  45.  
  46. local function update(input)
  47. local delta = input.Position - dragStart
  48. gui.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
  49. end
  50.  
  51. gui.InputBegan:Connect(function(input)
  52. if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  53. dragging = true
  54. dragStart = input.Position
  55. startPos = gui.Position
  56.  
  57. input.Changed:Connect(function()
  58. if input.UserInputState == Enum.UserInputState.End then
  59. dragging = false
  60. end
  61. end)
  62. end
  63. end)
  64.  
  65. gui.InputChanged:Connect(function(input)
  66. if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
  67. dragInput = input
  68. end
  69. end)
  70.  
  71. UserInputService.InputChanged:Connect(function(input)
  72. if input == dragInput and dragging then
  73. update(input)
  74. end
  75. end)
  76. end
  77.  
  78. function library.new(library_title, cfg_location)
  79. local menu = {}
  80. menu.values = {}
  81. menu.on_load_cfg = library.signal.new("on_load_cfg")
  82.  
  83. makefolder(cfg_location)
  84. function menu.copy(original)
  85. local copy = {}
  86. for k, v in pairs(original) do
  87. if type(v) == "table" then
  88. v = menu.copy(v)
  89. end
  90. copy[k] = v
  91. end
  92. return copy
  93. end
  94. function menu.save_cfg(cfg_name)
  95. local values_copy = menu.copy(menu.values)
  96. for _,tab in next, values_copy do
  97. for _,section in next, tab do
  98. for _,sector in next, section do
  99. for _,element in next, sector do
  100. if not element.Color then continue end
  101.  
  102. element.Color = {R = element.Color.R, G = element.Color.G, B = element.Color.B}
  103. end
  104. end
  105. end
  106. end
  107.  
  108. writefile(cfg_location..cfg_name..".txt", http:JSONEncode(values_copy))
  109. end
  110. function menu.load_cfg(cfg_name)
  111. local new_values = http:JSONDecode(readfile(cfg_location..cfg_name..".txt"))
  112.  
  113. for _,tab in next, new_values do
  114. for _2,section in next, tab do
  115. for _3,sector in next, section do
  116. for _4,element in next, sector do
  117. if element.Color then
  118. element.Color = Color3.new(element.Color.R, element.Color.G, element.Color.B)
  119. end
  120.  
  121. pcall(function()
  122. menu.values[_][_2][_3][_4] = element
  123. end)
  124. end
  125. end
  126. end
  127. end
  128.  
  129. menu.on_load_cfg:Fire()
  130. end
  131.  
  132. menu.open = true
  133. local ScreenGui = library:create("ScreenGui", {
  134. ResetOnSpawn = false,
  135. ZIndexBehavior = Enum.ZIndexBehavior.Global,
  136. Name = "unknown",
  137. IgnoreGuiInset = true,
  138. })
  139.  
  140. if syn then
  141. syn.protect_gui(ScreenGui)
  142. end
  143.  
  144. local Cursor = library:create("ImageLabel", {
  145. Name = "Cursor",
  146. BackgroundTransparency = 1,
  147. Size = UDim2.new(0, 17, 0, 17),
  148. Image = "rbxassetid://7205257578",
  149. ZIndex = 6969,
  150. }, ScreenGui)
  151.  
  152. rs.RenderStepped:Connect(function()
  153. Cursor.Position = UDim2.new(0, mouse.X, 0, mouse.Y + 36)
  154. end)
  155.  
  156. ScreenGui.Parent = game:GetService("CoreGui")
  157.  
  158. function menu.IsOpen()
  159. return menu.open
  160. end
  161. function menu.SetOpen(State)
  162. ScreenGui.Enabled = state
  163. end
  164.  
  165. uis.InputBegan:Connect(function(key)
  166. if key.KeyCode ~= Enum.KeyCode.RightShift then return end
  167.  
  168. ScreenGui.Enabled = not ScreenGui.Enabled
  169. menu.open = ScreenGui.Enabled
  170.  
  171. while ScreenGui.Enabled do
  172. uis.MouseIconEnabled = true
  173. rs.RenderStepped:Wait()
  174. end
  175. end)
  176.  
  177. local ImageLabel = library:create("ImageButton", {
  178. Name = "Main",
  179. AnchorPoint = Vector2.new(0.5, 0.5),
  180. BackgroundColor3 = Color3.fromRGB(15, 15, 15),
  181. BorderColor3 = Color3.fromRGB(78, 93, 234),
  182. Position = UDim2.new(0.5, 0, 0.5, 0),
  183. Size = UDim2.new(0, 700, 0, 500),
  184. Image = "http://www.roblox.com/asset/?id=7300333488",
  185. AutoButtonColor = false,
  186. Modal = true,
  187. }, ScreenGui)
  188.  
  189. function menu.GetPosition()
  190. return ImageLabel.Position
  191. end
  192.  
  193. library:set_draggable(ImageLabel)
  194.  
  195. local Title = library:create("TextLabel", {
  196. Name = "Title",
  197. AnchorPoint = Vector2.new(0.5, 0),
  198. BackgroundColor3 = Color3.fromRGB(255, 255, 255),
  199. BackgroundTransparency = 1,
  200. Position = UDim2.new(0.5, 0, 0, 0),
  201. Size = UDim2.new(1, -22, 0, 30),
  202. Font = Enum.Font.Ubuntu,
  203. Text = library_title,
  204. TextColor3 = Color3.fromRGB(255, 255, 255),
  205. TextSize = 16,
  206. TextXAlignment = Enum.TextXAlignment.Left,
  207. RichText = true,
  208. }, ImageLabel)
  209.  
  210. local TabButtons = library:create("Frame", {
  211. Name = "TabButtons",
  212. BackgroundColor3 = Color3.fromRGB(255, 255, 255),
  213. BackgroundTransparency = 1,
  214. Position = UDim2.new(0, 12, 0, 41),
  215. Size = UDim2.new(0, 76, 0, 447),
  216. }, ImageLabel)
  217.  
  218. local UIListLayout = library:create("UIListLayout", {
  219. HorizontalAlignment = Enum.HorizontalAlignment.Center
  220. }, TabButtons)
  221.  
  222. local Tabs = library:create("Frame", {
  223. Name = "Tabs",
  224. BackgroundColor3 = Color3.fromRGB(255, 255, 255),
  225. BackgroundTransparency = 1,
  226. Position = UDim2.new(0, 102, 0, 42),
  227. Size = UDim2.new(0, 586, 0, 446),
  228. }, ImageLabel)
  229.  
  230. local is_first_tab = true
  231. local selected_tab
  232. local tab_num = 1
  233. function menu.new_tab(tab_image)
  234. local tab = {tab_num = tab_num}
  235. menu.values[tab_num] = {}
  236. tab_num = tab_num + 1
  237.  
  238. local TabButton = library:create("TextButton", {
  239. BackgroundColor3 = Color3.fromRGB(255, 255, 255),
  240. BackgroundTransparency = 1,
  241. Size = UDim2.new(0, 76, 0, 90),
  242. Text = "",
  243. }, TabButtons)
  244.  
  245. local TabImage = library:create("ImageLabel", {
  246. AnchorPoint = Vector2.new(0.5, 0.5),
  247. BackgroundTransparency = 1,
  248. Position = UDim2.new(0.5, 0, 0.5, 0),
  249. Size = UDim2.new(0, 32, 0, 32),
  250. Image = tab_image,
  251. ImageColor3 = Color3.fromRGB(100, 100, 100),
  252. }, TabButton)
  253.  
  254. local TabSections = Instance.new("Frame")
  255. local TabFrames = Instance.new("Frame")
  256.  
  257. local Tab = library:create("Frame", {
  258. Name = "Tab",
  259. BackgroundTransparency = 1,
  260. Size = UDim2.new(1, 0, 1, 0),
  261. Visible = false,
  262. }, Tabs)
  263.  
  264. local TabSections = library:create("Frame", {
  265. Name = "TabSections",
  266. Parent = Tab,
  267. BackgroundTransparency = 1,
  268. Size = UDim2.new(1, 0, 0, 28),
  269. ClipsDescendants = true,
  270. }, Tab)
  271.  
  272. local UIListLayout = library:create("UIListLayout", {
  273. FillDirection = Enum.FillDirection.Horizontal,
  274. HorizontalAlignment = Enum.HorizontalAlignment.Center,
  275. }, TabSections)
  276.  
  277. local TabFrames = library:create("Frame", {
  278. Name = "TabFrames",
  279. BackgroundTransparency = 1,
  280. Position = UDim2.new(0, 0, 0, 29),
  281. Size = UDim2.new(1, 0, 0, 418),
  282. }, Tab)
  283.  
  284. if is_first_tab then
  285. is_first_tab = false
  286. selected_tab = TabButton
  287.  
  288. TabImage.ImageColor3 = Color3.fromRGB(84, 101, 255)
  289. Tab.Visible = true
  290. end
  291.  
  292. TabButton.MouseButton1Down:Connect(function()
  293. if selected_tab == TabButton then return end
  294.  
  295. for _,TButtons in pairs (TabButtons:GetChildren()) do
  296. if not TButtons:IsA("TextButton") then continue end
  297.  
  298. library:tween(TButtons.ImageLabel, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(100, 100, 100)})
  299. end
  300. for _,Tab in pairs (Tabs:GetChildren()) do
  301. Tab.Visible = false
  302. end
  303. Tab.Visible = true
  304. selected_tab = TabButton
  305. library:tween(TabImage, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(84, 101, 255)})
  306. end)
  307. TabButton.MouseEnter:Connect(function()
  308. if selected_tab == TabButton then return end
  309.  
  310. library:tween(TabImage, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(255, 255, 255)})
  311. end)
  312. TabButton.MouseLeave:Connect(function()
  313. if selected_tab == TabButton then return end
  314.  
  315. library:tween(TabImage, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(100, 100, 100)})
  316. end)
  317.  
  318. local is_first_section = true
  319. local num_sections = 0
  320. local selected_section
  321. function tab.new_section(section_name)
  322. local section = {}
  323.  
  324. num_sections += 1
  325.  
  326. menu.values[tab.tab_num][section_name] = {}
  327.  
  328. local SectionButton = library:create("TextButton", {
  329. Name = "SectionButton",
  330. BackgroundTransparency = 1,
  331. Size = UDim2.new(1/num_sections, 0, 1, 0),
  332. Font = Enum.Font.Ubuntu,
  333. Text = section_name,
  334. TextColor3 = Color3.fromRGB(100, 100, 100),
  335. TextSize = 15,
  336. }, TabSections)
  337.  
  338. for _,SectionButtons in pairs (TabSections:GetChildren()) do
  339. if SectionButtons:IsA("UIListLayout") then continue end
  340.  
  341. SectionButtons.Size = UDim2.new(1/num_sections, 0, 1, 0)
  342. end
  343.  
  344. SectionButton.MouseEnter:Connect(function()
  345. if selected_section == SectionButton then return end
  346.  
  347. library:tween(SectionButton, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextColor3 = Color3.fromRGB(255, 255, 255)})
  348. end)
  349. SectionButton.MouseLeave:Connect(function()
  350. if selected_section == SectionButton then return end
  351.  
  352. library:tween(SectionButton, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextColor3 = Color3.fromRGB(100, 100, 100)})
  353. end)
  354.  
  355. local SectionDecoration = library:create("Frame", {
  356. Name = "SectionDecoration",
  357. BackgroundColor3 = Color3.fromRGB(255, 255, 255),
  358. BorderSizePixel = 0,
  359. Position = UDim2.new(0, 0, 0, 27),
  360. Size = UDim2.new(1, 0, 0, 1),
  361. Visible = false,
  362. }, SectionButton)
  363.  
  364. local UIGradient = library:create("UIGradient", {
  365. Color = ColorSequence.new{ColorSequenceKeypoint.new(0, Color3.fromRGB(32, 33, 38)), ColorSequenceKeypoint.new(0.5, Color3.fromRGB(81, 97, 243)), ColorSequenceKeypoint.new(1, Color3.fromRGB(32, 33, 38))},
  366. }, SectionDecoration)
  367.  
  368. local SectionFrame = library:create("Frame", {
  369. Name = "SectionFrame",
  370. BackgroundTransparency = 1,
  371. Size = UDim2.new(1, 0, 1, 0),
  372. Visible = false,
  373. }, TabFrames)
  374.  
  375. local Left = library:create("Frame", {
  376. Name = "Left",
  377. BackgroundTransparency = 1,
  378. Position = UDim2.new(0, 8, 0, 14),
  379. Size = UDim2.new(0, 282, 0, 395),
  380. }, SectionFrame)
  381.  
  382. local UIListLayout = library:create("UIListLayout", {
  383. HorizontalAlignment = Enum.HorizontalAlignment.Center,
  384. SortOrder = Enum.SortOrder.LayoutOrder,
  385. Padding = UDim.new(0, 12),
  386. }, Left)
  387.  
  388. local Right = library:create("Frame", {
  389. Name = "Right",
  390. BackgroundTransparency = 1,
  391. Position = UDim2.new(0, 298, 0, 14),
  392. Size = UDim2.new(0, 282, 0, 395),
  393. }, SectionFrame)
  394.  
  395. local UIListLayout = library:create("UIListLayout", {
  396. HorizontalAlignment = Enum.HorizontalAlignment.Center,
  397. SortOrder = Enum.SortOrder.LayoutOrder,
  398. Padding = UDim.new(0, 12),
  399. }, Right)
  400.  
  401. SectionButton.MouseButton1Down:Connect(function()
  402. for _,SectionButtons in pairs (TabSections:GetChildren()) do
  403. if SectionButtons:IsA("UIListLayout") then continue end
  404. library:tween(SectionButtons, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextColor3 = Color3.fromRGB(100, 100, 100)})
  405. SectionButtons.SectionDecoration.Visible = false
  406. end
  407. for _,TabFrame in pairs (TabFrames:GetChildren()) do
  408. if not TabFrame:IsA("Frame") then continue end
  409.  
  410. TabFrame.Visible = false
  411. end
  412.  
  413. selected_section = SectionButton
  414. SectionFrame.Visible = true
  415. library:tween(SectionButton, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextColor3 = Color3.fromRGB(84, 101, 255)})
  416. SectionDecoration.Visible = true
  417. end)
  418.  
  419. if is_first_section then
  420. is_first_section = false
  421. selected_section = SectionButton
  422.  
  423. SectionButton.TextColor3 = Color3.fromRGB(84, 101, 255)
  424.  
  425. SectionDecoration.Visible = true
  426. SectionFrame.Visible = true
  427. end
  428.  
  429. function section.new_sector(sector_name, sector_side)
  430. local sector = {}
  431.  
  432. local actual_side = sector_side == "Right" and Right or Left
  433. menu.values[tab.tab_num][section_name][sector_name] = {}
  434.  
  435. local Border = library:create("Frame", {
  436. BackgroundColor3 = Color3.fromRGB(5, 5, 5),
  437. BorderColor3 = Color3.fromRGB(30, 30, 30),
  438. Size = UDim2.new(1, 0, 0, 20),
  439. }, actual_side)
  440.  
  441. local Container = library:create("Frame", {
  442. BackgroundColor3 = Color3.fromRGB(10, 10, 10),
  443. BorderSizePixel = 0,
  444. Position = UDim2.new(0, 1, 0, 1),
  445. Size = UDim2.new(1, -2, 1, -2),
  446. }, Border)
  447.  
  448. local UIListLayout = library:create("UIListLayout", {
  449. HorizontalAlignment = Enum.HorizontalAlignment.Center,
  450. SortOrder = Enum.SortOrder.LayoutOrder,
  451. }, Container)
  452.  
  453. local UIPadding = library:create("UIPadding", {
  454. PaddingTop = UDim.new(0, 12),
  455. }, Container)
  456.  
  457. local SectorTitle = library:create("TextLabel", {
  458. Name = "Title",
  459. AnchorPoint = Vector2.new(0.5, 0),
  460. BackgroundTransparency = 1,
  461. Position = UDim2.new(0.5, 0, 0, -8),
  462. Size = UDim2.new(1, 0, 0, 15),
  463. Font = Enum.Font.Ubuntu,
  464. Text = sector_name,
  465. TextColor3 = Color3.fromRGB(255, 255, 255),
  466. TextSize = 14,
  467. }, Border)
  468.  
  469. function sector.create_line(thickness)
  470. thickness = thickness or 3
  471. Border.Size = Border.Size + UDim2.new(0, 0, 0, thickness * 3)
  472.  
  473. local LineFrame = library:create("Frame", {
  474. Name = "LineFrame",
  475. BackgroundTransparency = 1,
  476. Position = UDim2.new(0, 0, 0, 0),
  477. Size = UDim2.new(0, 250, 0, thickness * 3),
  478. }, Container)
  479.  
  480. local Line = library:create("Frame", {
  481. Name = "Line",
  482. BackgroundColor3 = Color3.fromRGB(25, 25, 25),
  483. BorderColor3 = Color3.fromRGB(0, 0, 0),
  484. Position = UDim2.new(0.5, 0, 0.5, 0),
  485. AnchorPoint = Vector2.new(0.5, 0.5),
  486. Size = UDim2.new(1, 0, 0, thickness),
  487. }, LineFrame)
  488. end
  489.  
  490. function sector.element(type, text, data, callback, c_flag)
  491. text, data, callback = text and text or type, data and data or {}, callback and callback or function() end
  492.  
  493. local value = {}
  494.  
  495. local flag = c_flag and text.." "..c_flag or text
  496. menu.values[tab.tab_num][section_name][sector_name][flag] = value
  497.  
  498. local function do_callback()
  499. menu.values[tab.tab_num][section_name][sector_name][flag] = value
  500. callback(value)
  501. end
  502.  
  503. local default = data.default and data.default
  504.  
  505. local element = {}
  506.  
  507. function element:get_value()
  508. return value
  509. end
  510.  
  511. if type == "Toggle" then
  512. Border.Size = Border.Size + UDim2.new(0, 0, 0, 18)
  513.  
  514. value = {Toggle = default and default.Toggle or false}
  515.  
  516. local ToggleButton = library:create("TextButton", {
  517. Name = "Toggle",
  518. BackgroundColor3 = Color3.fromRGB(255, 255, 255),
  519. BackgroundTransparency = 1,
  520. Position = UDim2.new(0, 0, 0, 0),
  521. Size = UDim2.new(1, 0, 0, 18),
  522. Text = "",
  523. }, Container)
  524.  
  525. function element:set_visible(bool)
  526. if bool then
  527. if ToggleButton.Visible then return end
  528. Border.Size = Border.Size + UDim2.new(0, 0, 0, 18)
  529. ToggleButton.Visible = true
  530. else
  531. if not ToggleButton.Visible then return end
  532. Border.Size = Border.Size + UDim2.new(0, 0, 0, -18)
  533. ToggleButton.Visible = false
  534. end
  535. end
  536.  
  537. local ToggleFrame = library:create("Frame", {
  538. AnchorPoint = Vector2.new(0, 0.5),
  539. BackgroundColor3 = Color3.fromRGB(30, 30, 30),
  540. BorderColor3 = Color3.fromRGB(0, 0, 0),
  541. Position = UDim2.new(0, 9, 0.5, 0),
  542. Size = UDim2.new(0, 9, 0, 9),
  543. }, ToggleButton)
  544.  
  545. local ToggleText = library:create("TextLabel", {
  546. BackgroundTransparency = 1,
  547. Position = UDim2.new(0, 27, 0, 5),
  548. Size = UDim2.new(0, 200, 0, 9),
  549. Font = Enum.Font.Ubuntu,
  550. Text = text,
  551. TextColor3 = Color3.fromRGB(150, 150, 150),
  552. TextSize = 14,
  553. TextXAlignment = Enum.TextXAlignment.Left,
  554. }, ToggleButton)
  555.  
  556. local mouse_in = false
  557. function element:set_value(new_value, cb)
  558. value = new_value and new_value or value
  559. menu.values[tab.tab_num][section_name][sector_name][flag] = value
  560.  
  561. if value.Toggle then
  562. library:tween(ToggleFrame, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundColor3 = Color3.fromRGB(84, 101, 255)})
  563. library:tween(ToggleText, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextColor3 = Color3.fromRGB(255, 255, 255)})
  564. else
  565. library:tween(ToggleFrame, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundColor3 = Color3.fromRGB(30, 30, 30)})
  566. if not mouse_in then
  567. library:tween(ToggleText, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextColor3 = Color3.fromRGB(150, 150, 150)})
  568. end
  569. end
  570.  
  571. if cb == nil or not cb then
  572. do_callback()
  573. end
  574. end
  575. ToggleButton.MouseEnter:Connect(function()
  576. mouse_in = true
  577. if value.Toggle then return end
  578. library:tween(ToggleText, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextColor3 = Color3.fromRGB(255, 255, 255)})
  579. end)
  580. ToggleButton.MouseLeave:Connect(function()
  581. mouse_in = false
  582. if value.Toggle then return end
  583. library:tween(ToggleText, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextColor3 = Color3.fromRGB(150, 150, 150)})
  584. end)
  585. ToggleButton.MouseButton1Down:Connect(function()
  586. element:set_value({Toggle = not value.Toggle})
  587. end)
  588. element:set_value(value, true)
  589.  
  590. local has_extra = false
  591. function element:add_keybind(key_default, key_callback, key_type)
  592. local keybind = {}
  593.  
  594. if has_extra then return end
  595. has_extra = true
  596. local extra_flag = "$"..flag
  597.  
  598. local extra_value = {Key = key_default and key_default.Name or nil, Type = key_type or "Always", Active = element:get_value()}
  599. key_callback = key_callback or function() end
  600.  
  601. local Keybind = library:create("TextButton", {
  602. Name = "Keybind",
  603. AnchorPoint = Vector2.new(1, 0),
  604. BackgroundTransparency = 1,
  605. Position = UDim2.new(0, 265, 0, 0),
  606. Size = UDim2.new(0, 56, 0, 20),
  607. Font = Enum.Font.Ubuntu,
  608. Text = "[ "..(key_default and key_default.Name or "NONE").." ]",
  609. TextColor3 = Color3.fromRGB(150, 150, 150),
  610. TextSize = 14,
  611. TextXAlignment = Enum.TextXAlignment.Right,
  612. }, ToggleButton)
  613.  
  614. local KeybindFrame = library:create("Frame", {
  615. Name = "KeybindFrame",
  616. BackgroundColor3 = Color3.fromRGB(10, 10, 10),
  617. BorderColor3 = Color3.fromRGB(30, 30, 30),
  618. Position = UDim2.new(1, 5, 0, 3),
  619. Size = UDim2.new(0, 55, 0, 75),
  620. Visible = false,
  621. ZIndex = 2,
  622. }, Keybind)
  623.  
  624. local UIListLayout = library:create("UIListLayout", {
  625. HorizontalAlignment = Enum.HorizontalAlignment.Center,
  626. SortOrder = Enum.SortOrder.LayoutOrder,
  627. }, KeybindFrame)
  628.  
  629. local keybind_in = false
  630. local keybind_in2 = false
  631. Keybind.MouseEnter:Connect(function()
  632. keybind_in = true
  633. library:tween(Keybind, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextColor3 = Color3.fromRGB(255, 255, 255)})
  634. end)
  635. Keybind.MouseLeave:Connect(function()
  636. keybind_in = false
  637. library:tween(Keybind, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextColor3 = Color3.fromRGB(150, 150, 150)})
  638. end)
  639. KeybindFrame.MouseEnter:Connect(function()
  640. keybind_in2 = true
  641. library:tween(KeybindFrame, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BorderColor3 = Color3.fromRGB(84, 101, 255)})
  642. end)
  643. KeybindFrame.MouseLeave:Connect(function()
  644. keybind_in2 = false
  645. library:tween(KeybindFrame, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BorderColor3 = Color3.fromRGB(30, 30, 30)})
  646. end)
  647. uis.InputBegan:Connect(function(input)
  648. if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.MouseButton2 and not binding then
  649. if KeybindFrame.Visible == true and not keybind_in and not keybind_in2 then
  650. KeybindFrame.Visible = false
  651. end
  652. end
  653. end)
  654.  
  655. local Always = library:create("TextButton", {
  656. Name = "Always",
  657. BackgroundTransparency = 1,
  658. Size = UDim2.new(1, 0, 0, 25),
  659. Font = Enum.Font.Ubuntu,
  660. Text = "Always",
  661. TextColor3 = Color3.fromRGB(84, 101, 255),
  662. TextSize = 14,
  663. ZIndex = 2,
  664. }, KeybindFrame)
  665.  
  666. local Hold = library:create("TextButton", {
  667. Name = "Hold",
  668. BackgroundTransparency = 1,
  669. Size = UDim2.new(1, 0, 0, 25),
  670. Font = Enum.Font.Ubuntu,
  671. Text = "Hold",
  672. TextColor3 = Color3.fromRGB(150, 150, 150),
  673. TextSize = 14,
  674. ZIndex = 2,
  675. }, KeybindFrame)
  676.  
  677. local Toggle = library:create("TextButton", {
  678. Name = "Toggle",
  679. BackgroundTransparency = 1,
  680. Size = UDim2.new(1, 0, 0, 25),
  681. Font = Enum.Font.Ubuntu,
  682. Text = "Toggle",
  683. TextColor3 = Color3.fromRGB(150, 150, 150),
  684. TextSize = 14,
  685. ZIndex = 2,
  686. }, KeybindFrame)
  687. for _,TypeButton in next, KeybindFrame:GetChildren() do
  688. if TypeButton:IsA("UIListLayout") then continue end
  689.  
  690. TypeButton.MouseEnter:Connect(function()
  691. if extra_value.Type ~= TypeButton.Text then
  692. library:tween(TypeButton, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextColor3 = Color3.fromRGB(255, 255, 255)})
  693. end
  694. end)
  695. TypeButton.MouseLeave:Connect(function()
  696. if extra_value.Type ~= TypeButton.Text then
  697. library:tween(TypeButton, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextColor3 = Color3.fromRGB(150, 150, 150)})
  698. end
  699. end)
  700. TypeButton.MouseButton1Down:Connect(function()
  701. KeybindFrame.Visible = false
  702.  
  703. extra_value.Type = TypeButton.Text
  704. if extra_value.Type == "Always" then
  705. extra_value.Active = true
  706. else
  707. extra_value.Active = true
  708. end
  709. key_callback(extra_value)
  710. menu.values[tab.tab_num][section_name][sector_name][extra_flag] = extra_value
  711.  
  712. for _,TypeButton2 in next, KeybindFrame:GetChildren() do
  713. if TypeButton2:IsA("UIListLayout") then continue end
  714. library:tween(TypeButton2, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextColor3 = Color3.fromRGB(150, 150, 150)})
  715. end
  716. library:tween(TypeButton, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextColor3 = Color3.fromRGB(84, 101, 255)})
  717. end)
  718. end
  719.  
  720. local is_binding = false
  721. uis.InputBegan:Connect(function(input)
  722. if is_binding then
  723. is_binding = false
  724.  
  725. local new_value = input.KeyCode.Name ~= "Unknown" and input.KeyCode.Name or input.UserInputType.Name
  726. Keybind.Text = "[ "..new_value:upper().." ]"
  727. Keybind.Size = UDim2.new(0, library:get_text_size(Keybind.Text, 14, Enum.Font.Ubuntu, Vector2.new(700, 20)).X + 3, 0, 20)
  728. extra_value.Key = new_value
  729.  
  730. if new_value == "Backspace" then
  731. Keybind.Text = "[ NONE ]"
  732. Keybind.Size = UDim2.new(0, library:get_text_size(Keybind.Text, 14, Enum.Font.Ubuntu, Vector2.new(700, 20)).X + 3, 0, 20)
  733. extra_value.Key = nil
  734. end
  735.  
  736. key_callback(extra_value)
  737. menu.values[tab.tab_num][section_name][sector_name][extra_flag] = extra_value
  738. elseif extra_value.Key ~= nil then
  739. local key = input.KeyCode.Name ~= "Unknown" and input.KeyCode.Name or input.UserInputType.Name
  740. if key == extra_value.Key then
  741. if extra_value.Type == "Toggle" then
  742. extra_value.Active = not extra_value.Active
  743. elseif extra_value.Type == "Hold" then
  744. extra_value.Active = true
  745. end
  746. element:set_value({Toggle = extra_value.Active});
  747. key_callback(extra_value)
  748. menu.values[tab.tab_num][section_name][sector_name][extra_flag] = extra_value
  749. end
  750. end
  751. end)
  752. uis.InputEnded:Connect(function(input)
  753. if extra_value.Key ~= nil and not is_binding then
  754. local key = input.KeyCode.Name ~= "Unknown" and input.KeyCode.Name or input.UserInputType.Name
  755. if key == extra_value.Key then
  756. if extra_value.Type == "Hold" then
  757. extra_value.Active = false
  758. element:set_value({Toggle = extra_value.Active});
  759. key_callback(extra_value)
  760. menu.values[tab.tab_num][section_name][sector_name][extra_flag] = extra_value
  761. end
  762. end
  763. end
  764. end)
  765.  
  766. Keybind.MouseButton1Down:Connect(function()
  767. if not is_binding then
  768. wait()
  769. is_binding = true
  770. Keybind.Text = "[ ... ]"
  771. Keybind.Size = UDim2.new(0, library:get_text_size("[ ... ]", 14, Enum.Font.Ubuntu, Vector2.new(700, 20)).X + 3,0, 20)
  772. end
  773. end)
  774.  
  775. Keybind.MouseButton2Down:Connect(function()
  776. if not is_binding then
  777. KeybindFrame.Visible = not KeybindFrame.Visible
  778. end
  779. end)
  780.  
  781. function keybind:set_value(new_value, cb)
  782. extra_value = new_value and new_value or extra_value
  783. menu.values[tab.tab_num][section_name][sector_name][extra_flag] = extra_value
  784.  
  785. for _,TypeButton2 in next, KeybindFrame:GetChildren() do
  786. if TypeButton2:IsA("UIListLayout") then continue end
  787. if TypeButton2.Name ~= extra_value.Type then
  788. library:tween(TypeButton2, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextColor3 = Color3.fromRGB(150, 150, 150)})
  789. else
  790. library:tween(TypeButton2, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextColor3 = Color3.fromRGB(84, 101, 255)})
  791. end
  792. end
  793.  
  794. local key = extra_value.Key ~= nil and extra_value.Key or "NONE"
  795. Keybind.Text = "[ "..key:upper().." ]"
  796. Keybind.Size = UDim2.new(0, library:get_text_size(Keybind.Text, 14, Enum.Font.Ubuntu, Vector2.new(700, 20)).X + 3, 0, 20)
  797.  
  798. if cb == nil or not cb then
  799. key_callback(extra_value)
  800. end
  801. end
  802. keybind:set_value(new_value, true)
  803.  
  804. menu.on_load_cfg:Connect(function()
  805. keybind:set_value(menu.values[tab.tab_num][section_name][sector_name][extra_flag])
  806. end)
  807.  
  808. return keybind
  809. end
  810. function element:add_color(color_default, has_transparency, color_callback)
  811. if has_extra then return end
  812. has_extra = true
  813.  
  814. local color = {}
  815.  
  816. local extra_flag = "$"..flag
  817.  
  818. local extra_value = {Color}
  819. color_callback = color_callback or function() end
  820.  
  821. local ColorButton = library:create("TextButton", {
  822. Name = "ColorButton",
  823. AnchorPoint = Vector2.new(1, 0.5),
  824. BackgroundColor3 = Color3.fromRGB(255, 28, 28),
  825. BorderColor3 = Color3.fromRGB(0, 0, 0),
  826. Position = UDim2.new(0, 265, 0.5, 0),
  827. Size = UDim2.new(0, 35, 0, 11),
  828. AutoButtonColor = false,
  829. Font = Enum.Font.Ubuntu,
  830. Text = "",
  831. TextXAlignment = Enum.TextXAlignment.Right,
  832. }, ToggleButton)
  833.  
  834. local ColorFrame = library:create("Frame", {
  835. Name = "ColorFrame",
  836. Parent = ColorButton,
  837. BackgroundColor3 = Color3.fromRGB(10, 10, 10),
  838. BorderColor3 = Color3.fromRGB(0, 0, 0),
  839. Position = UDim2.new(1, 5, 0, 0),
  840. Size = UDim2.new(0, 200, 0, 170),
  841. Visible = false,
  842. ZIndex = 2,
  843. }, ColorButton)
  844.  
  845. local ColorPicker = library:create("ImageButton", {
  846. Name = "ColorPicker",
  847. BackgroundColor3 = Color3.fromRGB(255, 255, 255),
  848. BorderColor3 = Color3.fromRGB(0, 0, 0),
  849. Position = UDim2.new(0, 40, 0, 10),
  850. Size = UDim2.new(0, 150, 0, 150),
  851. AutoButtonColor = false,
  852. Image = "rbxassetid://4155801252",
  853. ImageColor3 = Color3.fromRGB(255, 0, 4),
  854. ZIndex = 2,
  855. }, ColorFrame)
  856.  
  857. local ColorPick = library:create("Frame", {
  858. Name = "ColorPick",
  859. BackgroundColor3 = Color3.fromRGB(255, 255, 255),
  860. BorderColor3 = Color3.fromRGB(0, 0, 0),
  861. Size = UDim2.new(0, 1, 0, 1),
  862. ZIndex = 2,
  863. }, ColorPicker)
  864.  
  865. local HuePicker = library:create("TextButton", {
  866. Name = "HuePicker",
  867. BackgroundColor3 = Color3.fromRGB(255, 255, 255),
  868. BorderColor3 = Color3.fromRGB(0, 0, 0),
  869. Position = UDim2.new(0, 10, 0, 10),
  870. Size = UDim2.new(0, 20, 0, 150),
  871. ZIndex = 2,
  872. AutoButtonColor = false,
  873. Text = "",
  874. }, ColorFrame)
  875.  
  876. local UIGradient = library:create("UIGradient", {
  877. Rotation = 90,
  878. Color = ColorSequence.new {
  879. ColorSequenceKeypoint.new(0.00, Color3.fromRGB(255, 0, 0)),
  880. ColorSequenceKeypoint.new(0.17, Color3.fromRGB(255, 0, 255)),
  881. ColorSequenceKeypoint.new(0.33, Color3.fromRGB(0, 0, 255)),
  882. ColorSequenceKeypoint.new(0.50, Color3.fromRGB(0, 255, 255)),
  883. ColorSequenceKeypoint.new(0.67, Color3.fromRGB(0, 255, 0)),
  884. ColorSequenceKeypoint.new(0.83, Color3.fromRGB(255, 255, 0)),
  885. ColorSequenceKeypoint.new(1.00, Color3.fromRGB(255, 0, 0))
  886. }
  887. }, HuePicker)
  888.  
  889. local HuePick = library:create("ImageButton", {
  890. Name = "HuePick",
  891. BackgroundColor3 = Color3.fromRGB(255, 255, 255),
  892. BorderColor3 = Color3.fromRGB(0, 0, 0),
  893. Size = UDim2.new(1, 0, 0, 1),
  894. ZIndex = 2,
  895. }, HuePicker)
  896.  
  897. local in_color = false
  898. local in_color2 = false
  899. ColorButton.MouseButton1Down:Connect(function()
  900. ColorFrame.Visible = not ColorFrame.Visible
  901. end)
  902. ColorFrame.MouseEnter:Connect(function()
  903. in_color = true
  904. library:tween(ColorFrame, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BorderColor3 = Color3.fromRGB(84, 101, 255)})
  905. end)
  906. ColorFrame.MouseLeave:Connect(function()
  907. in_color = false
  908. library:tween(ColorFrame, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BorderColor3 = Color3.fromRGB(0, 0, 0)})
  909. end)
  910. ColorButton.MouseEnter:Connect(function()
  911. in_color2 = true
  912. end)
  913. ColorButton.MouseLeave:Connect(function()
  914. in_color2 = false
  915. end)
  916. uis.InputBegan:Connect(function(input)
  917. if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.MouseButton2 then
  918. if ColorFrame.Visible == true and not in_color and not in_color2 then
  919. ColorFrame.Visible = false
  920. end
  921. end
  922. end)
  923.  
  924. local TransparencyColor
  925. local TransparencyPick
  926. if has_transparency then
  927. ColorFrame.Size = UDim2.new(0, 200, 0, 200)
  928.  
  929. local TransparencyPicker = library:create("ImageButton", {
  930. Name = "TransparencyPicker",
  931. BackgroundColor3 = Color3.fromRGB(255, 255, 255),
  932. BorderColor3 = Color3.fromRGB(0, 0, 0),
  933. Position = UDim2.new(0, 10, 0, 170),
  934. Size = UDim2.new(0, 180, 0, 20),
  935. Image = "rbxassetid://3887014957",
  936. ScaleType = Enum.ScaleType.Tile,
  937. TileSize = UDim2.new(0, 10, 0, 10),
  938. ZIndex = 2,
  939. }, ColorFrame)
  940.  
  941. TransparencyColor = library:create("ImageLabel", {
  942. BackgroundTransparency = 1,
  943. Size = UDim2.new(1, 0, 1, 0),
  944. Image = "rbxassetid://3887017050",
  945. ZIndex = 2,
  946. }, TransparencyPicker)
  947.  
  948. TransparencyPick = library:create("Frame", {
  949. Name = "TransparencyPick",
  950. BackgroundColor3 = Color3.fromRGB(255, 255, 255),
  951. BorderColor3 = Color3.fromRGB(0, 0, 0),
  952. Size = UDim2.new(0, 1, 1, 0),
  953. ZIndex = 2,
  954. }, TransparencyPicker)
  955.  
  956. extra_value.Transparency = 0
  957.  
  958. function color.update_transp()
  959. local x = math.clamp(mouse.X - TransparencyPicker.AbsolutePosition.X, 0, 180)
  960. TransparencyPick.Position = UDim2.new(0, x, 0, 0)
  961. local transparency = x/180
  962. extra_value.Transparency = transparency
  963.  
  964. print(transparency)
  965.  
  966. color_callback(extra_value)
  967. menu.values[tab.tab_num][section_name][sector_name][extra_flag] = extra_value
  968. end
  969. TransparencyPicker.MouseButton1Down:Connect(function()
  970. color.update_transp()
  971. local moveconnection = mouse.Move:Connect(function()
  972. color.update_transp()
  973. end)
  974. releaseconnection = uis.InputEnded:Connect(function(Mouse)
  975. if Mouse.UserInputType == Enum.UserInputType.MouseButton1 then
  976. color.update_transp()
  977. moveconnection:Disconnect()
  978. releaseconnection:Disconnect()
  979. end
  980. end)
  981. end)
  982. end
  983.  
  984. color.h = (math.clamp(HuePick.AbsolutePosition.Y-HuePicker.AbsolutePosition.Y, 0, HuePicker.AbsoluteSize.Y)/HuePicker.AbsoluteSize.Y)
  985. color.s = 1-(math.clamp(ColorPick.AbsolutePosition.X-ColorPick.AbsolutePosition.X, 0, ColorPick.AbsoluteSize.X)/ColorPick.AbsoluteSize.X)
  986. color.v = 1-(math.clamp(ColorPick.AbsolutePosition.Y-ColorPick.AbsolutePosition.Y, 0, ColorPick.AbsoluteSize.Y)/ColorPick.AbsoluteSize.Y)
  987.  
  988. extra_value.Color = Color3.fromHSV(color.h, color.s, color.v)
  989. menu.values[tab.tab_num][section_name][sector_name][extra_flag] = extra_value
  990.  
  991. function color.update_color()
  992. local ColorX = (math.clamp(mouse.X - ColorPicker.AbsolutePosition.X, 0, ColorPicker.AbsoluteSize.X)/ColorPicker.AbsoluteSize.X)
  993. local ColorY = (math.clamp(mouse.Y - ColorPicker.AbsolutePosition.Y, 0, ColorPicker.AbsoluteSize.Y)/ColorPicker.AbsoluteSize.Y)
  994. ColorPick.Position = UDim2.new(ColorX, 0, ColorY, 0)
  995.  
  996. color.s = 1 - ColorX
  997. color.v = 1 - ColorY
  998.  
  999. ColorButton.BackgroundColor3 = Color3.fromHSV(color.h, color.s, color.v)
  1000. extra_value.Color = Color3.fromHSV(color.h, color.s, color.v)
  1001. color_callback(extra_value)
  1002. menu.values[tab.tab_num][section_name][sector_name][extra_flag] = extra_value
  1003. end
  1004. ColorPicker.MouseButton1Down:Connect(function()
  1005. color.update_color()
  1006. local moveconnection = mouse.Move:Connect(function()
  1007. color.update_color()
  1008. end)
  1009. releaseconnection = uis.InputEnded:Connect(function(Mouse)
  1010. if Mouse.UserInputType == Enum.UserInputType.MouseButton1 then
  1011. color.update_color()
  1012. moveconnection:Disconnect()
  1013. releaseconnection:Disconnect()
  1014. end
  1015. end)
  1016. end)
  1017.  
  1018. function color.update_hue()
  1019. local y = math.clamp(mouse.Y - HuePicker.AbsolutePosition.Y, 0, 148)
  1020. HuePick.Position = UDim2.new(0, 0, 0, y)
  1021. local hue = y/148
  1022. color.h = 1-hue
  1023. ColorPicker.ImageColor3 = Color3.fromHSV(color.h, 1, 1)
  1024. ColorButton.BackgroundColor3 = Color3.fromHSV(color.h, color.s, color.v)
  1025. if TransparencyColor then
  1026. TransparencyColor.ImageColor3 = Color3.fromHSV(color.h, 1, 1)
  1027. end
  1028. extra_value.Color = Color3.fromHSV(color.h, color.s, color.v)
  1029. color_callback(extra_value)
  1030. menu.values[tab.tab_num][section_name][sector_name][extra_flag] = extra_value
  1031. end
  1032. HuePicker.MouseButton1Down:Connect(function()
  1033. color.update_hue()
  1034. local moveconnection = mouse.Move:Connect(function()
  1035. color.update_hue()
  1036. end)
  1037. releaseconnection = uis.InputEnded:Connect(function(Mouse)
  1038. if Mouse.UserInputType == Enum.UserInputType.MouseButton1 then
  1039. color.update_hue()
  1040. moveconnection:Disconnect()
  1041. releaseconnection:Disconnect()
  1042. end
  1043. end)
  1044. end)
  1045.  
  1046. function color:set_value(new_value, cb)
  1047. extra_value = new_value and new_value or extra_value
  1048. menu.values[tab.tab_num][section_name][sector_name][extra_flag] = extra_value
  1049.  
  1050. local duplicate = Color3.new(extra_value.Color.R, extra_value.Color.G, extra_value.Color.B)
  1051. color.h, color.s, color.v = duplicate:ToHSV()
  1052. color.h = math.clamp(color.h, 0, 1)
  1053. color.s = math.clamp(color.s, 0, 1)
  1054. color.v = math.clamp(color.v, 0, 1)
  1055.  
  1056. ColorPick.Position = UDim2.new(1 - color.s, 0, 1 - color.v, 0)
  1057. ColorPicker.ImageColor3 = Color3.fromHSV(color.h, 1, 1)
  1058. ColorButton.BackgroundColor3 = Color3.fromHSV(color.h, color.s, color.v)
  1059. HuePick.Position = UDim2.new(0, 0, 1 - color.h, -1)
  1060.  
  1061. if TransparencyColor then
  1062. TransparencyColor.ImageColor3 = Color3.fromHSV(color.h, 1, 1)
  1063.  
  1064. TransparencyPick.Position = UDim2.new(extra_value.Transparency, -1, 0, 0)
  1065. end
  1066.  
  1067. if cb == nil or not cb then
  1068. color_callback(extra_value)
  1069. end
  1070. end
  1071. color:set_value(color_default and color_default, true)
  1072.  
  1073. menu.on_load_cfg:Connect(function()
  1074. color:set_value(menu.values[tab.tab_num][section_name][sector_name][extra_flag])
  1075. end)
  1076.  
  1077. return color
  1078. end
  1079. elseif type == "Dropdown" then
  1080. Border.Size = Border.Size + UDim2.new(0, 0, 0, 45)
  1081.  
  1082. value = {Dropdown = default and default.Dropdown or data.options[1]}
  1083.  
  1084. local Dropdown = library:create("TextLabel", {
  1085. Name = "Dropdown",
  1086. BackgroundTransparency = 1,
  1087. Size = UDim2.new(1, 0, 0, 45),
  1088. Text = "",
  1089. }, Container)
  1090.  
  1091. function element:set_visible(bool)
  1092. if bool then
  1093. if Dropdown.Visible then return end
  1094. Border.Size = Border.Size + UDim2.new(0, 0, 0, 45)
  1095. Dropdown.Visible = true
  1096. else
  1097. if not Dropdown.Visible then return end
  1098. Border.Size = Border.Size + UDim2.new(0, 0, 0, -45)
  1099. Dropdown.Visible = false
  1100. end
  1101. end
  1102.  
  1103. local DropdownButton = library:create("TextButton", {
  1104. Name = "DropdownButton",
  1105. BackgroundColor3 = Color3.fromRGB(25, 25, 25),
  1106. BorderColor3 = Color3.fromRGB(0, 0, 0),
  1107. Position = UDim2.new(0, 9, 0, 20),
  1108. Size = UDim2.new(0, 260, 0, 20),
  1109. AutoButtonColor = false,
  1110. Text = "",
  1111. }, Dropdown)
  1112.  
  1113. local DropdownButtonText = library:create("TextLabel", {
  1114. Name = "DropdownButtonText",
  1115. BackgroundTransparency = 1,
  1116. Position = UDim2.new(0, 6, 0, 0),
  1117. Size = UDim2.new(0, 250, 1, 0),
  1118. Font = Enum.Font.Ubuntu,
  1119. Text = value.Dropdown,
  1120. TextColor3 = Color3.fromRGB(150, 150, 150),
  1121. TextSize = 14,
  1122. TextXAlignment = Enum.TextXAlignment.Left,
  1123. }, DropdownButton)
  1124.  
  1125. local ImageLabel = library:create("ImageLabel", {
  1126. BackgroundTransparency = 1,
  1127. Position = UDim2.new(0, 245, 0, 8),
  1128. Size = UDim2.new(0, 6, 0, 4),
  1129. Image = "rbxassetid://6724771531",
  1130. }, DropdownButton)
  1131.  
  1132. local DropdownText = library:create("TextLabel", {
  1133. Name = "DropdownText",
  1134. BackgroundTransparency = 1,
  1135. Position = UDim2.new(0, 9, 0, 6),
  1136. Size = UDim2.new(0, 200, 0, 9),
  1137. Font = Enum.Font.Ubuntu,
  1138. Text = text,
  1139. TextColor3 = Color3.fromRGB(150, 150, 150),
  1140. TextSize = 14,
  1141. TextXAlignment = Enum.TextXAlignment.Left,
  1142. }, Dropdown)
  1143.  
  1144. local DropdownScroll = library:create("ScrollingFrame", {
  1145. Name = "DropdownScroll",
  1146. Active = true,
  1147. BackgroundColor3 = Color3.fromRGB(25, 25, 25),
  1148. BorderColor3 = Color3.fromRGB(0, 0, 0),
  1149. Position = UDim2.new(0, 9, 0, 41),
  1150. Size = UDim2.new(0, 260, 0, 20),
  1151. CanvasSize = UDim2.new(0, 0, 0, 0),
  1152. ScrollBarThickness = 2,
  1153. TopImage = "rbxasset://textures/ui/Scroll/scroll-middle.png",
  1154. BottomImage = "rbxasset://textures/ui/Scroll/scroll-middle.png",
  1155. Visible = false,
  1156. ZIndex = 2,
  1157. }, Dropdown)
  1158.  
  1159. local UIListLayout = library:create("UIListLayout", {
  1160. HorizontalAlignment = Enum.HorizontalAlignment.Center,
  1161. SortOrder = Enum.SortOrder.LayoutOrder,
  1162. }, DropdownScroll)
  1163.  
  1164. local options_num = #data.options
  1165. if options_num >= 4 then
  1166. DropdownScroll.Size = UDim2.new(0, 260, 0, 80)
  1167. for i = 1, options_num do
  1168. DropdownScroll.CanvasSize = DropdownScroll.CanvasSize + UDim2.new(0, 0, 0, 20)
  1169. end
  1170. else
  1171. DropdownScroll.Size = UDim2.new(0, 260, 0, 20 * options_num)
  1172. end
  1173.  
  1174. local in_drop = false
  1175. local in_drop2 = false
  1176. local dropdown_open = false
  1177. DropdownButton.MouseButton1Down:Connect(function()
  1178. DropdownScroll.Visible = not DropdownScroll.Visible
  1179. dropdown_open = DropdownScroll.Visible
  1180.  
  1181. if not dropdown_open then
  1182. library:tween(DropdownText, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextColor3 = Color3.fromRGB(150, 150, 150)})
  1183. library:tween(DropdownButtonText, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextColor3 = Color3.fromRGB(150, 150, 150)})
  1184. else
  1185. library:tween(DropdownText, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextColor3 = Color3.fromRGB(255, 255, 255)})
  1186. library:tween(DropdownButtonText, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextColor3 = Color3.fromRGB(255, 255, 255)})
  1187. end
  1188. end)
  1189. Dropdown.MouseEnter:Connect(function()
  1190. in_drop = true
  1191. end)
  1192. Dropdown.MouseLeave:Connect(function()
  1193. in_drop = false
  1194. end)
  1195. DropdownScroll.MouseEnter:Connect(function()
  1196. in_drop2 = true
  1197. end)
  1198. DropdownScroll.MouseLeave:Connect(function()
  1199. in_drop2 = false
  1200. end)
  1201. uis.InputBegan:Connect(function(input)
  1202. if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.MouseButton2 then
  1203. if DropdownScroll.Visible == true and not in_drop and not in_drop2 then
  1204. DropdownScroll.Visible = false
  1205. DropdownScroll.CanvasPosition = Vector2.new(0,0)
  1206.  
  1207. library:tween(DropdownText, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextColor3 = Color3.fromRGB(150, 150, 150)})
  1208. library:tween(DropdownButtonText, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextColor3 = Color3.fromRGB(150, 150, 150)})
  1209. end
  1210. end
  1211. end)
  1212.  
  1213. function element:set_value(new_value, cb)
  1214. value = new_value and new_value or value
  1215. menu.values[tab.tab_num][section_name][sector_name][flag] = value
  1216.  
  1217. DropdownButtonText.Text = new_value.Dropdown
  1218.  
  1219. if cb == nil or not cb then
  1220. do_callback()
  1221. end
  1222. end
  1223.  
  1224. local dropdown_is_first = true
  1225. for _,v in next, data.options do
  1226. local Button = library:create("TextButton", {
  1227. Name = v,
  1228. BackgroundColor3 = Color3.fromRGB(25, 25, 25),
  1229. BorderColor3 = Color3.fromRGB(0, 0, 0),
  1230. BorderSizePixel = 0,
  1231. Position = UDim2.new(0, 0, 0, 20),
  1232. Size = UDim2.new(1, 0, 0, 20),
  1233. AutoButtonColor = false,
  1234. Font = Enum.Font.SourceSans,
  1235. Text = "",
  1236. ZIndex = 2,
  1237. }, DropdownScroll)
  1238.  
  1239. local ButtonText = library:create("TextLabel", {
  1240. Name = "ButtonText",
  1241. BackgroundTransparency = 1,
  1242. Position = UDim2.new(0, 8, 0, 0),
  1243. Size = UDim2.new(0, 245, 1, 0),
  1244. Font = Enum.Font.Ubuntu,
  1245. Text = v,
  1246. TextColor3 = Color3.fromRGB(150, 150, 150),
  1247. TextSize = 14,
  1248. TextXAlignment = Enum.TextXAlignment.Left,
  1249. ZIndex = 2,
  1250. }, Button)
  1251.  
  1252. local Decoration = library:create("Frame", {
  1253. Name = "Decoration",
  1254. BackgroundColor3 = Color3.fromRGB(84, 101, 255),
  1255. BorderSizePixel = 0,
  1256. Size = UDim2.new(0, 1, 1, 0),
  1257. Visible = false,
  1258. ZIndex = 2,
  1259. }, Button)
  1260.  
  1261. Button.MouseEnter:Connect(function()
  1262. library:tween(ButtonText, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextColor3 = Color3.fromRGB(255, 255, 255)})
  1263. Decoration.Visible = true
  1264. end)
  1265. Button.MouseLeave:Connect(function()
  1266. library:tween(ButtonText, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextColor3 = Color3.fromRGB(150, 150, 150)})
  1267. Decoration.Visible = false
  1268. end)
  1269. Button.MouseButton1Down:Connect(function()
  1270. DropdownScroll.Visible = false
  1271. DropdownButtonText.Text = v
  1272. value.Dropdown = v
  1273.  
  1274. library:tween(DropdownText, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextColor3 = Color3.fromRGB(150, 150, 150)})
  1275. library:tween(DropdownButtonText, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextColor3 = Color3.fromRGB(150, 150, 150)})
  1276.  
  1277. do_callback()
  1278. end)
  1279.  
  1280. if dropdown_is_first then
  1281. dropdown_is_first = false
  1282. end
  1283. end
  1284. element:set_value(value, true)
  1285. elseif type == "Combo" then
  1286. Border.Size = Border.Size + UDim2.new(0, 0, 0, 45)
  1287.  
  1288. value = {Combo = default and default.Combo or {}}
  1289.  
  1290. local Dropdown = library:create("TextLabel", {
  1291. Name = "Dropdown",
  1292. BackgroundTransparency = 1,
  1293. Size = UDim2.new(1, 0, 0, 45),
  1294. Text = "",
  1295. }, Container)
  1296.  
  1297. function element:set_visible(bool)
  1298. if bool then
  1299. if Dropdown.Visible then return end
  1300. Border.Size = Border.Size + UDim2.new(0, 0, 0, 45)
  1301. Dropdown.Visible = true
  1302. else
  1303. if not Dropdown.Visible then return end
  1304. Border.Size = Border.Size + UDim2.new(0, 0, 0, -45)
  1305. Dropdown.Visible = false
  1306. end
  1307. end
  1308.  
  1309. local DropdownButton = library:create("TextButton", {
  1310. Name = "DropdownButton",
  1311. BackgroundColor3 = Color3.fromRGB(25, 25, 25),
  1312. BorderColor3 = Color3.fromRGB(0, 0, 0),
  1313. Position = UDim2.new(0, 9, 0, 20),
  1314. Size = UDim2.new(0, 260, 0, 20),
  1315. AutoButtonColor = false,
  1316. Text = "",
  1317. }, Dropdown)
  1318.  
  1319. local DropdownButtonText = library:create("TextLabel", {
  1320. Name = "DropdownButtonText",
  1321. BackgroundTransparency = 1,
  1322. Position = UDim2.new(0, 6, 0, 0),
  1323. Size = UDim2.new(0, 250, 1, 0),
  1324. Font = Enum.Font.Ubuntu,
  1325. Text = value.Dropdown,
  1326. TextColor3 = Color3.fromRGB(150, 150, 150),
  1327. TextSize = 14,
  1328. TextXAlignment = Enum.TextXAlignment.Left,
  1329. }, DropdownButton)
  1330.  
  1331. local ImageLabel = library:create("ImageLabel", {
  1332. BackgroundTransparency = 1,
  1333. Position = UDim2.new(0, 245, 0, 8),
  1334. Size = UDim2.new(0, 6, 0, 4),
  1335. Image = "rbxassetid://6724771531",
  1336. }, DropdownButton)
  1337.  
  1338. local DropdownText = library:create("TextLabel", {
  1339. Name = "DropdownText",
  1340. BackgroundTransparency = 1,
  1341. Position = UDim2.new(0, 9, 0, 6),
  1342. Size = UDim2.new(0, 200, 0, 9),
  1343. Font = Enum.Font.Ubuntu,
  1344. Text = text,
  1345. TextColor3 = Color3.fromRGB(150, 150, 150),
  1346. TextSize = 14,
  1347. TextXAlignment = Enum.TextXAlignment.Left,
  1348. }, Dropdown)
  1349.  
  1350. local DropdownScroll = library:create("ScrollingFrame", {
  1351. Name = "DropdownScroll",
  1352. Active = true,
  1353. BackgroundColor3 = Color3.fromRGB(25, 25, 25),
  1354. BorderColor3 = Color3.fromRGB(0, 0, 0),
  1355. Position = UDim2.new(0, 9, 0, 41),
  1356. Size = UDim2.new(0, 260, 0, 20),
  1357. CanvasSize = UDim2.new(0, 0, 0, 0),
  1358. ScrollBarThickness = 2,
  1359. TopImage = "rbxasset://textures/ui/Scroll/scroll-middle.png",
  1360. BottomImage = "rbxasset://textures/ui/Scroll/scroll-middle.png",
  1361. Visible = false,
  1362. ZIndex = 2,
  1363. }, Dropdown)
  1364.  
  1365. local UIListLayout = library:create("UIListLayout", {
  1366. HorizontalAlignment = Enum.HorizontalAlignment.Center,
  1367. SortOrder = Enum.SortOrder.LayoutOrder,
  1368. }, DropdownScroll)
  1369.  
  1370. local options_num = #data.options
  1371. if options_num >= 4 then
  1372. DropdownScroll.Size = UDim2.new(0, 260, 0, 80)
  1373. for i = 1, options_num do
  1374. DropdownScroll.CanvasSize = DropdownScroll.CanvasSize + UDim2.new(0, 0, 0, 20)
  1375. end
  1376. else
  1377. DropdownScroll.Size = UDim2.new(0, 260, 0, 20 * options_num)
  1378. end
  1379.  
  1380. local in_drop = false
  1381. local in_drop2 = false
  1382. local dropdown_open = false
  1383. DropdownButton.MouseButton1Down:Connect(function()
  1384. DropdownScroll.Visible = not DropdownScroll.Visible
  1385. dropdown_open = DropdownScroll.Visible
  1386.  
  1387. if not dropdown_open then
  1388. library:tween(DropdownText, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextColor3 = Color3.fromRGB(150, 150, 150)})
  1389. library:tween(DropdownButtonText, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextColor3 = Color3.fromRGB(150, 150, 150)})
  1390. else
  1391. library:tween(DropdownText, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextColor3 = Color3.fromRGB(255, 255, 255)})
  1392. library:tween(DropdownButtonText, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextColor3 = Color3.fromRGB(255, 255, 255)})
  1393. end
  1394. end)
  1395. Dropdown.MouseEnter:Connect(function()
  1396. in_drop = true
  1397. end)
  1398. Dropdown.MouseLeave:Connect(function()
  1399. in_drop = false
  1400. end)
  1401. DropdownScroll.MouseEnter:Connect(function()
  1402. in_drop2 = true
  1403. end)
  1404. DropdownScroll.MouseLeave:Connect(function()
  1405. in_drop2 = false
  1406. end)
  1407. uis.InputBegan:Connect(function(input)
  1408. if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.MouseButton2 then
  1409. if DropdownScroll.Visible == true and not in_drop and not in_drop2 then
  1410. DropdownScroll.Visible = false
  1411. DropdownScroll.CanvasPosition = Vector2.new(0,0)
  1412.  
  1413. library:tween(DropdownText, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextColor3 = Color3.fromRGB(150, 150, 150)})
  1414. library:tween(DropdownButtonText, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextColor3 = Color3.fromRGB(150, 150, 150)})
  1415. end
  1416. end
  1417. end)
  1418.  
  1419. function element.update_text()
  1420. local options = {}
  1421. for i,v in next, data.options do
  1422. if table.find(value.Combo, v) then
  1423. table.insert(options, v)
  1424. end
  1425. end
  1426. local new_text = ""
  1427. if #options == 0 then
  1428. new_text = "..."
  1429. elseif #options == 1 then
  1430. new_text = options[1]
  1431. else
  1432. for i,v in next, options do
  1433. if i == 1 then
  1434. new_text = v
  1435. else
  1436. if i > 3 then
  1437. if i < 5 then
  1438. new_text = new_text..", ..."
  1439. end
  1440. else
  1441. new_text = new_text..", "..v
  1442. end
  1443. end
  1444. end
  1445. end
  1446.  
  1447. DropdownButtonText.Text = new_text
  1448. end
  1449.  
  1450. function element:set_value(new_value, cb)
  1451. value = new_value and new_value or value
  1452. menu.values[tab.tab_num][section_name][sector_name][flag] = value
  1453.  
  1454. element.update_text()
  1455.  
  1456. for _,DropButton in next, DropdownScroll:GetChildren() do
  1457. if not DropButton:IsA("TextButton") then continue end
  1458. local ButtonText = DropButton.ButtonText
  1459. if table.find(value.Combo, ButtonText.Text) then
  1460. DropButton.Decoration.Visible = true
  1461. ButtonText.TextColor3 = Color3.fromRGB(255, 255, 255)
  1462. else
  1463. DropButton.Decoration.Visible = false
  1464. ButtonText.TextColor3 = Color3.fromRGB(150, 150, 150)
  1465. end
  1466. end
  1467.  
  1468. if cb == nil or not cb then
  1469. do_callback()
  1470. end
  1471. end
  1472.  
  1473. local dropdown_is_first = true
  1474. for _,v in next, data.options do
  1475. local Button = library:create("TextButton", {
  1476. Name = v,
  1477. BackgroundColor3 = Color3.fromRGB(25, 25, 25),
  1478. BorderColor3 = Color3.fromRGB(0, 0, 0),
  1479. BorderSizePixel = 0,
  1480. Position = UDim2.new(0, 0, 0, 20),
  1481. Size = UDim2.new(1, 0, 0, 20),
  1482. AutoButtonColor = false,
  1483. Font = Enum.Font.SourceSans,
  1484. Text = "",
  1485. ZIndex = 2,
  1486. }, DropdownScroll)
  1487.  
  1488. local ButtonText = library:create("TextLabel", {
  1489. Name = "ButtonText",
  1490. BackgroundTransparency = 1,
  1491. Position = UDim2.new(0, 8, 0, 0),
  1492. Size = UDim2.new(0, 245, 1, 0),
  1493. Font = Enum.Font.Ubuntu,
  1494. Text = v,
  1495. TextColor3 = Color3.fromRGB(150, 150, 150),
  1496. TextSize = 14,
  1497. TextXAlignment = Enum.TextXAlignment.Left,
  1498. ZIndex = 2,
  1499. }, Button)
  1500.  
  1501. local Decoration = library:create("Frame", {
  1502. Name = "Decoration",
  1503. BackgroundColor3 = Color3.fromRGB(84, 101, 255),
  1504. BorderSizePixel = 0,
  1505. Size = UDim2.new(0, 1, 1, 0),
  1506. Visible = false,
  1507. ZIndex = 2,
  1508. }, Button)
  1509.  
  1510. local mouse_in = false
  1511. Button.MouseEnter:Connect(function()
  1512. mouse_in = true
  1513. if not table.find(value.Combo, v) then
  1514. library:tween(ButtonText, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextColor3 = Color3.fromRGB(200, 200, 200)})
  1515. end
  1516. end)
  1517. Button.MouseLeave:Connect(function()
  1518. mouse_in = false
  1519. if not table.find(value.Combo, v) then
  1520. library:tween(ButtonText, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextColor3 = Color3.fromRGB(150, 150, 150)})
  1521. end
  1522. end)
  1523. Button.MouseButton1Down:Connect(function()
  1524. if table.find(value.Combo, v) then
  1525. table.remove(value.Combo, table.find(value.Combo, v))
  1526. Decoration.Visible = false
  1527. library:tween(ButtonText, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextColor3 = Color3.fromRGB(150, 150, 150)})
  1528. else
  1529. table.insert(value.Combo, v)
  1530. library:tween(ButtonText, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextColor3 = Color3.fromRGB(255, 255, 255)})
  1531. Decoration.Visible = true
  1532. end
  1533.  
  1534. element.update_text()
  1535.  
  1536. do_callback()
  1537. end)
  1538.  
  1539. if dropdown_is_first then
  1540. dropdown_is_first = false
  1541. end
  1542. end
  1543. element:set_value(value, true)
  1544. elseif type == "Button" then
  1545. Border.Size = Border.Size + UDim2.new(0, 0, 0, 30)
  1546.  
  1547. local ButtonFrame = library:create("Frame", {
  1548. Name = "ButtonFrame",
  1549. BackgroundTransparency = 1,
  1550. Position = UDim2.new(0, 0, 0, 0),
  1551. Size = UDim2.new(1, 0, 0, 30),
  1552. }, Container)
  1553.  
  1554. local Button = library:create("TextButton", {
  1555. Name = "Button",
  1556. AnchorPoint = Vector2.new(0.5, 0.5),
  1557. BackgroundColor3 = Color3.fromRGB(25, 25, 25),
  1558. BorderColor3 = Color3.fromRGB(0, 0, 0),
  1559. Position = UDim2.new(0.5, 0, 0.5, 0),
  1560. Size = UDim2.new(0, 215, 0, 20),
  1561. AutoButtonColor = false,
  1562. Font = Enum.Font.Ubuntu,
  1563. Text = text,
  1564. TextColor3 = Color3.fromRGB(150, 150, 150),
  1565. TextSize = 14,
  1566. }, ButtonFrame)
  1567.  
  1568. Button.MouseEnter:Connect(function()
  1569. library:tween(Button, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextColor3 = Color3.fromRGB(255, 255, 255)})
  1570. end)
  1571. Button.MouseLeave:Connect(function()
  1572. library:tween(Button, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextColor3 = Color3.fromRGB(150, 150, 150)})
  1573. end)
  1574. Button.MouseButton1Down:Connect(function()
  1575. Button.BorderColor3 = Color3.fromRGB(84, 101, 255)
  1576. library:tween(Button, TweenInfo.new(0.6, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BorderColor3 = Color3.fromRGB(0, 0, 0)})
  1577. do_callback()
  1578. end)
  1579. elseif type == "TextBox" then
  1580. Border.Size = Border.Size + UDim2.new(0, 0, 0, 30)
  1581.  
  1582. value = {Text = data.default and data.default or ""}
  1583.  
  1584. local ButtonFrame = library:create("Frame", {
  1585. Name = "ButtonFrame",
  1586. BackgroundTransparency = 1,
  1587. Position = UDim2.new(0, 0, 0, 0),
  1588. Size = UDim2.new(1, 0, 0, 30),
  1589. }, Container)
  1590.  
  1591. function element:set_visible(bool)
  1592. if bool then
  1593. if ButtonFrame.Visible then return end
  1594. Border.Size = Border.Size + UDim2.new(0, 0, 0, 30)
  1595. ButtonFrame.Visible = true
  1596. else
  1597. if not ButtonFrame.Visible then return end
  1598. Border.Size = Border.Size + UDim2.new(0, 0, 0, -30)
  1599. ButtonFrame.Visible = false
  1600. end
  1601. end
  1602.  
  1603. local TextBox = library:create("TextBox", {
  1604. Name = "Button",
  1605. AnchorPoint = Vector2.new(0.5, 0.5),
  1606. BackgroundColor3 = Color3.fromRGB(25, 25, 25),
  1607. BorderColor3 = Color3.fromRGB(0, 0, 0),
  1608. Position = UDim2.new(0.5, 0, 0.5, 0),
  1609. Size = UDim2.new(0, 215, 0, 20),
  1610. Font = Enum.Font.Ubuntu,
  1611. Text = text,
  1612. TextColor3 = Color3.fromRGB(150, 150, 150),
  1613. TextSize = 14,
  1614. PlaceholderText = text,
  1615. ClearTextOnFocus = false,
  1616. }, ButtonFrame)
  1617.  
  1618. TextBox.MouseEnter:Connect(function()
  1619. library:tween(TextBox, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextColor3 = Color3.fromRGB(255, 255, 255)})
  1620. end)
  1621. TextBox.MouseLeave:Connect(function()
  1622. library:tween(TextBox, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextColor3 = Color3.fromRGB(150, 150, 150)})
  1623. end)
  1624. TextBox:GetPropertyChangedSignal("Text"):Connect(function()
  1625. if string.len(TextBox.Text) > 15 then
  1626. TextBox.Text = string.sub(TextBox.Text, 1, 15)
  1627. end
  1628. if TextBox.Text ~= value.Text then
  1629. value.Text = TextBox.Text
  1630. do_callback()
  1631. end
  1632. end)
  1633. uis.TextBoxFocused:connect(function()
  1634. if uis:GetFocusedTextBox() == TextBox then
  1635. library:tween(TextBox, TweenInfo.new(0.3, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BorderColor3 = Color3.fromRGB(84, 101, 255)})
  1636. end
  1637. end)
  1638. uis.TextBoxFocusReleased:connect(function()
  1639. library:tween(TextBox, TweenInfo.new(0.3, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BorderColor3 = Color3.fromRGB(0, 0, 0)})
  1640. end)
  1641.  
  1642.  
  1643. function element:set_value(new_value, cb)
  1644. value = new_value or value
  1645.  
  1646. TextBox.Text = value.Text
  1647.  
  1648. if cb == nil or not cb then
  1649. do_callback()
  1650. end
  1651. end
  1652. element:set_value(value, true)
  1653. elseif type == "Scroll" then
  1654. local scrollsize = data.scrollsize and data.scrollsize or 5
  1655.  
  1656. Border.Size = Border.Size + UDim2.new(0, 0, 0, scrollsize * 20 + 10)
  1657.  
  1658. value = {Scroll = data.options[1]}
  1659.  
  1660. local Scroll = library:create("Frame", {
  1661. Name = "Scroll",
  1662. BackgroundColor3 = Color3.fromRGB(255, 255, 255),
  1663. BackgroundTransparency = 1,
  1664. Position = UDim2.new(0, 0, 0, 0),
  1665. Size = UDim2.new(1, 0, 0, scrollsize * 20 + 10),
  1666. }, Container)
  1667.  
  1668. function element:set_visible(bool)
  1669. if bool then
  1670. if Scroll.Visible then return end
  1671. Scroll.Size = Border.Size + UDim2.new(0, 0, 0, scrollsize * 20 + 10)
  1672. Scroll.Visible = true
  1673. else
  1674. if not Scroll.Visible then return end
  1675. Scroll.Size = Border.Size + UDim2.new(0, 0, 0, -scrollsize * 20 + 10)
  1676. Scroll.Visible = false
  1677. end
  1678. end
  1679.  
  1680. local ScrollFrame = library:create("ScrollingFrame", {
  1681. Name = "ScrollFrame",
  1682. Active = true,
  1683. BackgroundColor3 = Color3.fromRGB(25, 25, 25),
  1684. BorderColor3 = Color3.fromRGB(0, 0, 0),
  1685. Position = UDim2.new(0.5, 0, 0, 5),
  1686. Size = UDim2.new(0, 215, 0, scrollsize * 20),
  1687. BottomImage = "rbxasset://textures/ui/Scroll/scroll-middle.png",
  1688. CanvasSize = UDim2.new(0, 0, 0, #data.options * 20),
  1689. ScrollBarThickness = 2,
  1690. TopImage = "rbxasset://textures/ui/Scroll/scroll-middle.png",
  1691. AnchorPoint = Vector2.new(0.5, 0),
  1692. ScrollBarImageColor3 = Color3.fromRGB(84, 101, 255),
  1693. }, Scroll)
  1694. ScrollFrame.MouseEnter:Connect(function()
  1695. library:tween(ScrollFrame, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BorderColor3 = Color3.fromRGB(50, 50, 50)})
  1696. end)
  1697. ScrollFrame.MouseLeave:Connect(function()
  1698. library:tween(ScrollFrame, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BorderColor3 = Color3.fromRGB(0, 0, 0)})
  1699. end)
  1700.  
  1701. local UIListLayout = library:create("UIListLayout", {
  1702. HorizontalAlignment = Enum.HorizontalAlignment.Center,
  1703. SortOrder = Enum.SortOrder.LayoutOrder,
  1704. }, ScrollFrame)
  1705.  
  1706. local scroll_is_first = true
  1707. for _,v in next, data.options do
  1708. local Button = library:create("TextButton", {
  1709. Name = v,
  1710. BackgroundColor3 = Color3.fromRGB(25, 25, 25),
  1711. BorderColor3 = Color3.fromRGB(0, 0, 0),
  1712. BorderSizePixel = 0,
  1713. Position = UDim2.new(0, 0, 0, 20),
  1714. Size = UDim2.new(1, 0, 0, 20),
  1715. AutoButtonColor = false,
  1716. Font = Enum.Font.SourceSans,
  1717. Text = "",
  1718. TextColor3 = Color3.fromRGB(0, 0, 0),
  1719. TextSize = 14,
  1720. }, ScrollFrame)
  1721.  
  1722. local ButtonText = library:create("TextLabel", {
  1723. Name = "ButtonText",
  1724. BackgroundColor3 = Color3.fromRGB(255, 255, 255),
  1725. BackgroundTransparency = 1,
  1726. Position = UDim2.new(0, 7, 0, 0),
  1727. Size = UDim2.new(0, 210, 1, 0),
  1728. Font = Enum.Font.Ubuntu,
  1729. Text = v,
  1730. TextColor3 = Color3.fromRGB(150, 150, 150),
  1731. TextSize = 14,
  1732. TextXAlignment = Enum.TextXAlignment.Left,
  1733. }, Button)
  1734.  
  1735. local Decoration = library:create("Frame", {
  1736. Name = "Decoration",
  1737. Parent = Button,
  1738. BackgroundColor3 = Color3.fromRGB(84, 101, 255),
  1739. BorderSizePixel = 0,
  1740. Size = UDim2.new(0, 1, 1, 0),
  1741. Visible = false,
  1742. }, Button)
  1743.  
  1744. local mouse_in = false
  1745. Button.MouseEnter:Connect(function()
  1746. mouse_in = true
  1747. if value.Scroll ~= v then
  1748. library:tween(ButtonText, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextColor3 = Color3.fromRGB(200, 200, 200)})
  1749. end
  1750. end)
  1751. Button.MouseLeave:Connect(function()
  1752. mouse_in = false
  1753. if value.Scroll ~= v then
  1754. library:tween(ButtonText, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextColor3 = Color3.fromRGB(150, 150, 150)})
  1755. end
  1756. end)
  1757. Button.MouseButton1Down:Connect(function()
  1758. for _,Button2 in next, ScrollFrame:GetChildren() do
  1759. if not Button2:IsA("TextButton") then continue end
  1760. Button2.Decoration.Visible = false
  1761. library:tween(Button2.ButtonText, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextColor3 = Color3.fromRGB(150, 150, 150)})
  1762. end
  1763.  
  1764. menu.values[tab.tab_num][section_name][sector_name][flag] = value
  1765.  
  1766. Decoration.Visible = true
  1767. library:tween(ButtonText, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextColor3 = Color3.fromRGB(255, 255, 255)})
  1768.  
  1769. value.Scroll = v
  1770.  
  1771. do_callback()
  1772. end)
  1773.  
  1774. if scroll_is_first then
  1775. scroll_is_first = false
  1776. Decoration.Visible = true
  1777. ButtonText.TextColor3 = Color3.fromRGB(255, 255, 255)
  1778. end
  1779. end
  1780.  
  1781. function element:add_value(v)
  1782. if ScrollFrame:FindFirstChild(v) then return end
  1783.  
  1784. ScrollFrame.CanvasSize = ScrollFrame.CanvasSize + UDim2.new(0, 0, 0, 20)
  1785.  
  1786. local Button = library:create("TextButton", {
  1787. Name = v,
  1788. BackgroundColor3 = Color3.fromRGB(25, 25, 25),
  1789. BorderColor3 = Color3.fromRGB(0, 0, 0),
  1790. BorderSizePixel = 0,
  1791. Position = UDim2.new(0, 0, 0, 20),
  1792. Size = UDim2.new(1, 0, 0, 20),
  1793. AutoButtonColor = false,
  1794. Font = Enum.Font.SourceSans,
  1795. Text = "",
  1796. TextColor3 = Color3.fromRGB(0, 0, 0),
  1797. TextSize = 14,
  1798. }, ScrollFrame)
  1799.  
  1800. local ButtonText = library:create("TextLabel", {
  1801. Name = "ButtonText",
  1802. BackgroundColor3 = Color3.fromRGB(255, 255, 255),
  1803. BackgroundTransparency = 1,
  1804. Position = UDim2.new(0, 7, 0, 0),
  1805. Size = UDim2.new(0, 210, 1, 0),
  1806. Font = Enum.Font.Ubuntu,
  1807. Text = v,
  1808. TextColor3 = Color3.fromRGB(150, 150, 150),
  1809. TextSize = 14,
  1810. TextXAlignment = Enum.TextXAlignment.Left,
  1811. }, Button)
  1812.  
  1813. local Decoration = library:create("Frame", {
  1814. Name = "Decoration",
  1815. Parent = Button,
  1816. BackgroundColor3 = Color3.fromRGB(84, 101, 255),
  1817. BorderSizePixel = 0,
  1818. Size = UDim2.new(0, 1, 1, 0),
  1819. Visible = false,
  1820. }, Button)
  1821.  
  1822. local mouse_in = false
  1823. Button.MouseEnter:Connect(function()
  1824. mouse_in = true
  1825. if value.Scroll ~= v then
  1826. library:tween(ButtonText, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextColor3 = Color3.fromRGB(200, 200, 200)})
  1827. end
  1828. end)
  1829. Button.MouseLeave:Connect(function()
  1830. mouse_in = false
  1831. if value.Scroll ~= v then
  1832. library:tween(ButtonText, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextColor3 = Color3.fromRGB(150, 150, 150)})
  1833. end
  1834. end)
  1835. Button.MouseButton1Down:Connect(function()
  1836. for _,Button2 in next, ScrollFrame:GetChildren() do
  1837. if not Button2:IsA("TextButton") then continue end
  1838. Button2.Decoration.Visible = false
  1839. library:tween(Button2.ButtonText, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextColor3 = Color3.fromRGB(150, 150, 150)})
  1840. end
  1841.  
  1842. menu.values[tab.tab_num][section_name][sector_name][flag] = value
  1843.  
  1844. Decoration.Visible = true
  1845. library:tween(ButtonText, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextColor3 = Color3.fromRGB(255, 255, 255)})
  1846.  
  1847. value.Scroll = v
  1848.  
  1849. do_callback()
  1850. end)
  1851.  
  1852. if scroll_is_first then
  1853. scroll_is_first = false
  1854. Decoration.Visible = true
  1855. ButtonText.TextColor3 = Color3.fromRGB(255, 255, 255)
  1856. end
  1857. end
  1858.  
  1859. function element:set_value(new_value, cb)
  1860. value = new_value or value
  1861.  
  1862. for _,Button2 in next, ScrollFrame:GetChildren() do
  1863. if not Button2:IsA("TextButton") then continue end
  1864. Button2.Decoration.Visible = false
  1865. library:tween(Button2.ButtonText, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextColor3 = Color3.fromRGB(150, 150, 150)})
  1866. end
  1867. ScrollFrame[value.Scroll].Decoration.Visible = true
  1868. library:tween(ScrollFrame[value.Scroll].ButtonText, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextColor3 = Color3.fromRGB(255, 255, 255)})
  1869.  
  1870. if cb == nil or not cb then
  1871. do_callback()
  1872. end
  1873. end
  1874. element:set_value(value, true)
  1875. elseif type == "Slider" then
  1876. Border.Size = Border.Size + UDim2.new(0, 0, 0, 35)
  1877.  
  1878. value = {Slider = default and default.default or 0}
  1879.  
  1880. local min, max = default and default.min or 0, default and default.max or 100
  1881.  
  1882. local Slider = library:create("Frame", {
  1883. Name = "Slider",
  1884. BackgroundColor3 = Color3.fromRGB(255, 255, 255),
  1885. BackgroundTransparency = 1,
  1886. Size = UDim2.new(1, 0, 0, 35),
  1887. }, Container)
  1888.  
  1889. function element:set_visible(bool)
  1890. if bool then
  1891. if Slider.Visible then return end
  1892. Border.Size = Border.Size + UDim2.new(0, 0, 0, 35)
  1893. Slider.Visible = true
  1894. else
  1895. if not Slider.Visible then return end
  1896. Border.Size = Border.Size + UDim2.new(0, 0, 0, -35)
  1897. Slider.Visible = false
  1898. end
  1899. end
  1900.  
  1901. local SliderText = library:create("TextLabel", {
  1902. Name = "SliderText",
  1903. BackgroundTransparency = 1,
  1904. Position = UDim2.new(0, 9, 0, 6),
  1905. Size = UDim2.new(0, 200, 0, 9),
  1906. Font = Enum.Font.Ubuntu,
  1907. Text = text,
  1908. TextColor3 = Color3.fromRGB(150, 150, 150),
  1909. TextSize = 14,
  1910. TextXAlignment = Enum.TextXAlignment.Left,
  1911. }, Slider)
  1912.  
  1913. local SliderButton = library:create("TextButton", {
  1914. Name = "SliderButton",
  1915. BackgroundColor3 = Color3.fromRGB(25, 25, 25),
  1916. BorderColor3 = Color3.fromRGB(0, 0, 0),
  1917. Position = UDim2.new(0, 9, 0, 20),
  1918. Size = UDim2.new(0, 260, 0, 10),
  1919. AutoButtonColor = false,
  1920. Font = Enum.Font.SourceSans,
  1921. Text = "",
  1922. }, Slider)
  1923.  
  1924. local SliderFrame = library:create("Frame", {
  1925. Name = "SliderFrame",
  1926. BackgroundColor3 = Color3.fromRGB(255, 255, 255),
  1927. BorderSizePixel = 0,
  1928. Size = UDim2.new(0, 100, 1, 0),
  1929. }, SliderButton)
  1930.  
  1931. local UIGradient = library:create("UIGradient", {
  1932. Color = ColorSequence.new{ColorSequenceKeypoint.new(0, Color3.fromRGB(79, 95, 239)), ColorSequenceKeypoint.new(1, Color3.fromRGB(56, 67, 163))},
  1933. Rotation = 90,
  1934. }, SliderFrame)
  1935.  
  1936. local SliderValue = library:create("TextLabel", {
  1937. Name = "SliderValue",
  1938. BackgroundTransparency = 1,
  1939. Position = UDim2.new(0, 69, 0, 6),
  1940. Size = UDim2.new(0, 200, 0, 9),
  1941. Font = Enum.Font.Ubuntu,
  1942. Text = value.Slider,
  1943. TextColor3 = Color3.fromRGB(150, 150, 150),
  1944. TextSize = 14,
  1945. TextXAlignment = Enum.TextXAlignment.Right,
  1946. }, Slider)
  1947.  
  1948. local is_sliding = false
  1949. local mouse_in = false
  1950. Slider.MouseEnter:Connect(function()
  1951. library:tween(SliderText, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextColor3 = Color3.fromRGB(255, 255, 255)})
  1952. library:tween(SliderValue, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextColor3 = Color3.fromRGB(255, 255, 255)})
  1953.  
  1954. mouse_in = true
  1955. end)
  1956. Slider.MouseLeave:Connect(function()
  1957. if not is_sliding then
  1958. library:tween(SliderText, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextColor3 = Color3.fromRGB(150, 150, 150)})
  1959. library:tween(SliderValue, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextColor3 = Color3.fromRGB(150, 150, 150)})
  1960. end
  1961.  
  1962. mouse_in = false
  1963. end)
  1964. SliderButton.MouseButton1Down:Connect(function()
  1965. SliderFrame.Size = UDim2.new(0, math.clamp(mouse.X - SliderFrame.AbsolutePosition.X, 0, 260), 1, 0)
  1966.  
  1967. local val = math.floor((((max - min) / 260) * SliderFrame.AbsoluteSize.X) + min)
  1968. if val ~= value.Slider then
  1969. SliderValue.Text = val
  1970. value.Slider = val
  1971. do_callback()
  1972. end
  1973.  
  1974. is_sliding = true
  1975.  
  1976. move_connection = mouse.Move:Connect(function()
  1977. SliderFrame.Size = UDim2.new(0, math.clamp(mouse.X - SliderFrame.AbsolutePosition.X, 0, 260), 1, 0)
  1978.  
  1979. local val = math.floor((((max - min) / 260) * SliderFrame.AbsoluteSize.X) + min)
  1980. if val ~= value.Slider then
  1981. SliderValue.Text = val
  1982. value.Slider = val
  1983. do_callback()
  1984. end
  1985. end)
  1986. release_connection = uis.InputEnded:Connect(function(Mouse)
  1987. if Mouse.UserInputType == Enum.UserInputType.MouseButton1 then
  1988. SliderFrame.Size = UDim2.new(0, math.clamp(mouse.X - SliderFrame.AbsolutePosition.X, 0, 260), 1, 0)
  1989.  
  1990. local val = math.floor((((max - min) / 260) * SliderFrame.AbsoluteSize.X) + min)
  1991. if val ~= value.Slider then
  1992. SliderValue.Text = val
  1993. value.Slider = val
  1994. do_callback()
  1995. end
  1996.  
  1997. is_sliding = false
  1998.  
  1999. if not mouse_in then
  2000. library:tween(SliderText, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextColor3 = Color3.fromRGB(150, 150, 150)})
  2001. library:tween(SliderValue, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextColor3 = Color3.fromRGB(150, 150, 150)})
  2002. end
  2003.  
  2004. move_connection:Disconnect()
  2005. release_connection:Disconnect()
  2006. end
  2007. end)
  2008. end)
  2009.  
  2010. function element:set_value(new_value, cb)
  2011. value = new_value and new_value or value
  2012. menu.values[tab.tab_num][section_name][sector_name][flag] = value
  2013.  
  2014. local new_size = (value.Slider - min) / (max-min)
  2015. SliderFrame.Size = UDim2.new(new_size, 0, 1, 0)
  2016. SliderValue.Text = value.Slider
  2017.  
  2018. if cb == nil or not cb then
  2019. do_callback()
  2020. end
  2021. end
  2022. element:set_value(value, true)
  2023. end
  2024.  
  2025. menu.on_load_cfg:Connect(function()
  2026. if type ~= "Button" and type ~= "Scroll" then
  2027. element:set_value(menu.values[tab.tab_num][section_name][sector_name][flag])
  2028. end
  2029. end)
  2030.  
  2031. return element
  2032. end
  2033.  
  2034. return sector
  2035. end
  2036.  
  2037. return section
  2038. end
  2039.  
  2040. return tab
  2041. end
  2042.  
  2043. return menu
  2044. end
  2045.  
  2046. return library
Add Comment
Please, Sign In to add comment