Advertisement
HouseV3rm

Turtle's UI Library (Backup)

Oct 21st, 2020
2,325
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 37.08 KB | None | 0 0
  1. local library = {}
  2. local windowCount = 0
  3. local sizes = {}
  4. local listOffset = {}
  5. local windows = {}
  6. local pastSliders = {}
  7. local dropdowns = {}
  8. local dropdownSizes = {}
  9. local destroyed
  10.  
  11. local colorPickers = {}
  12.  
  13. if game.CoreGui:FindFirstChild('TurtleUiLib') then
  14.     game.CoreGui:FindFirstChild('TurtleUiLib'):Destroy()
  15.     destroyed = true
  16. end
  17.  
  18. function Lerp(a, b, c)
  19.     return a + ((b - a) * c)
  20. end
  21.  
  22. local players = game:service('Players');
  23. local player = players.LocalPlayer;
  24. local mouse = player:GetMouse();
  25. local run = game:service('RunService');
  26. local stepped = run.Stepped;
  27. function Dragify(obj)
  28.     spawn(function()
  29.         local minitial;
  30.         local initial;
  31.         local isdragging;
  32.         obj.InputBegan:Connect(function(input)
  33.             if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  34.                 isdragging = true;
  35.                 minitial = input.Position;
  36.                 initial = obj.Position;
  37.                 local con;
  38.                 con = stepped:Connect(function()
  39.                     if isdragging then
  40.                         local delta = Vector3.new(mouse.X, mouse.Y, 0) - minitial;
  41.                         obj.Position = UDim2.new(initial.X.Scale, initial.X.Offset + delta.X, initial.Y.Scale, initial.Y.Offset + delta.Y);
  42.                     else
  43.                         con:Disconnect();
  44.                     end;
  45.                 end);
  46.                 input.Changed:Connect(function()
  47.                     if input.UserInputState == Enum.UserInputState.End then
  48.                         isdragging = false;
  49.                     end;
  50.                 end);
  51.         end;
  52.     end);
  53. end)
  54. end
  55.  
  56. -- Instances:
  57.  
  58. local function protect_gui(obj)
  59. if destroyed then
  60.    obj.Parent = game.CoreGui
  61.    return
  62. end
  63. if syn and syn.protect_gui then
  64. syn.protect_gui(obj)
  65. obj.Parent = game.CoreGui
  66. elseif PROTOSMASHER_LOADED then
  67. obj.Parent = get_hidden_gui()
  68. else
  69. obj.Parent = game.CoreGui
  70. end
  71. end
  72. local TurtleUiLib = Instance.new("ScreenGui")
  73.  
  74. TurtleUiLib.Name = "TurtleUiLib"
  75.  
  76. protect_gui(TurtleUiLib)
  77.  
  78. local xOffset = 20
  79.  
  80. local uis = game:GetService("UserInputService")
  81.  
  82. local keybindConnection
  83.  
  84. function library:Destroy()
  85.     TurtleUiLib:Destroy()
  86.     if keybindConnection then
  87.         keybindConnection:Disconnect()
  88.     end
  89. end
  90. function library:Keybind(key)
  91.     if keybindConnection then keybindConnection:Disconnect() end
  92.     local key = key:upper()
  93.  
  94.     keybindConnection = uis.InputBegan:Connect(function(input, gp)
  95.         if not gp and input.KeyCode == Enum.KeyCode[key] then
  96.             TurtleUiLib.Enabled = not TurtleUiLib.Enabled
  97.         end
  98.     end)
  99. end
  100.  
  101. function library:Window(name)
  102.     windowCount = windowCount + 1
  103.     local winCount = windowCount
  104.     local zindex = winCount * 7
  105.     local UiWindow = Instance.new("Frame")
  106.  
  107.     UiWindow.Name = "UiWindow"
  108.     UiWindow.Parent = TurtleUiLib
  109.     UiWindow.BackgroundColor3 = Color3.fromRGB(0, 151, 230)
  110.     UiWindow.BorderColor3 = Color3.fromRGB(0, 151, 230)
  111.     UiWindow.Position = UDim2.new(0, xOffset, 0, 20)
  112.     UiWindow.Size = UDim2.new(0, 207, 0, 33)
  113.     UiWindow.ZIndex = 4 + zindex
  114.     UiWindow.Active = true
  115.     Dragify(UiWindow)
  116.  
  117.     xOffset = xOffset + 230
  118.  
  119.     local Header = Instance.new("Frame")
  120.     Header.Name = "Header"
  121.     Header.Parent = UiWindow
  122.     Header.BackgroundColor3 = Color3.fromRGB(0, 168, 255)
  123.     Header.BorderColor3 = Color3.fromRGB(0, 168, 255)
  124.     Header.Position = UDim2.new(0, 0, -0.0202544238, 0)
  125.     Header.Size = UDim2.new(0, 207, 0, 26)
  126.     Header.ZIndex = 5 + zindex
  127.  
  128.     local HeaderText = Instance.new("TextLabel")
  129.     HeaderText.Name = "HeaderText"
  130.     HeaderText.Parent = Header
  131.     HeaderText.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
  132.     HeaderText.BackgroundTransparency = 1.000
  133.     HeaderText.Position = UDim2.new(0, 0, -0.0020698905, 0)
  134.     HeaderText.Size = UDim2.new(0, 206, 0, 33)
  135.     HeaderText.ZIndex = 6 + zindex
  136.     HeaderText.Font = Enum.Font.SourceSans
  137.     HeaderText.Text = name or "Window"
  138.     HeaderText.TextColor3 = Color3.fromRGB(47, 54, 64)
  139.     HeaderText.TextSize = 17.000
  140.  
  141.     local Minimise = Instance.new("TextButton")
  142.     local Window = Instance.new("Frame")
  143.     Minimise.Name = "Minimise"
  144.     Minimise.Parent = Header
  145.     Minimise.BackgroundColor3 = Color3.fromRGB(0, 168, 255)
  146.     Minimise.BorderColor3 = Color3.fromRGB(0, 168, 255)
  147.     Minimise.Position = UDim2.new(0, 185, 0, 2)
  148.     Minimise.Size = UDim2.new(0, 22, 0, 22)
  149.     Minimise.ZIndex = 7 + zindex
  150.     Minimise.Font = Enum.Font.SourceSansLight
  151.     Minimise.Text = "_"
  152.     Minimise.TextColor3 = Color3.fromRGB(0, 0, 0)
  153.     Minimise.TextSize = 20.000
  154.     Minimise.MouseButton1Up:connect(function()
  155.         Window.Visible = not Window.Visible
  156.     end)
  157.  
  158.     Window.Name = "Window"
  159.     Window.Parent = Header
  160.     Window.BackgroundColor3 = Color3.fromRGB(47, 54, 64)
  161.     Window.BorderColor3 = Color3.fromRGB(47, 54, 64)
  162.     Window.Position = UDim2.new(0, 0, 0, 0)
  163.     Window.Size = UDim2.new(0, 207, 0, 33)
  164.     Window.ZIndex = 1 + zindex
  165.  
  166.     local functions = {}
  167.     sizes[winCount] = 33
  168.     listOffset[winCount] = 10
  169.     function functions:Button(name, callback)
  170.         local name = name or "Button"
  171.         local callback = callback or function() end
  172.  
  173.         sizes[winCount] = sizes[winCount] + 32
  174.         Window.Size = UDim2.new(0, 207, 0, sizes[winCount] + 10)
  175.  
  176.         local Button = Instance.new("TextButton")
  177.         listOffset[winCount] = listOffset[winCount] + 32
  178.         Button.Name = "Button"
  179.         Button.Parent = Window
  180.         Button.BackgroundColor3 = Color3.fromRGB(53, 59, 72)
  181.         Button.BorderColor3 = Color3.fromRGB(113, 128, 147)
  182.         Button.Position = UDim2.new(0, 12, 0, listOffset[winCount])
  183.         Button.Size = UDim2.new(0, 182, 0, 26)
  184.         Button.ZIndex = 2 + zindex
  185.         Button.Selected = true
  186.         Button.Font = Enum.Font.SourceSans
  187.         Button.TextColor3 = Color3.fromRGB(245, 246, 250)
  188.         Button.TextSize = 16.000
  189.         Button.TextStrokeTransparency = 123.000
  190.         Button.TextWrapped = true
  191.         Button.Text = name
  192.         Button.MouseButton1Down:Connect(callback)
  193.  
  194.         pastSliders[winCount] = false
  195.     end
  196.     function functions:Label(text, color)
  197.         local color = color or Color3.fromRGB(220, 221, 225)
  198.  
  199.         sizes[winCount] = sizes[winCount] + 32
  200.         Window.Size = UDim2.new(0, 207, 0, sizes[winCount] + 10)
  201.  
  202.         listOffset[winCount] = listOffset[winCount] + 32
  203.         local Label = Instance.new("TextLabel")
  204.         Label.Name = "Label"
  205.         Label.Parent = Window
  206.         Label.BackgroundColor3 = Color3.fromRGB(220, 221, 225)
  207.         Label.BackgroundTransparency = 1.000
  208.         Label.BorderColor3 = Color3.fromRGB(27, 42, 53)
  209.         Label.Position = UDim2.new(0, 0, 0, listOffset[winCount])
  210.         Label.Size = UDim2.new(0, 206, 0, 29)
  211.         Label.Font = Enum.Font.SourceSans
  212.         Label.Text = text or "Label"
  213.         Label.TextSize = 16.000
  214.         Label.ZIndex = 2 + zindex
  215.  
  216.         if type(color) == "boolean" and color then
  217.         spawn(function()
  218.                 while wait() do
  219.                     local hue = tick() % 5 / 5
  220.                     Label.TextColor3 = Color3.fromHSV(hue, 1, 1)
  221.                 end
  222.         end)
  223.         else
  224.             Label.TextColor3 = color
  225.         end
  226.         pastSliders[winCount] = false
  227.     end
  228.     function functions:Toggle(text, on, callback)
  229.         local callback = callback or function() end
  230.  
  231.         sizes[winCount] = sizes[winCount] + 32
  232.         Window.Size = UDim2.new(0, 207, 0, sizes[winCount] + 10)
  233.  
  234.         listOffset[winCount] = listOffset[winCount] + 32
  235.  
  236.         local ToggleDescription = Instance.new("TextLabel")
  237.         local ToggleButton = Instance.new("TextButton")
  238.         local ToggleFiller = Instance.new("Frame")
  239.  
  240.         ToggleDescription.Name = "ToggleDescription"
  241.         ToggleDescription.Parent = Window
  242.         ToggleDescription.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  243.         ToggleDescription.BackgroundTransparency = 1.000
  244.         ToggleDescription.Position = UDim2.new(0, 14, 0, listOffset[winCount])
  245.         ToggleDescription.Size = UDim2.new(0, 131, 0, 26)
  246.         ToggleDescription.Font = Enum.Font.SourceSans
  247.         ToggleDescription.Text = text or "Toggle"
  248.         ToggleDescription.TextColor3 = Color3.fromRGB(245, 246, 250)
  249.         ToggleDescription.TextSize = 16.000
  250.         ToggleDescription.TextWrapped = true
  251.         ToggleDescription.TextXAlignment = Enum.TextXAlignment.Left
  252.         ToggleDescription.ZIndex = 2 + zindex
  253.  
  254.         ToggleButton.Name = "ToggleButton"
  255.         ToggleButton.Parent = ToggleDescription
  256.         ToggleButton.BackgroundColor3 = Color3.fromRGB(47, 54, 64)
  257.         ToggleButton.BorderColor3 = Color3.fromRGB(113, 128, 147)
  258.         ToggleButton.Position = UDim2.new(1.2061069, 0, 0.0769230798, 0)
  259.         ToggleButton.Size = UDim2.new(0, 22, 0, 22)
  260.         ToggleButton.Font = Enum.Font.SourceSans
  261.         ToggleButton.Text = ""
  262.         ToggleButton.TextColor3 = Color3.fromRGB(0, 0, 0)
  263.         ToggleButton.TextSize = 14.000
  264.         ToggleButton.ZIndex = 2 + zindex
  265.         ToggleButton.MouseButton1Up:Connect(function()
  266.             ToggleFiller.Visible = not ToggleFiller.Visible
  267.             callback(ToggleFiller.Visible)
  268.         end)
  269.  
  270.         ToggleFiller.Name = "ToggleFiller"
  271.         ToggleFiller.Parent = ToggleButton
  272.         ToggleFiller.BackgroundColor3 = Color3.fromRGB(68, 189, 50)
  273.         ToggleFiller.BorderColor3 = Color3.fromRGB(47, 54, 64)
  274.         ToggleFiller.Position = UDim2.new(0, 5, 0, 5)
  275.         ToggleFiller.Size = UDim2.new(0, 12, 0, 12)
  276.         ToggleFiller.Visible = on
  277.         ToggleFiller.ZIndex = 2 + zindex
  278.         pastSliders[winCount] = false
  279.     end
  280.     function functions:Box(text, callback)
  281.         local callback = callback or function() end
  282.  
  283.         sizes[winCount] = sizes[winCount] + 32
  284.         Window.Size = UDim2.new(0, 207, 0, sizes[winCount] + 10)
  285.  
  286.         listOffset[winCount] = listOffset[winCount] + 32
  287.         local TextBox = Instance.new("TextBox")
  288.         local BoxDescription = Instance.new("TextLabel")
  289.         TextBox.Parent = Window
  290.         TextBox.BackgroundColor3 = Color3.fromRGB(53, 59, 72)
  291.         TextBox.BorderColor3 = Color3.fromRGB(113, 128, 147)
  292.         TextBox.Position = UDim2.new(0, 99, 0, listOffset[winCount])
  293.         TextBox.Size = UDim2.new(0, 95, 0, 26)
  294.         TextBox.Font = Enum.Font.SourceSans
  295.         TextBox.PlaceholderColor3 = Color3.fromRGB(220, 221, 225)
  296.         TextBox.PlaceholderText = "..."
  297.         TextBox.Text = ""
  298.         TextBox.TextColor3 = Color3.fromRGB(245, 246, 250)
  299.         TextBox.TextSize = 16.000
  300.         TextBox.TextStrokeColor3 = Color3.fromRGB(245, 246, 250)
  301.         TextBox.ZIndex = 2 + zindex
  302.         TextBox:GetPropertyChangedSignal('Text'):connect(function()
  303.             callback(TextBox.Text, false)
  304.         end)
  305.         TextBox.FocusLost:Connect(function()
  306.             callback(TextBox.Text, true)
  307.         end)
  308.  
  309.         BoxDescription.Name = "BoxDescription"
  310.         BoxDescription.Parent = TextBox
  311.         BoxDescription.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  312.         BoxDescription.BackgroundTransparency = 1.000
  313.         BoxDescription.Position = UDim2.new(-0.894736826, 0, 0, 0)
  314.         BoxDescription.Size = UDim2.new(0, 75, 0, 26)
  315.         BoxDescription.Font = Enum.Font.SourceSans
  316.         BoxDescription.Text = text or "Box"
  317.         BoxDescription.TextColor3 = Color3.fromRGB(245, 246, 250)
  318.         BoxDescription.TextSize = 16.000
  319.         BoxDescription.TextXAlignment = Enum.TextXAlignment.Left
  320.         BoxDescription.ZIndex = 2 + zindex
  321.         pastSliders[winCount] = false
  322.     end
  323.     function functions:Slider(text, min, max, default, callback)
  324.         local text = text or "Slider"
  325.         local min = min or 1
  326.         local max = max or 100
  327.         local default = default or max/2
  328.         local callback = callback or function() end
  329.         local offset = 70
  330.         if default > max then
  331.             default = max
  332.         elseif default < min then
  333.             default = min
  334.         end
  335.  
  336.         if pastSliders[winCount] then
  337.             offset = 60
  338.         end
  339.  
  340.         sizes[winCount] = sizes[winCount] + offset
  341.         Window.Size = UDim2.new(0, 207, 0, sizes[winCount] + 10)
  342.  
  343.         listOffset[winCount] = listOffset[winCount] + offset
  344.  
  345.         local Slider = Instance.new("Frame")
  346.         local SliderButton = Instance.new("Frame")
  347.         local Description = Instance.new("TextLabel")
  348.         local SilderFiller = Instance.new("Frame")
  349.         local Current = Instance.new("TextLabel")
  350.         local Min = Instance.new("TextLabel")
  351.         local Max = Instance.new("TextLabel")
  352.  
  353.         function SliderMovement(input)
  354.             if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  355.                 isdragging = true;
  356.                     minitial = input.Position.X;
  357.                     initial = SliderButton.Position.X.Offset;
  358.                     local delta1 = SliderButton.AbsolutePosition.X - initial
  359.                     local con;
  360.                     con = stepped:Connect(function()
  361.                         if isdragging then
  362.                             local xOffset = mouse.X - delta1 - 3
  363.                             if xOffset > 175 then
  364.                                 xOffset = 175
  365.                             elseif xOffset< 0 then
  366.                                 xOffset = 0
  367.                             end
  368.                             SliderButton.Position = UDim2.new(0, xOffset , -1.33333337, 0);
  369.                             SilderFiller.Size = UDim2.new(0, xOffset, 0, 6)
  370.                             local value = Lerp(min, max, SliderButton.Position.X.Offset/(Slider.Size.X.Offset-5))
  371.                             Current.Text = tostring(math.round(value))
  372.                         else
  373.                             con:Disconnect();
  374.                         end;
  375.                     end);
  376.                     input.Changed:Connect(function()
  377.                         if input.UserInputState == Enum.UserInputState.End then
  378.                             isdragging = false;
  379.                         end;
  380.                     end);
  381.             end;
  382.         end
  383.         function SliderEnd(input)
  384.             if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  385.             local value = Lerp(min, max, SliderButton.Position.X.Offset/(Slider.Size.X.Offset-5))
  386.             callback(math.round(value))
  387.             end
  388.         end
  389.  
  390.         Slider.Name = "Slider"
  391.         Slider.Parent = Window
  392.         Slider.BackgroundColor3 = Color3.fromRGB(47, 54, 64)
  393.         Slider.BorderColor3 = Color3.fromRGB(113, 128, 147)
  394.         Slider.Position = UDim2.new(0, 13, 0, listOffset[winCount])
  395.         Slider.Size = UDim2.new(0, 180, 0, 6)
  396.         Slider.ZIndex = 2 + zindex
  397.         Slider.InputBegan:Connect(SliderMovement)
  398.         Slider.InputEnded:Connect(SliderEnd)      
  399.  
  400.         SliderButton.Position = UDim2.new(0, (Slider.Size.X.Offset - 5) * ((default - min)/(max-min)), -1.333337, 0)
  401.         SliderButton.Name = "SliderButton"
  402.         SliderButton.Parent = Slider
  403.         SliderButton.BackgroundColor3 = Color3.fromRGB(53, 59, 72)
  404.         SliderButton.BorderColor3 = Color3.fromRGB(113, 128, 147)
  405.         SliderButton.Size = UDim2.new(0, 6, 0, 22)
  406.         SliderButton.ZIndex = 3 + zindex
  407.         SliderButton.InputBegan:Connect(SliderMovement)
  408.         SliderButton.InputEnded:Connect(SliderEnd)    
  409.  
  410.         Current.Name = "Current"
  411.         Current.Parent = SliderButton
  412.         Current.BackgroundTransparency = 1.000
  413.         Current.Position = UDim2.new(0, 3, 0, 22   )
  414.         Current.Size = UDim2.new(0, 0, 0, 18)
  415.         Current.Font = Enum.Font.SourceSans
  416.         Current.Text = tostring(default)
  417.         Current.TextColor3 = Color3.fromRGB(220, 221, 225)
  418.         Current.TextSize = 14.000  
  419.         Current.ZIndex = 2 + zindex
  420.  
  421.         Description.Name = "Description"
  422.         Description.Parent = Slider
  423.         Description.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  424.         Description.BackgroundTransparency = 1.000
  425.         Description.Position = UDim2.new(0, -10, 0, -35)
  426.         Description.Size = UDim2.new(0, 200, 0, 21)
  427.         Description.Font = Enum.Font.SourceSans
  428.         Description.Text = text
  429.         Description.TextColor3 = Color3.fromRGB(245, 246, 250)
  430.         Description.TextSize = 16.000
  431.         Description.ZIndex = 2 + zindex
  432.  
  433.         SilderFiller.Name = "SilderFiller"
  434.         SilderFiller.Parent = Slider
  435.         SilderFiller.BackgroundColor3 = Color3.fromRGB(76, 209, 55)
  436.         SilderFiller.BorderColor3 = Color3.fromRGB(47, 54, 64)
  437.         SilderFiller.Size = UDim2.new(0, (Slider.Size.X.Offset - 5) * ((default - min)/(max-min)), 0, 6)
  438.         SilderFiller.ZIndex = 2 + zindex
  439.         SilderFiller.BorderMode = Enum.BorderMode.Inset
  440.  
  441.         Min.Name = "Min"
  442.         Min.Parent = Slider
  443.         Min.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  444.         Min.BackgroundTransparency = 1.000
  445.         Min.Position = UDim2.new(-0.00555555569, 0, -7.33333397, 0)
  446.         Min.Size = UDim2.new(0, 77, 0, 50)
  447.         Min.Font = Enum.Font.SourceSans
  448.         Min.Text = tostring(min)
  449.         Min.TextColor3 = Color3.fromRGB(220, 221, 225)
  450.         Min.TextSize = 14.000
  451.         Min.TextXAlignment = Enum.TextXAlignment.Left
  452.         Min.ZIndex = 2 + zindex
  453.  
  454.         Max.Name = "Max"
  455.         Max.Parent = Slider
  456.         Max.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  457.         Max.BackgroundTransparency = 1.000
  458.         Max.Position = UDim2.new(0.577777743, 0, -7.33333397, 0)
  459.         Max.Size = UDim2.new(0, 77, 0, 50)
  460.         Max.Font = Enum.Font.SourceSans
  461.         Max.Text = tostring(max)
  462.         Max.TextColor3 = Color3.fromRGB(220, 221, 225)
  463.         Max.TextSize = 14.000
  464.         Max.TextXAlignment = Enum.TextXAlignment.Right
  465.         Max.ZIndex = 2 + zindex
  466.         pastSliders[winCount] = true
  467.     end
  468.     function functions:Dropdown(text, buttons, callback)
  469.         local text = text or "Dropdown"
  470.         local buttons = buttons or {}
  471.         local callback = callback or function() end
  472.  
  473.         local Dropdown = Instance.new("TextButton")
  474.         local DownSign = Instance.new("TextLabel")
  475.         local DropdownFrame = Instance.new("ScrollingFrame")
  476.  
  477.         sizes[winCount] = sizes[winCount] + 32
  478.         Window.Size = UDim2.new(0, 207, 0, sizes[winCount] + 10)
  479.  
  480.         listOffset[winCount] = listOffset[winCount] + 32
  481.  
  482.         Dropdown.Name = "Dropdown"
  483.         Dropdown.Parent = Window
  484.         Dropdown.BackgroundColor3 = Color3.fromRGB(53, 59, 72)
  485.         Dropdown.BorderColor3 = Color3.fromRGB(113, 128, 147)
  486.         Dropdown.Position = UDim2.new(0, 12, 0, listOffset[winCount])
  487.         Dropdown.Size = UDim2.new(0, 182, 0, 26)
  488.         Dropdown.Selected = true
  489.         Dropdown.Font = Enum.Font.SourceSans
  490.         Dropdown.Text = tostring(text)
  491.         Dropdown.TextColor3 = Color3.fromRGB(245, 246, 250)
  492.         Dropdown.TextSize = 16.000
  493.         Dropdown.TextStrokeTransparency = 123.000
  494.         Dropdown.TextWrapped = true
  495.         Dropdown.ZIndex = 3 + zindex
  496.         Dropdown.MouseButton1Up:Connect(function()
  497.             for i, v in pairs(dropdowns) do
  498.                 if v ~= DropdownFrame then
  499.                 v.Visible = false
  500.                 DownSign.Rotation = 0
  501.                 end
  502.             end
  503.             if DropdownFrame.Visible then
  504.                 DownSign.Rotation = 0
  505.             else
  506.                 DownSign.Rotation = 180
  507.             end
  508.             DropdownFrame.Visible = not DropdownFrame.Visible
  509.         end)
  510.  
  511.         DownSign.Name = "DownSign"
  512.         DownSign.Parent = Dropdown
  513.         DownSign.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  514.         DownSign.BackgroundTransparency = 1.000
  515.         DownSign.Position = UDim2.new(0, 155, 0, 2)
  516.         DownSign.Size = UDim2.new(0, 27, 0, 22)
  517.         DownSign.Font = Enum.Font.SourceSans
  518.         DownSign.Text = "^"
  519.         DownSign.TextColor3 = Color3.fromRGB(220, 221, 225)
  520.         DownSign.TextSize = 20.000
  521.         DownSign.ZIndex = 4 + zindex
  522.         DownSign.TextYAlignment = Enum.TextYAlignment.Bottom
  523.  
  524.         DropdownFrame.Name = "DropdownFrame"
  525.         DropdownFrame.Parent = Dropdown
  526.         DropdownFrame.Active = true
  527.         DropdownFrame.BackgroundColor3 = Color3.fromRGB(53, 59, 72)
  528.         DropdownFrame.BorderColor3 = Color3.fromRGB(53, 59, 72)
  529.         DropdownFrame.Position = UDim2.new(0, 0, 0, 28)
  530.         DropdownFrame.Size = UDim2.new(0, 182, 0, 0)
  531.         DropdownFrame.Visible = false
  532.         DropdownFrame.CanvasSize = UDim2.new(0, 0, 0, 0)
  533.         DropdownFrame.ScrollBarThickness = 4
  534.         DropdownFrame.VerticalScrollBarPosition = Enum.VerticalScrollBarPosition.Left
  535.         DropdownFrame.ZIndex = 5 + zindex
  536.         DropdownFrame.ScrollingDirection = Enum.ScrollingDirection.Y
  537.         DropdownFrame.ScrollBarImageColor3 = Color3.fromRGB(220, 221, 225)
  538.         table.insert(dropdowns, DropdownFrame)
  539.         local dropFunctions = {}
  540.         local canvasSize = 0
  541.         function dropFunctions:Button(name)
  542.             local name = name or ""
  543.             local Button_2 = Instance.new("TextButton")
  544.             Button_2.Name = "Button"
  545.             Button_2.Parent = DropdownFrame
  546.             Button_2.BackgroundColor3 = Color3.fromRGB(53, 59, 72)
  547.             Button_2.BorderColor3 = Color3.fromRGB(113, 128, 147)
  548.             Button_2.Position = UDim2.new(0, 6, 0, canvasSize + 1)
  549.             Button_2.Size = UDim2.new(0, 170, 0, 26)
  550.             Button_2.Selected = true
  551.             Button_2.Font = Enum.Font.SourceSans
  552.             Button_2.TextColor3 = Color3.fromRGB(245, 246, 250)
  553.             Button_2.TextSize = 16.000
  554.             Button_2.TextStrokeTransparency = 123.000
  555.             Button_2.ZIndex = 6 + zindex
  556.             Button_2.Text = name
  557.             Button_2.TextWrapped = true
  558.             canvasSize = canvasSize + 27
  559.             DropdownFrame.CanvasSize = UDim2.new(0, 182, 0, canvasSize + 1)
  560.             if #DropdownFrame:GetChildren() < 8 then
  561.             DropdownFrame.Size = UDim2.new(0, 182, 0, DropdownFrame.Size.Y.Offset + 27)
  562.             end
  563.             Button_2.MouseButton1Up:Connect(function()
  564.                 callback(name)
  565.             end)
  566.         end
  567.         function dropFunctions:Remove(name)
  568.             local foundIt
  569.             for i, v in pairs(DropdownFrame:GetChildren()) do
  570.                 if foundIt then
  571.                     canvasSize = canvasSize - 27
  572.                     v.Position = UDim2.new(0, 6, 0, v.Position.Y.Offset - 27)
  573.                     DropdownFrame.CanvasSize = UDim2.new(0, 182, 0, canvasSize + 1)
  574.                 end
  575.                 if v.Text == name then
  576.                     foundIt = true
  577.                     v:Destroy()
  578.                     if #DropdownFrame:GetChildren() < 8 then
  579.                         DropdownFrame.Size = UDim2.new(0, 182, 0, DropdownFrame.Size.Y.Offset - 27)
  580.                     end
  581.                 end
  582.             end
  583.             if not foundIt then
  584.                 warn("The button you tried to remove didn't exist!")
  585.             end
  586.         end
  587.  
  588.         for i,v in pairs(buttons) do
  589.             dropFunctions:Button(v)
  590.         end
  591.  
  592.         return dropFunctions
  593.     end
  594.     function functions:ColorPicker(name, default, callback)
  595.         local callback = callback or function() end
  596.  
  597.         local ColorPicker = Instance.new("TextButton")
  598.         local PickerCorner = Instance.new("UICorner")
  599.         local PickerDescription = Instance.new("TextLabel")
  600.         local ColorPickerFrame = Instance.new("Frame")
  601.         local ToggleRGB = Instance.new("TextButton")
  602.         local ToggleFiller_2 = Instance.new("Frame")
  603.         local TextLabel = Instance.new("TextLabel")
  604.         local ClosePicker = Instance.new("TextButton")
  605.         local Canvas = Instance.new("Frame")
  606.         local CanvasGradient = Instance.new("UIGradient")
  607.         local Cursor = Instance.new("ImageLabel")
  608.         local Color = Instance.new("Frame")
  609.         local ColorGradient = Instance.new("UIGradient")
  610.         local ColorSlider = Instance.new("Frame")
  611.         local Title = Instance.new("TextLabel")
  612.         local UICorner = Instance.new("UICorner")
  613.         local ColorCorner = Instance.new("UICorner")
  614.         local BlackOverlay = Instance.new("ImageLabel")
  615.  
  616.         sizes[winCount] = sizes[winCount] + 32
  617.         Window.Size = UDim2.new(0, 207, 0, sizes[winCount] + 10)
  618.  
  619.         listOffset[winCount] = listOffset[winCount] + 32
  620.  
  621.         ColorPicker.Name = "ColorPicker"
  622.         ColorPicker.Parent = Window
  623.         ColorPicker.Position = UDim2.new(0, 137, 0, listOffset[winCount])
  624.         ColorPicker.Size = UDim2.new(0, 57, 0, 26)
  625.         ColorPicker.Font = Enum.Font.SourceSans
  626.         ColorPicker.Text = ""
  627.         ColorPicker.TextColor3 = Color3.fromRGB(0, 0, 0)
  628.         ColorPicker.TextSize = 14.000
  629.         ColorPicker.ZIndex = 2 + zindex
  630.         ColorPicker.MouseButton1Up:Connect(function()
  631.             for i, v in pairs(colorPickers) do
  632.                 v.Visible = false
  633.             end
  634.             ColorPickerFrame.Visible = not ColorPickerFrame.Visible
  635.         end)
  636.  
  637.         PickerCorner.Parent = ColorPicker
  638.         PickerCorner.Name = "PickerCorner"
  639.         PickerCorner.CornerRadius = UDim.new(0,2)
  640.  
  641.         PickerDescription.Name = "PickerDescription"
  642.         PickerDescription.Parent = ColorPicker
  643.         PickerDescription.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  644.         PickerDescription.BackgroundTransparency = 1.000
  645.         PickerDescription.Position = UDim2.new(-2.15789509, 0, 0, 0)
  646.         PickerDescription.Size = UDim2.new(0, 116, 0, 26)
  647.         PickerDescription.Font = Enum.Font.SourceSans
  648.         PickerDescription.Text = name or "Color picker"
  649.         PickerDescription.TextColor3 = Color3.fromRGB(245, 246, 250)
  650.         PickerDescription.TextSize = 16.000
  651.         PickerDescription.TextXAlignment = Enum.TextXAlignment.Left
  652.         PickerDescription.ZIndex = 2 + zindex
  653.  
  654.         ColorPickerFrame.Name = "ColorPickerFrame"
  655.         ColorPickerFrame.Parent = ColorPicker
  656.         ColorPickerFrame.BackgroundColor3 = Color3.fromRGB(47, 54, 64)
  657.         ColorPickerFrame.BorderColor3 = Color3.fromRGB(47, 54, 64)
  658.         ColorPickerFrame.Position = UDim2.new(1.40350854, 0, -2.84615374, 0)
  659.         ColorPickerFrame.Size = UDim2.new(0, 158, 0, 155)
  660.         ColorPickerFrame.ZIndex = 3 + zindex
  661.         ColorPickerFrame.Visible = false
  662.  
  663.         ToggleRGB.Name = "ToggleRGB"
  664.         ToggleRGB.Parent = ColorPickerFrame
  665.         ToggleRGB.BackgroundColor3 = Color3.fromRGB(47, 54, 64)
  666.         ToggleRGB.BorderColor3 = Color3.fromRGB(113, 128, 147)
  667.         ToggleRGB.Position = UDim2.new(0, 125, 0, 127)
  668.         ToggleRGB.Size = UDim2.new(0, 22, 0, 22)
  669.         ToggleRGB.Font = Enum.Font.SourceSans
  670.         ToggleRGB.Text = ""
  671.         ToggleRGB.TextColor3 = Color3.fromRGB(0, 0, 0)
  672.         ToggleRGB.TextSize = 14.000
  673.         ToggleRGB.ZIndex = 4 + zindex
  674.  
  675.         ToggleFiller_2.Name = "ToggleFiller"
  676.         ToggleFiller_2.Parent = ToggleRGB
  677.         ToggleFiller_2.BackgroundColor3 = Color3.fromRGB(76, 209, 55)
  678.         ToggleFiller_2.BorderColor3 = Color3.fromRGB(47, 54, 64)
  679.         ToggleFiller_2.Position = UDim2.new(0, 5, 0, 5)
  680.         ToggleFiller_2.Size = UDim2.new(0, 12, 0, 12)
  681.         ToggleFiller_2.ZIndex = 4 + zindex
  682.         ToggleFiller_2.Visible = false
  683.  
  684.         TextLabel.Parent = ToggleRGB
  685.         TextLabel.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  686.         TextLabel.BackgroundTransparency = 1.000
  687.         TextLabel.Position = UDim2.new(-5.13636351, 0, 0, 0)
  688.         TextLabel.Size = UDim2.new(0, 106, 0, 22)
  689.         TextLabel.Font = Enum.Font.SourceSans
  690.         TextLabel.Text = "Rainbow"
  691.         TextLabel.TextColor3 = Color3.fromRGB(245, 246, 250)
  692.         TextLabel.TextSize = 16.000
  693.         TextLabel.TextXAlignment = Enum.TextXAlignment.Left
  694.         TextLabel.ZIndex = 4 + zindex
  695.  
  696.         ClosePicker.Name = "ClosePicker"
  697.         ClosePicker.Parent = ColorPickerFrame
  698.         ClosePicker.BackgroundColor3 = Color3.fromRGB(47, 54, 64)
  699.         ClosePicker.BorderColor3 = Color3.fromRGB(47, 54, 64)
  700.         ClosePicker.Position = UDim2.new(0, 132, 0, 5)
  701.         ClosePicker.Size = UDim2.new(0, 21, 0, 21)
  702.         ClosePicker.Font = Enum.Font.SourceSans
  703.         ClosePicker.Text = "X"
  704.         ClosePicker.TextColor3 = Color3.fromRGB(245, 246, 250)
  705.         ClosePicker.TextSize = 18.000
  706.         ClosePicker.ZIndex = 4 + zindex
  707.         ClosePicker.MouseButton1Down:Connect(function()
  708.             ColorPickerFrame.Visible = not ColorPickerFrame.Visible
  709.         end)
  710.  
  711.         CanvasGradient.Color = ColorSequence.new{ColorSequenceKeypoint.new(0.00, Color3.fromRGB(255, 0, 0)), ColorSequenceKeypoint.new(1.00, Color3.fromRGB(255, 255, 255))}
  712.         CanvasGradient.Name = "CanvasGradient"
  713.         CanvasGradient.Parent = Canvas
  714.  
  715.         BlackOverlay.Name = "BlackOverlay"
  716.         BlackOverlay.Parent = Canvas
  717.         BlackOverlay.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  718.         BlackOverlay.BackgroundTransparency = 1.000
  719.         BlackOverlay.Size = UDim2.new(1, 0, 1, 0)
  720.         BlackOverlay.Image = "rbxassetid://5107152095"
  721.         BlackOverlay.ZIndex = 5 + zindex
  722.  
  723.         UICorner.Parent = Canvas
  724.         UICorner.Name = "UICorner"
  725.         UICorner.CornerRadius = UDim.new(0,2)
  726.  
  727.         Cursor.Name = "Cursor"
  728.         Cursor.Parent = Canvas
  729.         Cursor.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  730.         Cursor.BackgroundTransparency = 1.000
  731.         Cursor.Size = UDim2.new(0, 8, 0, 8)
  732.         Cursor.Image = "rbxassetid://5100115962"
  733.         Cursor.ZIndex = 5 + zindex
  734.  
  735.         local draggingColor = false
  736.         local hue = 0
  737.         local sat = 1
  738.         local brightness = 1
  739.        
  740.         local con
  741.  
  742.         ToggleRGB.MouseButton1Down:Connect(function()
  743.             ToggleFiller_2.Visible = not ToggleFiller_2.Visible
  744.             if ToggleFiller_2.Visible then
  745.                 con = stepped:Connect(function()
  746.                     if ToggleFiller_2.Visible then
  747.                         local hue2 = tick() % 5 / 5
  748.                         color3 = Color3.fromHSV(hue2, 1, 1)
  749.                         callback(color3, true)
  750.                         ColorPicker.BackgroundColor3 = color3
  751.                     else
  752.                         con:Disconnect()
  753.                     end
  754.                 end)
  755.             end
  756.         end)
  757.        
  758.         if default and type(default) == "boolean" then
  759.             ToggleFiller_2.Visible = true
  760.             if ToggleFiller_2.Visible then
  761.                 con = stepped:Connect(function()
  762.                     if ToggleFiller_2.Visible then
  763.                         local hue2 = tick() % 5 / 5
  764.                         color3 = Color3.fromHSV(hue2, 1, 1)
  765.                         callback(color3)
  766.                         ColorPicker.BackgroundColor3 = color3
  767.                     else
  768.                         con:Disconnect()
  769.                     end
  770.                 end)
  771.             end
  772.         else
  773.             ColorPicker.BackgroundColor3 = default or Color3.fromRGB(0, 168, 255)
  774.         end
  775.  
  776.         Canvas.Name = "Canvas"
  777.         Canvas.Parent = ColorPickerFrame
  778.         Canvas.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  779.         Canvas.Position = UDim2.new(0, 5, 0, 34)
  780.         Canvas.Size = UDim2.new(0, 148, 0, 64)
  781.         Canvas.ZIndex = 4 + zindex
  782.         local canvasSize, canvasPosition = Canvas.AbsoluteSize, Canvas.AbsolutePosition
  783.         Canvas.InputBegan:Connect(function(input)
  784.             if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  785.                 local initial = Vector2.new(Cursor.Position.X.Offset, Cursor.Position.Y.Offset)
  786.                 local delta = Cursor.AbsolutePosition - initial
  787.                 local con;
  788.                 local isdragging = true
  789.  
  790.                 con = stepped:Connect(function()
  791.                     if isdragging then
  792.                         local delta2 = Vector2.new(mouse.X, mouse.Y) - delta
  793.                         local x = math.clamp(delta2.X, 2, Canvas.Size.X.Offset - 2)
  794.                         local y = math.clamp(delta2.Y, 2, Canvas.Size.Y.Offset - 2)
  795.                        
  796.                         sat = 1 - math.clamp((mouse.X - canvasPosition.X) / canvasSize.X, 0, 1)
  797.                         brightness = 1 - math.clamp((mouse.Y - canvasPosition.Y) / canvasSize.Y, 0, 1)
  798.                
  799.                         color3 = Color3.fromHSV(hue, sat, brightness)
  800.                        
  801.                         Cursor.Position = UDim2.fromOffset(x - 4, y - 4)
  802.                         ColorPicker.BackgroundColor3 = color3
  803.                         callback(color3)
  804.                     else
  805.                         con:Disconnect();
  806.                     end;
  807.                 end);
  808.                 input.Changed:Connect(function()
  809.                     if input.UserInputState == Enum.UserInputState.End then
  810.                         isdragging = false;
  811.                     end;
  812.                 end);
  813.             end;
  814.         end);
  815.  
  816.         Color.Name = "Color"
  817.         Color.Parent = ColorPickerFrame
  818.         Color.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  819.         Color.Position = UDim2.new(0, 5, 0, 105)
  820.         Color.Size = UDim2.new(0, 148, 0, 14)
  821.         Color.BorderMode = Enum.BorderMode.Inset
  822.         Color.ZIndex = 4 + zindex
  823.         Color.InputBegan:Connect(function(input)
  824.             if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  825.                 draggingColor = true
  826.                 local initial2 = ColorSlider.Position.X.Offset;
  827.                 local delta1 = ColorSlider.AbsolutePosition.X - initial2
  828.                 local con
  829.                 con = stepped:Connect(function()
  830.                 if draggingColor then
  831.                     -- gets the position of the mouse on the color thing and divides it by its size, whcih will give u the hue
  832.                     local colorPosition, colorSize = Color.AbsolutePosition, Color.AbsoluteSize
  833.                     hue = 1 - math.clamp(1 - ((mouse.X - colorPosition.X) / colorSize.X), 0, 1)
  834.                     CanvasGradient.Color = ColorSequence.new{ColorSequenceKeypoint.new(0.00, Color3.fromHSV(hue, 1, 1)), ColorSequenceKeypoint.new(1.00, Color3.fromRGB(255, 255, 255))}
  835.  
  836.                     local xOffset = math.clamp(mouse.X - delta1, 0, Color.Size.X.Offset - 3)
  837.                     ColorSlider.Position = UDim2.new(0, xOffset, 0, 0);
  838.  
  839.                     color3 = Color3.fromHSV(hue, sat, brightness)
  840.                     ColorPicker.BackgroundColor3  = color3
  841.                     callback(color3)
  842.                 else
  843.                     con:Disconnect()
  844.                 end
  845.             end)
  846.             end
  847.         end)
  848.         Color.InputEnded:Connect(function(input)
  849.             if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  850.             draggingColor = false
  851.             end
  852.         end)
  853.         ColorGradient.Color = ColorSequence.new({
  854.             ColorSequenceKeypoint.new(0.00, Color3.fromRGB(255, 0, 0)),
  855.             ColorSequenceKeypoint.new(0.17, Color3.fromRGB(255, 255, 0)),
  856.             ColorSequenceKeypoint.new(0.33, Color3.fromRGB(0, 255, 0)),
  857.             ColorSequenceKeypoint.new(0.50, Color3.fromRGB(0, 255, 255)),
  858.             ColorSequenceKeypoint.new(0.66, Color3.fromRGB(0, 0, 255)),
  859.             ColorSequenceKeypoint.new(0.82, Color3.fromRGB(255, 0, 255)),
  860.             ColorSequenceKeypoint.new(1.00, Color3.fromRGB(255, 0, 0))
  861.         })
  862.         ColorGradient.Name = "ColorGradient"
  863.         ColorGradient.Parent = Color
  864.  
  865.         ColorCorner.Parent = Color
  866.         ColorCorner.Name = "ColorCorner"
  867.         ColorCorner.CornerRadius = UDim.new(0,2)
  868.  
  869.         ColorSlider.Name = "ColorSlider"
  870.         ColorSlider.Parent = Color
  871.         ColorSlider.BackgroundColor3 = Color3.fromRGB(245, 246, 250)
  872.         ColorSlider.BorderColor3 = Color3.fromRGB(245, 246, 250)
  873.         ColorSlider.Size = UDim2.new(0, 2, 0, 14)
  874.         ColorSlider.ZIndex = 5 + zindex
  875.  
  876.         Title.Name = "Title"
  877.         Title.Parent = ColorPickerFrame
  878.         Title.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  879.         Title.BackgroundTransparency = 1.000
  880.         Title.Position = UDim2.new(0, 10, 0, 5)
  881.         Title.Size = UDim2.new(0, 118, 0, 21)
  882.         Title.Font = Enum.Font.SourceSans
  883.         Title.Text = name or "Color picker"
  884.         Title.TextColor3 = Color3.fromRGB(245, 246, 250)
  885.         Title.TextSize = 16.000
  886.         Title.TextXAlignment = Enum.TextXAlignment.Left
  887.         Title.ZIndex = 4 + zindex
  888.  
  889.         table.insert(colorPickers, ColorPickerFrame)
  890.  
  891.         local colorFuncs = {}
  892.         function colorFuncs:UpdateColorPicker(color)
  893.         if type(color) == "userdata" then
  894.             ToggleFiller_2.Visible = false
  895.             ColorPicker.BackgroundColor3 = color
  896.         elseif color and type(color) == "boolean" and not con then
  897.             ToggleFiller_2.Visible = true
  898.                 con = stepped:Connect(function()
  899.                     if ToggleFiller_2.Visible then
  900.                         local hue2 = tick() % 5 / 5
  901.                         color3 = Color3.fromHSV(hue2, 1, 1)
  902.                         callback(color3)
  903.                         ColorPicker.BackgroundColor3 = color3
  904.                     else
  905.                         con:Disconnect()
  906.                     end
  907.                 end)
  908.             end
  909.         end
  910.     return colorFuncs
  911.     end
  912.  
  913.     return functions
  914. end
  915.  
  916. return library
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement