IvesAwadi

Jan UI Customized

Jul 29th, 2020 (edited)
1,962
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 58.76 KB | None | 0 0
  1. local library = {flags = {}, windows = {}, open = true}
  2.  
  3. --Services
  4. local runService = game:GetService"RunService"
  5. local tweenService = game:GetService"TweenService"
  6. local textService = game:GetService"TextService"
  7. local inputService = game:GetService"UserInputService"
  8.  
  9. --Locals
  10. local dragging, dragInput, dragStart, startPos, dragObject
  11.  
  12. local blacklistedKeys = { --add or remove keys if you find the need to
  13.     Enum.KeyCode.Unknown,Enum.KeyCode.W,Enum.KeyCode.A,Enum.KeyCode.S,Enum.KeyCode.D,Enum.KeyCode.Slash,Enum.KeyCode.Tab,Enum.KeyCode.Backspace,Enum.KeyCode.Escape
  14. }
  15. local whitelistedMouseinputs = { --add or remove mouse inputs if you find the need to
  16.     Enum.UserInputType.MouseButton1,Enum.UserInputType.MouseButton2,Enum.UserInputType.MouseButton3
  17. }
  18.  
  19. --Functions
  20. local function round(num, bracket)
  21.     bracket = bracket or 1
  22.     local a = math.floor(num/bracket + (math.sign(num) * 0.5)) * bracket
  23.     if a < 0 then
  24.         a = a + bracket
  25.     end
  26.     return a
  27. end
  28.  
  29. local function keyCheck(x,x1)
  30.     for _,v in next, x1 do
  31.         if v == x then
  32.             return true
  33.         end
  34.     end
  35. end
  36.  
  37. local function update(input)
  38.     local delta = input.Position - dragStart
  39.     local yPos = (startPos.Y.Offset + delta.Y) < -36 and -36 or startPos.Y.Offset + delta.Y
  40.     dragObject:TweenPosition(UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, yPos), "Out", "Quint", 0.1, true)
  41. end
  42.  
  43. --From: https://devforum.roblox.com/t/how-to-create-a-simple-rainbow-effect-using-tweenService/221849/2
  44. local chromaColor
  45. local rainbowTime = 5
  46. spawn(function()
  47.     while wait() do
  48.         chromaColor = Color3.fromHSV(tick() % rainbowTime / rainbowTime, 1, 1)
  49.     end
  50. end)
  51.  
  52. function library:Create(class, properties)
  53.     local inst = Instance.new(class)
  54.     for property, value in next, properties do
  55.         inst[property] = value
  56.     end
  57.     return inst
  58. end
  59.  
  60. local function createOptionHolder(holderTitle, parent, parentTable, subHolder)
  61.     local size = subHolder and 34 or 40
  62.     parentTable.main = library:Create("ImageButton", {
  63.         LayoutOrder = subHolder and parentTable.position or 0,
  64.         Position = UDim2.new(0, 20 + (250 * (parentTable.position or 0)), 0, 20),
  65.         Size = UDim2.new(0, 230, 0, size),
  66.         BackgroundTransparency = 1,
  67.         Image = "rbxassetid://3570695787",
  68.         ImageColor3 = Color3.fromRGB(20, 20, 20),
  69.         ScaleType = Enum.ScaleType.Slice,
  70.         SliceCenter = Rect.new(100, 100, 100, 100),
  71.         SliceScale = 0.04,
  72.         ClipsDescendants = true,
  73.         Parent = parent
  74.     })
  75.    
  76.     local round
  77.     if not subHolder then
  78.         round = library:Create("ImageLabel", {
  79.             Size = UDim2.new(1, 0, 0, size),
  80.             BackgroundTransparency = 1,
  81.             Image = "rbxassetid://3570695787",
  82.             ImageColor3 = parentTable.open and (subHolder and Color3.fromRGB(16, 16, 16) or Color3.fromRGB(10, 10, 10)) or (subHolder and Color3.fromRGB(10, 10, 10) or Color3.fromRGB(6, 6, 6)),
  83.             ScaleType = Enum.ScaleType.Slice,
  84.             SliceCenter = Rect.new(100, 100, 100, 100),
  85.             SliceScale = 0.04,
  86.             Parent = parentTable.main
  87.         })
  88.     end
  89.    
  90.     local title = library:Create("TextLabel", {
  91.         Size = UDim2.new(1, 0, 0, size),
  92.         BackgroundTransparency = subHolder and 0 or 1,
  93.         BackgroundColor3 = Color3.fromRGB(10, 10, 10),
  94.         BorderSizePixel = 0,
  95.         Text = holderTitle,
  96.         TextSize = subHolder and 16 or 17,
  97.         Font = Enum.Font.GothamBold,
  98.         TextColor3 = Color3.fromRGB(255, 255, 255),
  99.         Parent = parentTable.main
  100.     })
  101.    
  102.     local closeHolder = library:Create("Frame", {
  103.         Position = UDim2.new(1, 0, 0, 0),
  104.         Size = UDim2.new(-1, 0, 1, 0),
  105.         SizeConstraint = Enum.SizeConstraint.RelativeYY,
  106.         BackgroundTransparency = 1,
  107.         Parent = title
  108.     })
  109.    
  110.     local close = library:Create("ImageLabel", {
  111.         AnchorPoint = Vector2.new(0.5, 0.5),
  112.         Position = UDim2.new(0.5, 0, 0.5, 0),
  113.         Size = UDim2.new(1, -size - 10, 1, -size - 10),
  114.         Rotation = parentTable.open and 90 or 180,
  115.         BackgroundTransparency = 1,
  116.         Image = "rbxassetid://4918373417",
  117.         ImageColor3 = parentTable.open and Color3.fromRGB(50, 50, 50) or Color3.fromRGB(30, 30, 30),
  118.         ScaleType = Enum.ScaleType.Fit,
  119.         Parent = closeHolder
  120.     })
  121.    
  122.     parentTable.content = library:Create("Frame", {
  123.         Position = UDim2.new(0, 0, 0, size),
  124.         Size = UDim2.new(1, 0, 1, -size),
  125.         BackgroundTransparency = 1,
  126.         Parent = parentTable.main
  127.     })
  128.    
  129.     local layout = library:Create("UIListLayout", {
  130.         SortOrder = Enum.SortOrder.LayoutOrder,
  131.         Parent = parentTable.content
  132.     })
  133.    
  134.     layout.Changed:connect(function()
  135.         parentTable.content.Size = UDim2.new(1, 0, 0, layout.AbsoluteContentSize.Y)
  136.         parentTable.main.Size = #parentTable.options > 0 and parentTable.open and UDim2.new(0, 230, 0, layout.AbsoluteContentSize.Y + size) or UDim2.new(0, 230, 0, size)
  137.     end)
  138.    
  139.     if not subHolder then
  140.         library:Create("UIPadding", {
  141.             Parent = parentTable.content
  142.         })
  143.        
  144.         title.InputBegan:connect(function(input)
  145.             if input.UserInputType == Enum.UserInputType.MouseButton1 then
  146.                 dragObject = parentTable.main
  147.                 dragging = true
  148.                 dragStart = input.Position
  149.                 startPos = dragObject.Position
  150.             end
  151.         end)
  152.         title.InputChanged:connect(function(input)
  153.             if dragging and input.UserInputType == Enum.UserInputType.MouseMovement then
  154.                 dragInput = input
  155.             end
  156.         end)
  157.             title.InputEnded:connect(function(input)
  158.             if input.UserInputType == Enum.UserInputType.MouseButton1 then
  159.                 dragging = false
  160.             end
  161.         end)
  162.     end
  163.    
  164.     closeHolder.InputBegan:connect(function(input)
  165.         if input.UserInputType == Enum.UserInputType.MouseButton1 then
  166.             parentTable.open = not parentTable.open
  167.             tweenService:Create(close, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Rotation = parentTable.open and 90 or 180, ImageColor3 = parentTable.open and Color3.fromRGB(50, 50, 50) or Color3.fromRGB(30, 30, 30)}):Play()
  168.             if subHolder then
  169.                 tweenService:Create(title, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundColor3 = parentTable.open and Color3.fromRGB(16, 16, 16) or Color3.fromRGB(10, 10, 10)}):Play()
  170.             else
  171.                 tweenService:Create(round, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = parentTable.open and Color3.fromRGB(10, 10, 10) or Color3.fromRGB(6, 6, 6)}):Play()
  172.             end
  173.             parentTable.main:TweenSize(#parentTable.options > 0 and parentTable.open and UDim2.new(0, 230, 0, layout.AbsoluteContentSize.Y + size) or UDim2.new(0, 230, 0, size), "Out", "Quad", 0.2, true)
  174.         end
  175.     end)
  176.  
  177.     function parentTable:SetTitle(newTitle)
  178.         title.Text = tostring(newTitle)
  179.     end
  180.    
  181.     return parentTable
  182. end
  183.    
  184. local function createLabel(option, parent)
  185.     local main = library:Create("TextLabel", {
  186.         LayoutOrder = option.position,
  187.         Size = UDim2.new(1, 0, 0, 26),
  188.         BackgroundTransparency = 1,
  189.         Text = " " .. option.text,
  190.         TextSize = 17,
  191.         Font = Enum.Font.Gotham,
  192.         TextColor3 = Color3.fromRGB(255, 255, 255),
  193.         TextXAlignment = Enum.TextXAlignment.Left,
  194.         Parent = parent.content
  195.     })
  196.    
  197.     setmetatable(option, {__newindex = function(t, i, v)
  198.         if i == "Text" then
  199.             main.Text = " " .. tostring(v)
  200.         end
  201.     end})
  202. end
  203.  
  204. function createToggle(option, parent)
  205.     local main = library:Create("TextLabel", {
  206.         LayoutOrder = option.position,
  207.         Size = UDim2.new(1, 0, 0, 31),
  208.         BackgroundTransparency = 1,
  209.         Text = " " .. option.text,
  210.         TextSize = 17,
  211.         Font = Enum.Font.Gotham,
  212.         TextColor3 = Color3.fromRGB(255, 255, 255),
  213.         TextXAlignment = Enum.TextXAlignment.Left,
  214.         Parent = parent.content
  215.     })
  216.    
  217.     local tickboxOutline = library:Create("ImageLabel", {
  218.         Position = UDim2.new(1, -6, 0, 4),
  219.         Size = UDim2.new(-1, 10, 1, -10),
  220.         SizeConstraint = Enum.SizeConstraint.RelativeYY,
  221.         BackgroundTransparency = 1,
  222.         Image = "rbxassetid://3570695787",
  223.         ImageColor3 = option.state and Color3.fromRGB(255, 65, 65) or Color3.fromRGB(100, 100, 100),
  224.         ScaleType = Enum.ScaleType.Slice,
  225.         SliceCenter = Rect.new(100, 100, 100, 100),
  226.         SliceScale = 0.02,
  227.         Parent = main
  228.     })
  229.    
  230.     local tickboxInner = library:Create("ImageLabel", {
  231.         Position = UDim2.new(0, 2, 0, 2),
  232.         Size = UDim2.new(1, -4, 1, -4),
  233.         BackgroundTransparency = 1,
  234.         Image = "rbxassetid://3570695787",
  235.         ImageColor3 = option.state and Color3.fromRGB(255, 65, 65) or Color3.fromRGB(20, 20, 20),
  236.         ScaleType = Enum.ScaleType.Slice,
  237.         SliceCenter = Rect.new(100, 100, 100, 100),
  238.         SliceScale = 0.02,
  239.         Parent = tickboxOutline
  240.     })
  241.    
  242.     local checkmarkHolder = library:Create("Frame", {
  243.         Position = UDim2.new(0, 4, 0, 4),
  244.         Size = option.state and UDim2.new(1, -8, 1, -8) or UDim2.new(0, 0, 1, -8),
  245.         BackgroundTransparency = 1,
  246.         ClipsDescendants = true,
  247.         Parent = tickboxOutline
  248.     })
  249.    
  250.     local checkmark = library:Create("ImageLabel", {
  251.         Size = UDim2.new(1, 0, 1, 0),
  252.         SizeConstraint = Enum.SizeConstraint.RelativeYY,
  253.         BackgroundTransparency = 1,
  254.         Image = "rbxassetid://4919148038",
  255.         ImageColor3 = Color3.fromRGB(20, 20, 20),
  256.         Parent = checkmarkHolder
  257.     })
  258.    
  259.     local inContact
  260.     main.InputBegan:connect(function(input)
  261.         if input.UserInputType == Enum.UserInputType.MouseButton1 then
  262.             option:SetState(not option.state)
  263.         end
  264.         if input.UserInputType == Enum.UserInputType.MouseMovement then
  265.             inContact = true
  266.             if not option.state then
  267.                 tweenService:Create(tickboxOutline, TweenInfo.new(0.1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(140, 140, 140)}):Play()
  268.             end
  269.         end
  270.     end)
  271.    
  272.     main.InputEnded:connect(function(input)
  273.         if input.UserInputType == Enum.UserInputType.MouseMovement then
  274.             inContact = true
  275.             if not option.state then
  276.                 tweenService:Create(tickboxOutline, TweenInfo.new(0.1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(100, 100, 100)}):Play()
  277.             end
  278.         end
  279.     end)
  280.    
  281.     function option:SetState(state)
  282.         library.flags[self.flag] = state
  283.         self.state = state
  284.         checkmarkHolder:TweenSize(option.state and UDim2.new(1, -8, 1, -8) or UDim2.new(0, 0, 1, -8), "Out", "Quad", 0.2, true)
  285.         tweenService:Create(tickboxInner, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = state and Color3.fromRGB(255, 65, 65) or Color3.fromRGB(20, 20, 20)}):Play()
  286.         if state then
  287.             tweenService:Create(tickboxOutline, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(255, 65, 65)}):Play()
  288.         else
  289.             if inContact then
  290.                 tweenService:Create(tickboxOutline, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(140, 140, 140)}):Play()
  291.             else
  292.                 tweenService:Create(tickboxOutline, TweenInfo.new(0.1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(100, 100, 100)}):Play()
  293.             end
  294.         end
  295.         self.callback(state)
  296.     end
  297.  
  298.     if option.state then
  299.         delay(1, function() option.callback(true) end)
  300.     end
  301.    
  302.     setmetatable(option, {__newindex = function(t, i, v)
  303.         if i == "Text" then
  304.             main.Text = " " .. tostring(v)
  305.         end
  306.     end})
  307. end
  308.  
  309. function createButton(option, parent)
  310.     local main = library:Create("TextLabel", {
  311.         ZIndex = 2,
  312.         LayoutOrder = option.position,
  313.         Size = UDim2.new(1, 0, 0, 34),
  314.         BackgroundTransparency = 1,
  315.         Text = " " .. option.text,
  316.         TextSize = 17,
  317.         Font = Enum.Font.Gotham,
  318.         TextColor3 = Color3.fromRGB(255, 255, 255),
  319.         Parent = parent.content
  320.     })
  321.    
  322.     local round = library:Create("ImageLabel", {
  323.         AnchorPoint = Vector2.new(0.5, 0.5),
  324.         Position = UDim2.new(0.5, 0, 0.5, 0),
  325.         Size = UDim2.new(1, -12, 1, -10),
  326.         BackgroundTransparency = 1,
  327.         Image = "rbxassetid://3570695787",
  328.         ImageColor3 = Color3.fromRGB(40, 40, 40),
  329.         ScaleType = Enum.ScaleType.Slice,
  330.         SliceCenter = Rect.new(100, 100, 100, 100),
  331.         SliceScale = 0.02,
  332.         Parent = main
  333.     })
  334.    
  335.     local inContact
  336.     local clicking
  337.     main.InputBegan:connect(function(input)
  338.         if input.UserInputType == Enum.UserInputType.MouseButton1 then
  339.             library.flags[option.flag] = true
  340.             clicking = true
  341.             tweenService:Create(round, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(66, 224, 45)}):Play()
  342.             option.callback()
  343.         end
  344.         if input.UserInputType == Enum.UserInputType.MouseMovement then
  345.             inContact = true
  346.             tweenService:Create(round, TweenInfo.new(0.1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(60, 60, 60)}):Play()
  347.         end
  348.     end)
  349.    
  350.     main.InputEnded:connect(function(input)
  351.         if input.UserInputType == Enum.UserInputType.MouseButton1 then
  352.             clicking = false
  353.             if inContact then
  354.                 tweenService:Create(round, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(60, 60, 60)}):Play()
  355.             else
  356.                 tweenService:Create(round, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(40, 40, 40)}):Play()
  357.             end
  358.         end
  359.         if input.UserInputType == Enum.UserInputType.MouseMovement then
  360.             inContact = false
  361.             if not clicking then
  362.                 tweenService:Create(round, TweenInfo.new(0.1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(40, 40, 40)}):Play()
  363.             end
  364.         end
  365.     end)
  366. end
  367.  
  368. local function createBind(option, parent)
  369.     local binding
  370.     local holding
  371.     local loop
  372.     local text = string.match(option.key, "Mouse") and string.sub(option.key, 1, 5) .. string.sub(option.key, 12, 13) or option.key
  373.  
  374.     local main = library:Create("TextLabel", {
  375.         LayoutOrder = option.position,
  376.         Size = UDim2.new(1, 0, 0, 33),
  377.         BackgroundTransparency = 1,
  378.         Text = " " .. option.text,
  379.         TextSize = 17,
  380.         Font = Enum.Font.Gotham,
  381.         TextColor3 = Color3.fromRGB(255, 255, 255),
  382.         TextXAlignment = Enum.TextXAlignment.Left,
  383.         Parent = parent.content
  384.     })
  385.    
  386.     local round = library:Create("ImageLabel", {
  387.         Position = UDim2.new(1, -6, 0, 4),
  388.         Size = UDim2.new(0, -textService:GetTextSize(text, 16, Enum.Font.Gotham, Vector2.new(9e9, 9e9)).X - 16, 1, -10),
  389.         SizeConstraint = Enum.SizeConstraint.RelativeYY,
  390.         BackgroundTransparency = 1,
  391.         Image = "rbxassetid://3570695787",
  392.         ImageColor3 = Color3.fromRGB(40, 40, 40),
  393.         ScaleType = Enum.ScaleType.Slice,
  394.         SliceCenter = Rect.new(100, 100, 100, 100),
  395.         SliceScale = 0.02,
  396.         Parent = main
  397.     })
  398.    
  399.     local bindinput = library:Create("TextLabel", {
  400.         Size = UDim2.new(1, 0, 1, 0),
  401.         BackgroundTransparency = 1,
  402.         Text = text,
  403.         TextSize = 16,
  404.         Font = Enum.Font.Gotham,
  405.         TextColor3 = Color3.fromRGB(255, 255, 255),
  406.         Parent = round
  407.     })
  408.    
  409.     local inContact
  410.     main.InputBegan:connect(function(input)
  411.         if input.UserInputType == Enum.UserInputType.MouseMovement then
  412.             inContact = true
  413.             if not binding then
  414.                 tweenService:Create(round, TweenInfo.new(0.1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(60, 60, 60)}):Play()
  415.             end
  416.         end
  417.     end)
  418.      
  419.     main.InputEnded:connect(function(input)
  420.         if input.UserInputType == Enum.UserInputType.MouseButton1 then
  421.             binding = true
  422.             bindinput.Text = "..."
  423.             tweenService:Create(round, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(255, 65, 65)}):Play()
  424.         end
  425.         if input.UserInputType == Enum.UserInputType.MouseMovement then
  426.             inContact = false
  427.             if not binding then
  428.                 tweenService:Create(round, TweenInfo.new(0.1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(40, 40, 40)}):Play()
  429.             end
  430.         end
  431.     end)
  432.    
  433.     inputService.InputBegan:connect(function(input)
  434.         if inputService:GetFocusedTextBox() then return end
  435.         if (input.KeyCode.Name == option.key or input.UserInputType.Name == option.key) and not binding then
  436.             if option.hold then
  437.                 loop = runService.Heartbeat:connect(function()
  438.                     if binding then
  439.                         option.callback(true)
  440.                         loop:Disconnect()
  441.                         loop = nil
  442.                     else
  443.                         option.callback()
  444.                     end
  445.                 end)
  446.             else
  447.                 option.callback()
  448.             end
  449.         elseif binding then
  450.             local key
  451.             pcall(function()
  452.                 if not keyCheck(input.KeyCode, blacklistedKeys) then
  453.                     key = input.KeyCode
  454.                 end
  455.             end)
  456.             pcall(function()
  457.                 if keyCheck(input.UserInputType, whitelistedMouseinputs) and not key then
  458.                     key = input.UserInputType
  459.                 end
  460.             end)
  461.             key = key or option.key
  462.             option:SetKey(key)
  463.         end
  464.     end)
  465.    
  466.     inputService.InputEnded:connect(function(input)
  467.         if input.KeyCode.Name == option.key or input.UserInputType.Name == option.key or input.UserInputType.Name == "MouseMovement" then
  468.             if loop then
  469.                 loop:Disconnect()
  470.                 loop = nil
  471.                 option.callback(true)
  472.             end
  473.         end
  474.     end)
  475.    
  476.     function option:SetKey(key)
  477.         binding = false
  478.         if loop then
  479.             loop:Disconnect()
  480.             loop = nil
  481.         end
  482.         self.key = key or self.key
  483.         self.key = self.key.Name or self.key
  484.         library.flags[self.flag] = self.key
  485.         if string.match(self.key, "Mouse") then
  486.             bindinput.Text = string.sub(self.key, 1, 5) .. string.sub(self.key, 12, 13)
  487.         else
  488.             bindinput.Text = self.key
  489.         end
  490.         tweenService:Create(round, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = inContact and Color3.fromRGB(60, 60, 60) or Color3.fromRGB(40, 40, 40)}):Play()
  491.         round.Size = UDim2.new(0, -textService:GetTextSize(bindinput.Text, 15, Enum.Font.Gotham, Vector2.new(9e9, 9e9)).X - 16, 1, -10)
  492.     end
  493. end
  494.  
  495. local function createSlider(option, parent)
  496.     local main = library:Create("Frame", {
  497.         LayoutOrder = option.position,
  498.         Size = UDim2.new(1, 0, 0, 50),
  499.         BackgroundTransparency = 1,
  500.         Parent = parent.content
  501.     })
  502.    
  503.     local title = library:Create("TextLabel", {
  504.         Position = UDim2.new(0, 0, 0, 4),
  505.         Size = UDim2.new(1, 0, 0, 20),
  506.         BackgroundTransparency = 1,
  507.         Text = " " .. option.text,
  508.         TextSize = 17,
  509.         Font = Enum.Font.Gotham,
  510.         TextColor3 = Color3.fromRGB(255, 255, 255),
  511.         TextXAlignment = Enum.TextXAlignment.Left,
  512.         Parent = main
  513.     })
  514.    
  515.     local slider = library:Create("ImageLabel", {
  516.         Position = UDim2.new(0, 10, 0, 34),
  517.         Size = UDim2.new(1, -20, 0, 5),
  518.         BackgroundTransparency = 1,
  519.         Image = "rbxassetid://3570695787",
  520.         ImageColor3 = Color3.fromRGB(30, 30, 30),
  521.         ScaleType = Enum.ScaleType.Slice,
  522.         SliceCenter = Rect.new(100, 100, 100, 100),
  523.         SliceScale = 0.02,
  524.         Parent = main
  525.     })
  526.    
  527.     local fill = library:Create("ImageLabel", {
  528.         BackgroundTransparency = 1,
  529.         Image = "rbxassetid://3570695787",
  530.         ImageColor3 = Color3.fromRGB(60, 60, 60),
  531.         ScaleType = Enum.ScaleType.Slice,
  532.         SliceCenter = Rect.new(100, 100, 100, 100),
  533.         SliceScale = 0.02,
  534.         Parent = slider
  535.     })
  536.    
  537.     local circle = library:Create("ImageLabel", {
  538.         AnchorPoint = Vector2.new(0.5, 0.5),
  539.         Position = UDim2.new((option.value - option.min) / (option.max - option.min), 0, 0.5, 0),
  540.         SizeConstraint = Enum.SizeConstraint.RelativeYY,
  541.         BackgroundTransparency = 1,
  542.         Image = "rbxassetid://3570695787",
  543.         ImageColor3 = Color3.fromRGB(60, 60, 60),
  544.         ScaleType = Enum.ScaleType.Slice,
  545.         SliceCenter = Rect.new(100, 100, 100, 100),
  546.         SliceScale = 1,
  547.         Parent = slider
  548.     })
  549.    
  550.     local valueRound = library:Create("ImageLabel", {
  551.         Position = UDim2.new(1, -6, 0, 4),
  552.         Size = UDim2.new(0, -60, 0, 18),
  553.         BackgroundTransparency = 1,
  554.         Image = "rbxassetid://3570695787",
  555.         ImageColor3 = Color3.fromRGB(40, 40, 40),
  556.         ScaleType = Enum.ScaleType.Slice,
  557.         SliceCenter = Rect.new(100, 100, 100, 100),
  558.         SliceScale = 0.02,
  559.         Parent = main
  560.     })
  561.    
  562.     local inputvalue = library:Create("TextBox", {
  563.         Size = UDim2.new(1, 0, 1, 0),
  564.         BackgroundTransparency = 1,
  565.         Text = option.value,
  566.         TextColor3 = Color3.fromRGB(235, 235, 235),
  567.         TextSize = 15,
  568.         TextWrapped = true,
  569.         Font = Enum.Font.Gotham,
  570.         Parent = valueRound
  571.     })
  572.    
  573.     if option.min >= 0 then
  574.         fill.Size = UDim2.new((option.value - option.min) / (option.max - option.min), 0, 1, 0)
  575.     else
  576.         fill.Position = UDim2.new((0 - option.min) / (option.max - option.min), 0, 0, 0)
  577.         fill.Size = UDim2.new(option.value / (option.max - option.min), 0, 1, 0)
  578.     end
  579.    
  580.     local sliding
  581.     local inContact
  582.     main.InputBegan:connect(function(input)
  583.         if input.UserInputType == Enum.UserInputType.MouseButton1 then
  584.             tweenService:Create(fill, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(255, 65, 65)}):Play()
  585.             tweenService:Create(circle, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Size = UDim2.new(3.5, 0, 3.5, 0), ImageColor3 = Color3.fromRGB(255, 65, 65)}):Play()
  586.             sliding = true
  587.             option:SetValue(option.min + ((input.Position.X - slider.AbsolutePosition.X) / slider.AbsoluteSize.X) * (option.max - option.min))
  588.         end
  589.         if input.UserInputType == Enum.UserInputType.MouseMovement then
  590.             inContact = true
  591.             if not sliding then
  592.                 tweenService:Create(fill, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(100, 100, 100)}):Play()
  593.                 tweenService:Create(circle, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Size = UDim2.new(2.8, 0, 2.8, 0), ImageColor3 = Color3.fromRGB(100, 100, 100)}):Play()
  594.             end
  595.         end
  596.     end)
  597.    
  598.     inputService.InputChanged:connect(function(input)
  599.         if input.UserInputType == Enum.UserInputType.MouseMovement and sliding then
  600.             option:SetValue(option.min + ((input.Position.X - slider.AbsolutePosition.X) / slider.AbsoluteSize.X) * (option.max - option.min))
  601.         end
  602.     end)
  603.  
  604.     main.InputEnded:connect(function(input)
  605.         if input.UserInputType == Enum.UserInputType.MouseButton1 then
  606.             sliding = false
  607.             if inContact then
  608.                 tweenService:Create(fill, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(100, 100, 100)}):Play()
  609.                 tweenService:Create(circle, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Size = UDim2.new(2.8, 0, 2.8, 0), ImageColor3 = Color3.fromRGB(100, 100, 100)}):Play()
  610.             else
  611.                 tweenService:Create(fill, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(60, 60, 60)}):Play()
  612.                 tweenService:Create(circle, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Size = UDim2.new(0, 0, 0, 0), ImageColor3 = Color3.fromRGB(60, 60, 60)}):Play()
  613.             end
  614.         end
  615.         if input.UserInputType == Enum.UserInputType.MouseMovement then
  616.             inContact = false
  617.             inputvalue:ReleaseFocus()
  618.             if not sliding then
  619.                 tweenService:Create(fill, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(60, 60, 60)}):Play()
  620.                 tweenService:Create(circle, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Size = UDim2.new(0, 0, 0, 0), ImageColor3 = Color3.fromRGB(60, 60, 60)}):Play()
  621.             end
  622.         end
  623.     end)
  624.  
  625.     inputvalue.FocusLost:connect(function()
  626.         tweenService:Create(circle, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Size = UDim2.new(0, 0, 0, 0), ImageColor3 = Color3.fromRGB(60, 60, 60)}):Play()
  627.         option:SetValue(tonumber(inputvalue.Text) or option.value)
  628.     end)
  629.  
  630.     function option:SetValue(value)
  631.         value = round(value, option.float)
  632.         value = math.clamp(value, self.min, self.max)
  633.         circle:TweenPosition(UDim2.new((value - self.min) / (self.max - self.min), 0, 0.5, 0), "Out", "Quad", 0.1, true)
  634.         if self.min >= 0 then
  635.             fill:TweenSize(UDim2.new((value - self.min) / (self.max - self.min), 0, 1, 0), "Out", "Quad", 0.1, true)
  636.         else
  637.             fill:TweenPosition(UDim2.new((0 - self.min) / (self.max - self.min), 0, 0, 0), "Out", "Quad", 0.1, true)
  638.             fill:TweenSize(UDim2.new(value / (self.max - self.min), 0, 1, 0), "Out", "Quad", 0.1, true)
  639.         end
  640.         library.flags[self.flag] = value
  641.         self.value = value
  642.         inputvalue.Text = value
  643.         self.callback(value)
  644.     end
  645. end
  646.  
  647. local function createList(option, parent, holder)
  648.     local valueCount = 0
  649.    
  650.     local main = library:Create("Frame", {
  651.         LayoutOrder = option.position,
  652.         Size = UDim2.new(1, 0, 0, 52),
  653.         BackgroundTransparency = 1,
  654.         Parent = parent.content
  655.     })
  656.    
  657.     local round = library:Create("ImageLabel", {
  658.         Position = UDim2.new(0, 6, 0, 4),
  659.         Size = UDim2.new(1, -12, 1, -10),
  660.         BackgroundTransparency = 1,
  661.         Image = "rbxassetid://3570695787",
  662.         ImageColor3 = Color3.fromRGB(40, 40, 40),
  663.         ScaleType = Enum.ScaleType.Slice,
  664.         SliceCenter = Rect.new(100, 100, 100, 100),
  665.         SliceScale = 0.02,
  666.         Parent = main
  667.     })
  668.    
  669.     local title = library:Create("TextLabel", {
  670.         Position = UDim2.new(0, 12, 0, 8),
  671.         Size = UDim2.new(1, -24, 0, 14),
  672.         BackgroundTransparency = 1,
  673.         Text = option.text,
  674.         TextSize = 14,
  675.         Font = Enum.Font.GothamBold,
  676.         TextColor3 = Color3.fromRGB(140, 140, 140),
  677.         TextXAlignment = Enum.TextXAlignment.Left,
  678.         Parent = main
  679.     })
  680.    
  681.     local listvalue = library:Create("TextLabel", {
  682.         Position = UDim2.new(0, 12, 0, 20),
  683.         Size = UDim2.new(1, -24, 0, 24),
  684.         BackgroundTransparency = 1,
  685.         Text = option.value,
  686.         TextSize = 18,
  687.         Font = Enum.Font.Gotham,
  688.         TextColor3 = Color3.fromRGB(255, 255, 255),
  689.         TextXAlignment = Enum.TextXAlignment.Left,
  690.         Parent = main
  691.     })
  692.    
  693.     library:Create("ImageLabel", {
  694.         Position = UDim2.new(1, -16, 0, 16),
  695.         Size = UDim2.new(-1, 32, 1, -32),
  696.         SizeConstraint = Enum.SizeConstraint.RelativeYY,
  697.         Rotation = 90,
  698.         BackgroundTransparency = 1,
  699.         Image = "rbxassetid://4918373417",
  700.         ImageColor3 = Color3.fromRGB(140, 140, 140),
  701.         ScaleType = Enum.ScaleType.Fit,
  702.         Parent = round
  703.     })
  704.    
  705.     option.mainHolder = library:Create("ImageButton", {
  706.         ZIndex = 3,
  707.         Size = UDim2.new(0, 240, 0, 52),
  708.         BackgroundTransparency = 1,
  709.         Image = "rbxassetid://3570695787",
  710.         ImageTransparency = 1,
  711.         ImageColor3 = Color3.fromRGB(30, 30, 30),
  712.         ScaleType = Enum.ScaleType.Slice,
  713.         SliceCenter = Rect.new(100, 100, 100, 100),
  714.         SliceScale = 0.02,
  715.         Visible = false,
  716.         Parent = library.base
  717.     })
  718.    
  719.     local content = library:Create("ScrollingFrame", {
  720.         ZIndex = 3,
  721.         Size = UDim2.new(1, 0, 1, 0),
  722.         BackgroundTransparency = 1,
  723.         BorderSizePixel = 0,
  724.         ScrollBarImageColor3 = Color3.fromRGB(),
  725.         ScrollBarThickness = 0,
  726.         ScrollingDirection = Enum.ScrollingDirection.Y,
  727.         Parent = option.mainHolder
  728.     })
  729.    
  730.     library:Create("UIPadding", {
  731.         PaddingTop = UDim.new(0, 6),
  732.         Parent = content
  733.     })
  734.    
  735.     local layout = library:Create("UIListLayout", {
  736.         Parent = content
  737.     })
  738.    
  739.     layout.Changed:connect(function()
  740.         option.mainHolder.Size = UDim2.new(0, 240, 0, (valueCount > 4 and (4 * 40) or layout.AbsoluteContentSize.Y) + 12)
  741.         content.CanvasSize = UDim2.new(0, 0, 0, layout.AbsoluteContentSize.Y + 12)
  742.     end)
  743.    
  744.     local inContact
  745.     round.InputBegan:connect(function(input)
  746.         if input.UserInputType == Enum.UserInputType.MouseButton1 then
  747.             if library.activePopup then
  748.                 library.activePopup:Close()
  749.             end
  750.             local position = main.AbsolutePosition
  751.             option.mainHolder.Position = UDim2.new(0, position.X - 5, 0, position.Y - 10)
  752.             option.open = true
  753.             option.mainHolder.Visible = true
  754.             library.activePopup = option
  755.             content.ScrollBarThickness = 6
  756.             tweenService:Create(option.mainHolder, TweenInfo.new(0.3, Enum.EasingStyle.Quint, Enum.EasingDirection.Out), {ImageTransparency = 0, Position = UDim2.new(0, position.X - 5, 0, position.Y - 4)}):Play()
  757.             tweenService:Create(option.mainHolder, TweenInfo.new(0.4, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false, 0.1), {Position = UDim2.new(0, position.X - 5, 0, position.Y + 1)}):Play()
  758.             for _,label in next, content:GetChildren() do
  759.                 if label:IsA"TextLabel" then
  760.                     tweenService:Create(label, TweenInfo.new(0.4, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundTransparency = 0, TextTransparency = 0}):Play()
  761.                 end
  762.             end
  763.         end
  764.         if input.UserInputType == Enum.UserInputType.MouseMovement then
  765.             inContact = true
  766.             if not option.open then
  767.                 tweenService:Create(round, TweenInfo.new(0.1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(60, 60, 60)}):Play()
  768.             end
  769.         end
  770.     end)
  771.    
  772.     round.InputEnded:connect(function(input)
  773.         if input.UserInputType == Enum.UserInputType.MouseMovement then
  774.             inContact = false
  775.             if not option.open then
  776.                 tweenService:Create(round, TweenInfo.new(0.1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(40, 40, 40)}):Play()
  777.             end
  778.         end
  779.     end)
  780.    
  781.     function option:AddValue(value)
  782.         valueCount = valueCount + 1
  783.         local label = library:Create("TextLabel", {
  784.             ZIndex = 3,
  785.             Size = UDim2.new(1, 0, 0, 40),
  786.             BackgroundColor3 = Color3.fromRGB(30, 30, 30),
  787.             BorderSizePixel = 0,
  788.             Text = "    " .. value,
  789.             TextSize = 14,
  790.             TextTransparency = self.open and 0 or 1,
  791.             Font = Enum.Font.Gotham,
  792.             TextColor3 = Color3.fromRGB(255, 255, 255),
  793.             TextXAlignment = Enum.TextXAlignment.Left,
  794.             Parent = content
  795.         })
  796.        
  797.         local inContact
  798.         local clicking
  799.         label.InputBegan:connect(function(input)
  800.             if input.UserInputType == Enum.UserInputType.MouseButton1 then
  801.                 clicking = true
  802.                 tweenService:Create(label, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundColor3 = Color3.fromRGB(10, 10, 10)}):Play()
  803.                 self:SetValue(value)
  804.                 self:Close()
  805.             end
  806.             if input.UserInputType == Enum.UserInputType.MouseMovement then
  807.                 inContact = true
  808.                 if not clicking then
  809.                     tweenService:Create(label, TweenInfo.new(0.1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundColor3 = Color3.fromRGB(20, 20, 20)}):Play()
  810.                 end
  811.             end
  812.         end)
  813.        
  814.         label.InputEnded:connect(function(input)
  815.             if input.UserInputType == Enum.UserInputType.MouseButton1 then
  816.                 clicking = false
  817.                 tweenService:Create(label, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundColor3 = inContact and Color3.fromRGB(20, 20, 20) or Color3.fromRGB(30, 30, 30)}):Play()
  818.             end
  819.             if input.UserInputType == Enum.UserInputType.MouseMovement then
  820.                 inContact = false
  821.                 if not clicking then
  822.                     tweenService:Create(label, TweenInfo.new(0.1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundColor3 = Color3.fromRGB(30, 30, 30)}):Play()
  823.                 end
  824.             end
  825.         end)
  826.     end
  827.  
  828.     if not table.find(option.values, option.value) then
  829.         option:AddValue(option.value)
  830.     end
  831.    
  832.     for _, value in next, option.values do
  833.         option:AddValue(tostring(value))
  834.     end
  835.    
  836.     function option:RemoveValue(value)
  837.         for _,label in next, content:GetChildren() do
  838.             if label:IsA"TextLabel" and label.Text == " " .. value then
  839.                 label:Destroy()
  840.                 valueCount = valueCount - 1
  841.                 break
  842.             end
  843.         end
  844.         if self.value == value then
  845.             self:SetValue("")
  846.         end
  847.     end
  848.    
  849.     function option:SetValue(value)
  850.         library.flags[self.flag] = tostring(value)
  851.         self.value = tostring(value)
  852.         listvalue.Text = self.value
  853.         self.callback(value)
  854.     end
  855.    
  856.     function option:Close()
  857.         library.activePopup = nil
  858.         self.open = false
  859.         content.ScrollBarThickness = 0
  860.         local position = main.AbsolutePosition
  861.         tweenService:Create(round, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = inContact and Color3.fromRGB(60, 60, 60) or Color3.fromRGB(40, 40, 40)}):Play()
  862.         tweenService:Create(self.mainHolder, TweenInfo.new(0.3, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageTransparency = 1, Position = UDim2.new(0, position.X - 5, 0, position.Y -10)}):Play()
  863.         for _,label in next, content:GetChildren() do
  864.             if label:IsA"TextLabel" then
  865.                 tweenService:Create(label, TweenInfo.new(0.3, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundTransparency = 1, TextTransparency = 1}):Play()
  866.             end
  867.         end
  868.         wait(0.3)
  869.         --delay(0.3, function()
  870.             if not self.open then
  871.                 self.mainHolder.Visible = false
  872.             end
  873.         --end)
  874.     end
  875.  
  876.     return option
  877. end
  878.  
  879. local function createBox(option, parent)
  880.     local main = library:Create("Frame", {
  881.         LayoutOrder = option.position,
  882.         Size = UDim2.new(1, 0, 0, 52),
  883.         BackgroundTransparency = 1,
  884.         Parent = parent.content
  885.     })
  886.    
  887.     local outline = library:Create("ImageLabel", {
  888.         Position = UDim2.new(0, 6, 0, 4),
  889.         Size = UDim2.new(1, -12, 1, -10),
  890.         BackgroundTransparency = 1,
  891.         Image = "rbxassetid://3570695787",
  892.         ImageColor3 = Color3.fromRGB(60, 60, 60),
  893.         ScaleType = Enum.ScaleType.Slice,
  894.         SliceCenter = Rect.new(100, 100, 100, 100),
  895.         SliceScale = 0.02,
  896.         Parent = main
  897.     })
  898.    
  899.     local round = library:Create("ImageLabel", {
  900.         Position = UDim2.new(0, 8, 0, 6),
  901.         Size = UDim2.new(1, -16, 1, -14),
  902.         BackgroundTransparency = 1,
  903.         Image = "rbxassetid://3570695787",
  904.         ImageColor3 = Color3.fromRGB(20, 20, 20),
  905.         ScaleType = Enum.ScaleType.Slice,
  906.         SliceCenter = Rect.new(100, 100, 100, 100),
  907.         SliceScale = 0.01,
  908.         Parent = main
  909.     })
  910.    
  911.     local title = library:Create("TextLabel", {
  912.         Position = UDim2.new(0, 12, 0, 8),
  913.         Size = UDim2.new(1, -24, 0, 14),
  914.         BackgroundTransparency = 1,
  915.         Text = option.text,
  916.         TextSize = 14,
  917.         Font = Enum.Font.GothamBold,
  918.         TextColor3 = Color3.fromRGB(100, 100, 100),
  919.         TextXAlignment = Enum.TextXAlignment.Left,
  920.         Parent = main
  921.     })
  922.    
  923.     local inputvalue = library:Create("TextBox", {
  924.         Position = UDim2.new(0, 12, 0, 20),
  925.         Size = UDim2.new(1, -24, 0, 24),
  926.         BackgroundTransparency = 1,
  927.         Text = option.value,
  928.         TextSize = 18,
  929.         Font = Enum.Font.Gotham,
  930.         TextColor3 = Color3.fromRGB(255, 255, 255),
  931.         TextXAlignment = Enum.TextXAlignment.Left,
  932.         TextWrapped = true,
  933.         Parent = main
  934.     })
  935.    
  936.     local inContact
  937.     local focused
  938.     main.InputBegan:connect(function(input)
  939.         if input.UserInputType == Enum.UserInputType.MouseButton1 then
  940.             if not focused then inputvalue:CaptureFocus() end
  941.         end
  942.         if input.UserInputType == Enum.UserInputType.MouseMovement then
  943.             inContact = true
  944.             if not focused then
  945.                 tweenService:Create(outline, TweenInfo.new(0.1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(100, 100, 100)}):Play()
  946.             end
  947.         end
  948.     end)
  949.    
  950.     main.InputEnded:connect(function(input)
  951.         if input.UserInputType == Enum.UserInputType.MouseMovement then
  952.             inContact = false
  953.             if not focused then
  954.                 tweenService:Create(outline, TweenInfo.new(0.1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(60, 60, 60)}):Play()
  955.             end
  956.         end
  957.     end)
  958.    
  959.     inputvalue.Focused:connect(function()
  960.         focused = true
  961.         tweenService:Create(outline, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(255, 65, 65)}):Play()
  962.     end)
  963.    
  964.     inputvalue.FocusLost:connect(function(enter)
  965.         focused = false
  966.         tweenService:Create(outline, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(60, 60, 60)}):Play()
  967.         option:SetValue(inputvalue.Text, enter)
  968.     end)
  969.    
  970.     function option:SetValue(value, enter)
  971.         library.flags[self.flag] = tostring(value)
  972.         self.value = tostring(value)
  973.         inputvalue.Text = self.value
  974.         self.callback(value, enter)
  975.     end
  976. end
  977.  
  978. local function createColorPickerWindow(option)
  979.     option.mainHolder = library:Create("ImageButton", {
  980.         ZIndex = 3,
  981.         Size = UDim2.new(0, 240, 0, 180),
  982.         BackgroundTransparency = 1,
  983.         Image = "rbxassetid://3570695787",
  984.         ImageTransparency = 1,
  985.         ImageColor3 = Color3.fromRGB(30, 30, 30),
  986.         ScaleType = Enum.ScaleType.Slice,
  987.         SliceCenter = Rect.new(100, 100, 100, 100),
  988.         SliceScale = 0.02,
  989.         Parent = library.base
  990.     })
  991.        
  992.     local hue, sat, val = Color3.toHSV(option.color)
  993.     hue, sat, val = hue == 0 and 1 or hue, sat + 0.005, val - 0.005
  994.     local editinghue
  995.     local editingsatval
  996.     local currentColor = option.color
  997.     local previousColors = {[1] = option.color}
  998.     local originalColor = option.color
  999.     local rainbowEnabled
  1000.     local rainbowLoop
  1001.    
  1002.     function option:updateVisuals(Color)
  1003.         currentColor = Color
  1004.         self.visualize2.ImageColor3 = Color
  1005.         hue, sat, val = Color3.toHSV(Color)
  1006.         hue = hue == 0 and 1 or hue
  1007.         self.satval.BackgroundColor3 = Color3.fromHSV(hue, 1, 1)
  1008.         self.hueSlider.Position = UDim2.new(1 - hue, 0, 0, 0)
  1009.         self.satvalSlider.Position = UDim2.new(sat, 0, 1 - val, 0)
  1010.     end
  1011.    
  1012.     option.hue = library:Create("ImageLabel", {
  1013.         ZIndex = 3,
  1014.         AnchorPoint = Vector2.new(0, 1),
  1015.         Position = UDim2.new(0, 8, 1, -8),
  1016.         Size = UDim2.new(1, -100, 0, 22),
  1017.         BackgroundTransparency = 1,
  1018.         Image = "rbxassetid://3570695787",
  1019.         ImageTransparency = 1,
  1020.         ScaleType = Enum.ScaleType.Slice,
  1021.         SliceCenter = Rect.new(100, 100, 100, 100),
  1022.         SliceScale = 0.02,
  1023.         Parent = option.mainHolder
  1024.     })
  1025.    
  1026.     local Gradient = library:Create("UIGradient", {
  1027.         Color = ColorSequence.new({
  1028.             ColorSequenceKeypoint.new(0, Color3.fromRGB(255, 0, 0)),
  1029.             ColorSequenceKeypoint.new(0.157, Color3.fromRGB(255, 0, 255)),
  1030.             ColorSequenceKeypoint.new(0.323, Color3.fromRGB(0, 0, 255)),
  1031.             ColorSequenceKeypoint.new(0.488, Color3.fromRGB(0, 255, 255)),
  1032.             ColorSequenceKeypoint.new(0.66, Color3.fromRGB(0, 255, 0)),
  1033.             ColorSequenceKeypoint.new(0.817, Color3.fromRGB(255, 255, 0)),
  1034.             ColorSequenceKeypoint.new(1, Color3.fromRGB(255, 0, 0)),
  1035.         }),
  1036.         Parent = option.hue
  1037.     })
  1038.    
  1039.     option.hueSlider = library:Create("Frame", {
  1040.         ZIndex = 3,
  1041.         Position = UDim2.new(1 - hue, 0, 0, 0),
  1042.         Size = UDim2.new(0, 2, 1, 0),
  1043.         BackgroundTransparency = 1,
  1044.         BackgroundColor3 = Color3.fromRGB(30, 30, 30),
  1045.         BorderColor3 = Color3.fromRGB(255, 255, 255),
  1046.         Parent = option.hue
  1047.     })
  1048.    
  1049.     option.hue.InputBegan:connect(function(Input)
  1050.         if Input.UserInputType == Enum.UserInputType.MouseButton1 then
  1051.             editinghue = true
  1052.             X = (option.hue.AbsolutePosition.X + option.hue.AbsoluteSize.X) - option.hue.AbsolutePosition.X
  1053.             X = (Input.Position.X - option.hue.AbsolutePosition.X) / X
  1054.             X = X < 0 and 0 or X > 0.995 and 0.995 or X
  1055.             option:updateVisuals(Color3.fromHSV(1 - X, sat, val))
  1056.         end
  1057.     end)
  1058.    
  1059.     inputService.InputChanged:connect(function(Input)
  1060.         if Input.UserInputType == Enum.UserInputType.MouseMovement and editinghue then
  1061.             X = (option.hue.AbsolutePosition.X + option.hue.AbsoluteSize.X) - option.hue.AbsolutePosition.X
  1062.             X = (Input.Position.X - option.hue.AbsolutePosition.X) / X
  1063.             X = X <= 0 and 0 or X >= 0.995 and 0.995 or X
  1064.             option:updateVisuals(Color3.fromHSV(1 - X, sat, val))
  1065.         end
  1066.     end)
  1067.    
  1068.     option.hue.InputEnded:connect(function(Input)
  1069.         if Input.UserInputType == Enum.UserInputType.MouseButton1 then
  1070.             editinghue = false
  1071.         end
  1072.     end)
  1073.    
  1074.     option.satval = library:Create("ImageLabel", {
  1075.         ZIndex = 3,
  1076.         Position = UDim2.new(0, 8, 0, 8),
  1077.         Size = UDim2.new(1, -100, 1, -42),
  1078.         BackgroundTransparency = 1,
  1079.         BackgroundColor3 = Color3.fromHSV(hue, 1, 1),
  1080.         BorderSizePixel = 0,
  1081.         Image = "rbxassetid://4155801252",
  1082.         ImageTransparency = 1,
  1083.         ClipsDescendants = true,
  1084.         Parent = option.mainHolder
  1085.     })
  1086.    
  1087.     option.satvalSlider = library:Create("Frame", {
  1088.         ZIndex = 3,
  1089.         AnchorPoint = Vector2.new(0.5, 0.5),
  1090.         Position = UDim2.new(sat, 0, 1 - val, 0),
  1091.         Size = UDim2.new(0, 4, 0, 4),
  1092.         Rotation = 45,
  1093.         BackgroundTransparency = 1,
  1094.         BackgroundColor3 = Color3.fromRGB(255, 255, 255),
  1095.         Parent = option.satval
  1096.     })
  1097.    
  1098.     option.satval.InputBegan:connect(function(Input)
  1099.         if Input.UserInputType == Enum.UserInputType.MouseButton1 then
  1100.             editingsatval = true
  1101.             X = (option.satval.AbsolutePosition.X + option.satval.AbsoluteSize.X) - option.satval.AbsolutePosition.X
  1102.             Y = (option.satval.AbsolutePosition.Y + option.satval.AbsoluteSize.Y) - option.satval.AbsolutePosition.Y
  1103.             X = (Input.Position.X - option.satval.AbsolutePosition.X) / X
  1104.             Y = (Input.Position.Y - option.satval.AbsolutePosition.Y) / Y
  1105.             X = X <= 0.005 and 0.005 or X >= 1 and 1 or X
  1106.             Y = Y <= 0 and 0 or Y >= 0.995 and 0.995 or Y
  1107.             option:updateVisuals(Color3.fromHSV(hue, X, 1 - Y))
  1108.         end
  1109.     end)
  1110.    
  1111.     inputService.InputChanged:connect(function(Input)
  1112.         if Input.UserInputType == Enum.UserInputType.MouseMovement and editingsatval then
  1113.             X = (option.satval.AbsolutePosition.X + option.satval.AbsoluteSize.X) - option.satval.AbsolutePosition.X
  1114.             Y = (option.satval.AbsolutePosition.Y + option.satval.AbsoluteSize.Y) - option.satval.AbsolutePosition.Y
  1115.             X = (Input.Position.X - option.satval.AbsolutePosition.X) / X
  1116.             Y = (Input.Position.Y - option.satval.AbsolutePosition.Y) / Y
  1117.             X = X <= 0.005 and 0.005 or X >= 1 and 1 or X
  1118.             Y = Y <= 0 and 0 or Y >= 0.995 and 0.995 or Y
  1119.             option:updateVisuals(Color3.fromHSV(hue, X, 1 - Y))
  1120.         end
  1121.     end)
  1122.    
  1123.     option.satval.InputEnded:connect(function(Input)
  1124.         if Input.UserInputType == Enum.UserInputType.MouseButton1 then
  1125.             editingsatval = false
  1126.         end
  1127.     end)
  1128.    
  1129.     option.visualize2 = library:Create("ImageLabel", {
  1130.         ZIndex = 3,
  1131.         Position = UDim2.new(1, -8, 0, 8),
  1132.         Size = UDim2.new(0, -80, 0, 80),
  1133.         BackgroundTransparency = 1,
  1134.         Image = "rbxassetid://3570695787",
  1135.         ImageColor3 = currentColor,
  1136.         ScaleType = Enum.ScaleType.Slice,
  1137.         SliceCenter = Rect.new(100, 100, 100, 100),
  1138.         SliceScale = 0.02,
  1139.         Parent = option.mainHolder
  1140.     })
  1141.    
  1142.     option.resetColor = library:Create("ImageLabel", {
  1143.         ZIndex = 3,
  1144.         Position = UDim2.new(1, -8, 0, 92),
  1145.         Size = UDim2.new(0, -80, 0, 18),
  1146.         BackgroundTransparency = 1,
  1147.         Image = "rbxassetid://3570695787",
  1148.         ImageTransparency = 1,
  1149.         ImageColor3 = Color3.fromRGB(20, 20, 20),
  1150.         ScaleType = Enum.ScaleType.Slice,
  1151.         SliceCenter = Rect.new(100, 100, 100, 100),
  1152.         SliceScale = 0.02,
  1153.         Parent = option.mainHolder
  1154.     })
  1155.    
  1156.     option.resetText = library:Create("TextLabel", {
  1157.         ZIndex = 3,
  1158.         Size = UDim2.new(1, 0, 1, 0),
  1159.         BackgroundTransparency = 1,
  1160.         Text = "Reset",
  1161.         TextTransparency = 1,
  1162.         Font = Enum.Font.Code,
  1163.         TextSize = 15,
  1164.         TextColor3 = Color3.fromRGB(255, 255, 255),
  1165.         Parent = option.resetColor
  1166.     })
  1167.    
  1168.     option.resetColor.InputBegan:connect(function(Input)
  1169.         if Input.UserInputType == Enum.UserInputType.MouseButton1 and not rainbowEnabled then
  1170.             previousColors = {originalColor}
  1171.             option:SetColor(originalColor)
  1172.         end
  1173.         if Input.UserInputType == Enum.UserInputType.MouseMovement and not dragging then
  1174.             tweenService:Create(option.resetColor, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(10, 10, 10)}):Play()
  1175.         end
  1176.     end)
  1177.    
  1178.     option.resetColor.InputEnded:connect(function(Input)
  1179.         if Input.UserInputType == Enum.UserInputType.MouseMovement and not dragging then
  1180.             tweenService:Create(option.resetColor, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(20, 20, 20)}):Play()
  1181.         end
  1182.     end)
  1183.    
  1184.     option.undoColor = library:Create("ImageLabel", {
  1185.         ZIndex = 3,
  1186.         Position = UDim2.new(1, -8, 0, 112),
  1187.         Size = UDim2.new(0, -80, 0, 18),
  1188.         BackgroundTransparency = 1,
  1189.         Image = "rbxassetid://3570695787",
  1190.         ImageTransparency = 1,
  1191.         ImageColor3 = Color3.fromRGB(20, 20, 20),
  1192.         ScaleType = Enum.ScaleType.Slice,
  1193.         SliceCenter = Rect.new(100, 100, 100, 100),
  1194.         SliceScale = 0.02,
  1195.         Parent = option.mainHolder
  1196.     })
  1197.    
  1198.     option.undoText = library:Create("TextLabel", {
  1199.         ZIndex = 3,
  1200.         Size = UDim2.new(1, 0, 1, 0),
  1201.         BackgroundTransparency = 1,
  1202.         Text = "Undo",
  1203.         TextTransparency = 1,
  1204.         Font = Enum.Font.Code,
  1205.         TextSize = 15,
  1206.         TextColor3 = Color3.fromRGB(255, 255, 255),
  1207.         Parent = option.undoColor
  1208.     })
  1209.    
  1210.     option.undoColor.InputBegan:connect(function(Input)
  1211.         if Input.UserInputType == Enum.UserInputType.MouseButton1 and not rainbowEnabled then
  1212.             local Num = #previousColors == 1 and 0 or 1
  1213.             option:SetColor(previousColors[#previousColors - Num])
  1214.             if #previousColors ~= 1 then
  1215.                 table.remove(previousColors, #previousColors)
  1216.             end
  1217.         end
  1218.         if Input.UserInputType == Enum.UserInputType.MouseMovement and not dragging then
  1219.             tweenService:Create(option.undoColor, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(10, 10, 10)}):Play()
  1220.         end
  1221.     end)
  1222.    
  1223.     option.undoColor.InputEnded:connect(function(Input)
  1224.         if Input.UserInputType == Enum.UserInputType.MouseMovement and not dragging then
  1225.             tweenService:Create(option.undoColor, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(20, 20, 20)}):Play()
  1226.         end
  1227.     end)
  1228.    
  1229.     option.setColor = library:Create("ImageLabel", {
  1230.         ZIndex = 3,
  1231.         Position = UDim2.new(1, -8, 0, 132),
  1232.         Size = UDim2.new(0, -80, 0, 18),
  1233.         BackgroundTransparency = 1,
  1234.         Image = "rbxassetid://3570695787",
  1235.         ImageTransparency = 1,
  1236.         ImageColor3 = Color3.fromRGB(20, 20, 20),
  1237.         ScaleType = Enum.ScaleType.Slice,
  1238.         SliceCenter = Rect.new(100, 100, 100, 100),
  1239.         SliceScale = 0.02,
  1240.         Parent = option.mainHolder
  1241.     })
  1242.    
  1243.     option.setText = library:Create("TextLabel", {
  1244.         ZIndex = 3,
  1245.         Size = UDim2.new(1, 0, 1, 0),
  1246.         BackgroundTransparency = 1,
  1247.         Text = "Set",
  1248.         TextTransparency = 1,
  1249.         Font = Enum.Font.Code,
  1250.         TextSize = 15,
  1251.         TextColor3 = Color3.fromRGB(255, 255, 255),
  1252.         Parent = option.setColor
  1253.     })
  1254.    
  1255.     option.setColor.InputBegan:connect(function(Input)
  1256.         if Input.UserInputType == Enum.UserInputType.MouseButton1 and not rainbowEnabled then
  1257.             table.insert(previousColors, currentColor)
  1258.             option:SetColor(currentColor)
  1259.         end
  1260.         if Input.UserInputType == Enum.UserInputType.MouseMovement and not dragging then
  1261.             tweenService:Create(option.setColor, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(10, 10, 10)}):Play()
  1262.         end
  1263.     end)
  1264.    
  1265.     option.setColor.InputEnded:connect(function(Input)
  1266.         if Input.UserInputType == Enum.UserInputType.MouseMovement and not dragging then
  1267.             tweenService:Create(option.setColor, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(20, 20, 20)}):Play()
  1268.         end
  1269.     end)
  1270.    
  1271.     option.rainbow = library:Create("ImageLabel", {
  1272.         ZIndex = 3,
  1273.         Position = UDim2.new(1, -8, 0, 152),
  1274.         Size = UDim2.new(0, -80, 0, 18),
  1275.         BackgroundTransparency = 1,
  1276.         Image = "rbxassetid://3570695787",
  1277.         ImageTransparency = 1,
  1278.         ImageColor3 = Color3.fromRGB(20, 20, 20),
  1279.         ScaleType = Enum.ScaleType.Slice,
  1280.         SliceCenter = Rect.new(100, 100, 100, 100),
  1281.         SliceScale = 0.02,
  1282.         Parent = option.mainHolder
  1283.     })
  1284.    
  1285.     option.rainbowText = library:Create("TextLabel", {
  1286.         ZIndex = 3,
  1287.         Size = UDim2.new(1, 0, 1, 0),
  1288.         BackgroundTransparency = 1,
  1289.         Text = "Rainbow",
  1290.         TextTransparency = 1,
  1291.         Font = Enum.Font.Code,
  1292.         TextSize = 15,
  1293.         TextColor3 = Color3.fromRGB(255, 255, 255),
  1294.         Parent = option.rainbow
  1295.     })
  1296.    
  1297.     option.rainbow.InputBegan:connect(function(Input)
  1298.         if Input.UserInputType == Enum.UserInputType.MouseButton1 then
  1299.             rainbowEnabled = not rainbowEnabled
  1300.             if rainbowEnabled then
  1301.                 rainbowLoop = runService.Heartbeat:connect(function()
  1302.                     option:SetColor(chromaColor)
  1303.                     option.rainbowText.TextColor3 = chromaColor
  1304.                 end)
  1305.             else
  1306.                 rainbowLoop:Disconnect()
  1307.                 option:SetColor(previousColors[#previousColors])
  1308.                 option.rainbowText.TextColor3 = Color3.fromRGB(255, 255, 255)
  1309.             end
  1310.         end
  1311.         if Input.UserInputType == Enum.UserInputType.MouseMovement and not dragging then
  1312.             tweenService:Create(option.rainbow, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(10, 10, 10)}):Play()
  1313.         end
  1314.     end)
  1315.    
  1316.     option.rainbow.InputEnded:connect(function(Input)
  1317.         if Input.UserInputType == Enum.UserInputType.MouseMovement and not dragging then
  1318.             tweenService:Create(option.rainbow, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(20, 20, 20)}):Play()
  1319.         end
  1320.     end)
  1321.    
  1322.     return option
  1323. end
  1324.  
  1325. local function createColor(option, parent, holder)
  1326.     option.main = library:Create("TextLabel", {
  1327.         LayoutOrder = option.position,
  1328.         Size = UDim2.new(1, 0, 0, 31),
  1329.         BackgroundTransparency = 1,
  1330.         Text = " " .. option.text,
  1331.         TextSize = 17,
  1332.         Font = Enum.Font.Gotham,
  1333.         TextColor3 = Color3.fromRGB(255, 255, 255),
  1334.         TextXAlignment = Enum.TextXAlignment.Left,
  1335.         Parent = parent.content
  1336.     })
  1337.    
  1338.     local colorBoxOutline = library:Create("ImageLabel", {
  1339.         Position = UDim2.new(1, -6, 0, 4),
  1340.         Size = UDim2.new(-1, 10, 1, -10),
  1341.         SizeConstraint = Enum.SizeConstraint.RelativeYY,
  1342.         BackgroundTransparency = 1,
  1343.         Image = "rbxassetid://3570695787",
  1344.         ImageColor3 = Color3.fromRGB(100, 100, 100),
  1345.         ScaleType = Enum.ScaleType.Slice,
  1346.         SliceCenter = Rect.new(100, 100, 100, 100),
  1347.         SliceScale = 0.02,
  1348.         Parent = option.main
  1349.     })
  1350.    
  1351.     option.visualize = library:Create("ImageLabel", {
  1352.         Position = UDim2.new(0, 2, 0, 2),
  1353.         Size = UDim2.new(1, -4, 1, -4),
  1354.         BackgroundTransparency = 1,
  1355.         Image = "rbxassetid://3570695787",
  1356.         ImageColor3 = option.color,
  1357.         ScaleType = Enum.ScaleType.Slice,
  1358.         SliceCenter = Rect.new(100, 100, 100, 100),
  1359.         SliceScale = 0.02,
  1360.         Parent = colorBoxOutline
  1361.     })
  1362.    
  1363.     local inContact
  1364.     option.main.InputBegan:connect(function(input)
  1365.         if input.UserInputType == Enum.UserInputType.MouseButton1 then
  1366.             if not option.mainHolder then createColorPickerWindow(option) end
  1367.             if library.activePopup then
  1368.                 library.activePopup:Close()
  1369.             end
  1370.             local position = option.main.AbsolutePosition
  1371.             option.mainHolder.Position = UDim2.new(0, position.X - 5, 0, position.Y - 10)
  1372.             option.open = true
  1373.             option.mainHolder.Visible = true
  1374.             library.activePopup = option
  1375.             tweenService:Create(option.mainHolder, TweenInfo.new(0.3, Enum.EasingStyle.Quint, Enum.EasingDirection.Out), {ImageTransparency = 0, Position = UDim2.new(0, position.X - 5, 0, position.Y - 4)}):Play()
  1376.             tweenService:Create(option.mainHolder, TweenInfo.new(0.4, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false, 0.1), {Position = UDim2.new(0, position.X - 5, 0, position.Y + 1)}):Play()
  1377.             tweenService:Create(option.satval, TweenInfo.new(0.3, Enum.EasingStyle.Quint, Enum.EasingDirection.Out), {BackgroundTransparency = 0}):Play()
  1378.             for _,object in next, option.mainHolder:GetDescendants() do
  1379.                 if object:IsA"TextLabel" then
  1380.                     tweenService:Create(object, TweenInfo.new(0.3, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextTransparency = 0}):Play()
  1381.                 elseif object:IsA"ImageLabel" then
  1382.                     tweenService:Create(object, TweenInfo.new(0.3, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageTransparency = 0}):Play()
  1383.                 elseif object:IsA"Frame" then
  1384.                     tweenService:Create(object, TweenInfo.new(0.3, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundTransparency = 0}):Play()
  1385.                 end
  1386.             end
  1387.         end
  1388.         if input.UserInputType == Enum.UserInputType.MouseMovement then
  1389.             inContact = true
  1390.             if not option.open then
  1391.                 tweenService:Create(colorBoxOutline, TweenInfo.new(0.1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(140, 140, 140)}):Play()
  1392.             end
  1393.         end
  1394.     end)
  1395.    
  1396.     option.main.InputEnded:connect(function(input)
  1397.         if input.UserInputType == Enum.UserInputType.MouseMovement then
  1398.             inContact = true
  1399.             if not option.open then
  1400.                 tweenService:Create(colorBoxOutline, TweenInfo.new(0.1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(100, 100, 100)}):Play()
  1401.             end
  1402.         end
  1403.     end)
  1404.    
  1405.     function option:SetColor(newColor)
  1406.         if self.mainHolder then
  1407.             self:updateVisuals(newColor)
  1408.         end
  1409.         self.visualize.ImageColor3 = newColor
  1410.         library.flags[self.flag] = newColor
  1411.         self.color = newColor
  1412.         self.callback(newColor)
  1413.     end
  1414.    
  1415.     function option:Close()
  1416.         library.activePopup = nil
  1417.         self.open = false
  1418.         local position = self.main.AbsolutePosition
  1419.         tweenService:Create(self.mainHolder, TweenInfo.new(0.3, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageTransparency = 1, Position = UDim2.new(0, position.X - 5, 0, position.Y - 10)}):Play()
  1420.         tweenService:Create(self.satval, TweenInfo.new(0.3, Enum.EasingStyle.Quint, Enum.EasingDirection.Out), {BackgroundTransparency = 1}):Play()
  1421.         for _,object in next, self.mainHolder:GetDescendants() do
  1422.             if object:IsA"TextLabel" then
  1423.                 tweenService:Create(object, TweenInfo.new(0.3, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextTransparency = 1}):Play()
  1424.             elseif object:IsA"ImageLabel" then
  1425.                 tweenService:Create(object, TweenInfo.new(0.3, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageTransparency = 1}):Play()
  1426.             elseif object:IsA"Frame" then
  1427.                 tweenService:Create(object, TweenInfo.new(0.3, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundTransparency = 1}):Play()
  1428.             end
  1429.         end
  1430.         delay(0.3, function()
  1431.             if not self.open then
  1432.                 self.mainHolder.Visible = false
  1433.             end
  1434.         end)
  1435.     end
  1436. end
  1437.  
  1438. local function loadOptions(option, holder)
  1439.     for _,newOption in next, option.options do
  1440.         if newOption.type == "label" then
  1441.             createLabel(newOption, option)
  1442.         elseif newOption.type == "toggle" then
  1443.             createToggle(newOption, option)
  1444.         elseif newOption.type == "button" then
  1445.             createButton(newOption, option)
  1446.         elseif newOption.type == "list" then
  1447.             createList(newOption, option, holder)
  1448.         elseif newOption.type == "box" then
  1449.             createBox(newOption, option)
  1450.         elseif newOption.type == "bind" then
  1451.             createBind(newOption, option)
  1452.         elseif newOption.type == "slider" then
  1453.             createSlider(newOption, option)
  1454.         elseif newOption.type == "color" then
  1455.             createColor(newOption, option, holder)
  1456.         elseif newOption.type == "folder" then
  1457.             newOption:init()
  1458.         end
  1459.     end
  1460. end
  1461.  
  1462. local function getFnctions(parent)
  1463.     function parent:AddLabel(option)
  1464.         option = typeof(option) == "table" and option or {}
  1465.         option.text = tostring(option.text)
  1466.         option.type = "label"
  1467.         option.position = #self.options
  1468.         table.insert(self.options, option)
  1469.        
  1470.         return option
  1471.     end
  1472.    
  1473.     function parent:AddToggle(option)
  1474.         option = typeof(option) == "table" and option or {}
  1475.         option.text = tostring(option.text)
  1476.         option.state = typeof(option.state) == "boolean" and option.state or false
  1477.         option.callback = typeof(option.callback) == "function" and option.callback or function() end
  1478.         option.type = "toggle"
  1479.         option.position = #self.options
  1480.         option.flag = option.flag or option.text
  1481.         library.flags[option.flag] = option.state
  1482.         table.insert(self.options, option)
  1483.        
  1484.         return option
  1485.     end
  1486.    
  1487.     function parent:AddButton(option)
  1488.         option = typeof(option) == "table" and option or {}
  1489.         option.text = tostring(option.text)
  1490.         option.callback = typeof(option.callback) == "function" and option.callback or function() end
  1491.         option.type = "button"
  1492.         option.position = #self.options
  1493.         option.flag = option.flag or option.text
  1494.         table.insert(self.options, option)
  1495.        
  1496.         return option
  1497.     end
  1498.    
  1499.     function parent:AddBind(option)
  1500.         option = typeof(option) == "table" and option or {}
  1501.         option.text = tostring(option.text)
  1502.         option.key = (option.key and option.key.Name) or option.key or "F"
  1503.         option.hold = typeof(option.hold) == "boolean" and option.hold or false
  1504.         option.callback = typeof(option.callback) == "function" and option.callback or function() end
  1505.         option.type = "bind"
  1506.         option.position = #self.options
  1507.         option.flag = option.flag or option.text
  1508.         library.flags[option.flag] = option.key
  1509.         table.insert(self.options, option)
  1510.        
  1511.         return option
  1512.     end
  1513.    
  1514.     function parent:AddSlider(option)
  1515.         option = typeof(option) == "table" and option or {}
  1516.         option.text = tostring(option.text)
  1517.         option.min = typeof(option.min) == "number" and option.min or 0
  1518.         option.max = typeof(option.max) == "number" and option.max or 0
  1519.         option.dual = typeof(option.dual) == "boolean" and option.dual or false
  1520.         option.value = math.clamp(typeof(option.value) == "number" and option.value or option.min, option.min, option.max)
  1521.         option.value2 = typeof(option.value2) == "number" and option.value2 or option.max
  1522.         option.callback = typeof(option.callback) == "function" and option.callback or function() end
  1523.         option.float = typeof(option.value) == "number" and option.float or 1
  1524.         option.type = "slider"
  1525.         option.position = #self.options
  1526.         option.flag = option.flag or option.text
  1527.         library.flags[option.flag] = option.value
  1528.         table.insert(self.options, option)
  1529.        
  1530.         return option
  1531.     end
  1532.    
  1533.     function parent:AddList(option)
  1534.         option = typeof(option) == "table" and option or {}
  1535.         option.text = tostring(option.text)
  1536.         option.values = typeof(option.values) == "table" and option.values or {}
  1537.         option.value = tostring(option.value or option.values[1] or "")
  1538.         option.callback = typeof(option.callback) == "function" and option.callback or function() end
  1539.         option.open = false
  1540.         option.type = "list"
  1541.         option.position = #self.options
  1542.         option.flag = option.flag or option.text
  1543.         library.flags[option.flag] = option.value
  1544.         table.insert(self.options, option)
  1545.        
  1546.         return option
  1547.     end
  1548.    
  1549.     function parent:AddBox(option)
  1550.         option = typeof(option) == "table" and option or {}
  1551.         option.text = tostring(option.text)
  1552.         option.value = tostring(option.value or "")
  1553.         option.callback = typeof(option.callback) == "function" and option.callback or function() end
  1554.         option.type = "box"
  1555.         option.position = #self.options
  1556.         option.flag = option.flag or option.text
  1557.         library.flags[option.flag] = option.value
  1558.         table.insert(self.options, option)
  1559.        
  1560.         return option
  1561.     end
  1562.    
  1563.     function parent:AddColor(option)
  1564.         option = typeof(option) == "table" and option or {}
  1565.         option.text = tostring(option.text)
  1566.         option.color = typeof(option.color) == "table" and Color3.new(tonumber(option.color[1]), tonumber(option.color[2]), tonumber(option.color[3])) or option.color or Color3.new(255, 255, 255)
  1567.         option.callback = typeof(option.callback) == "function" and option.callback or function() end
  1568.         option.open = false
  1569.         option.type = "color"
  1570.         option.position = #self.options
  1571.         option.flag = option.flag or option.text
  1572.         library.flags[option.flag] = option.color
  1573.         table.insert(self.options, option)
  1574.        
  1575.         return option
  1576.     end
  1577.    
  1578.     function parent:AddFolder(title)
  1579.         local option = {}
  1580.         option.title = tostring(title)
  1581.         option.options = {}
  1582.         option.open = false
  1583.         option.type = "folder"
  1584.         option.position = #self.options
  1585.         table.insert(self.options, option)
  1586.        
  1587.         getFnctions(option)
  1588.        
  1589.         function option:init()
  1590.             createOptionHolder(self.title, parent.content, self, true)
  1591.             loadOptions(self, parent)
  1592.         end
  1593.        
  1594.         return option
  1595.     end
  1596. end
  1597.  
  1598. function library:CreateWindow(title)
  1599.     local window = {title = tostring(title), options = {}, open = true, canInit = true, init = false, position = #self.windows}
  1600.     getFnctions(window)
  1601.    
  1602.     table.insert(library.windows, window)
  1603.    
  1604.     return window
  1605. end
  1606.  
  1607. local UIToggle
  1608. local UnlockMouse
  1609. function library:Init()
  1610.    
  1611.     self.base = self.base or self:Create("ScreenGui", {
  1612.         Parent = game:GetService("CoreGui")
  1613.     })
  1614.    
  1615.     self.cursor = self.cursor or self:Create("Frame", {
  1616.         ZIndex = 100,
  1617.         AnchorPoint = Vector2.new(0, 0),
  1618.         Size = UDim2.new(0, 5, 0, 5),
  1619.         BackgroundColor3 = Color3.fromRGB(255, 255, 255),
  1620.         Parent = self.base
  1621.     })
  1622.    
  1623.     for _, window in next, self.windows do
  1624.         if window.canInit and not window.init then
  1625.             window.init = true
  1626.             createOptionHolder(window.title, self.base, window)
  1627.             loadOptions(window)
  1628.         end
  1629.     end
  1630. end
  1631.  
  1632. function library:Close()
  1633.     self.open = not self.open
  1634.     self.cursor.Visible = self.open
  1635.     if self.activePopup then
  1636.         self.activePopup:Close()
  1637.     end
  1638.     for _, window in next, self.windows do
  1639.         if window.main then
  1640.             window.main.Visible = self.open
  1641.         end
  1642.     end
  1643. end
  1644.  
  1645. inputService.InputBegan:connect(function(input)
  1646.     if input.UserInputType == Enum.UserInputType.MouseButton1 then
  1647.         if library.activePopup then
  1648.             if input.Position.X < library.activePopup.mainHolder.AbsolutePosition.X or input.Position.Y < library.activePopup.mainHolder.AbsolutePosition.Y then
  1649.                 library.activePopup:Close()
  1650.             end
  1651.         end
  1652.         if library.activePopup then
  1653.             if input.Position.X > library.activePopup.mainHolder.AbsolutePosition.X + library.activePopup.mainHolder.AbsoluteSize.X or input.Position.Y > library.activePopup.mainHolder.AbsolutePosition.Y + library.activePopup.mainHolder.AbsoluteSize.Y then
  1654.                 library.activePopup:Close()
  1655.             end
  1656.         end
  1657.     end
  1658. end)
  1659.  
  1660. inputService.InputChanged:connect(function(input)
  1661.     if input.UserInputType == Enum.UserInputType.MouseMovement and library.cursor then
  1662.         local mouse = inputService:GetMouseLocation() + Vector2.new(0, -36)
  1663.         library.cursor.Position = UDim2.new(0, mouse.X - 2, 0, mouse.Y - 2)
  1664.     end
  1665.     if input == dragInput and dragging then
  1666.         update(input)
  1667.     end
  1668. end)
  1669.  
  1670. return library
Advertisement
Add Comment
Please, Sign In to add comment