lossdev

uilib

Apr 30th, 2022
1,510
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 24.59 KB | None | 0 0
  1. local Player = game.Players.LocalPlayer
  2. local Mouse = Player:GetMouse()
  3.  
  4. local TweenService = game:GetService("TweenService")
  5. local UserInputService = game:GetService("UserInputService")
  6. local CoreGuiService = game:GetService("CoreGui")
  7. local RunService = game:GetService("RunService")
  8. local TextService = game:GetService("TextService")
  9.  
  10. local TweenTime = 0.1
  11. local Level = 1
  12.  
  13. local GlobalTweenInfo = TweenInfo.new(TweenTime)
  14. local AlteredTweenInfo = TweenInfo.new(TweenTime, Enum.EasingStyle.Sine, Enum.EasingDirection.Out)
  15.  
  16. local DropShadowID = "rbxassetid://297774371"
  17. local DropShadowTransparency = 0.3
  18.  
  19. local IconLibraryID = "rbxassetid://3926305904"
  20. local IconLibraryID2 = "rbxassetid://3926307971"
  21.  
  22. local MainFont = Enum.Font.Gotham
  23.  
  24. local function GetXY(GuiObject)
  25.     local X, Y = Mouse.X - GuiObject.AbsolutePosition.X, Mouse.Y - GuiObject.AbsolutePosition.Y
  26.     local MaxX, MaxY = GuiObject.AbsoluteSize.X, GuiObject.AbsoluteSize.Y
  27.     X, Y = math.clamp(X, 0, MaxX), math.clamp(Y, 0, MaxY)
  28.     return X, Y, X/MaxX, Y/MaxY
  29. end
  30.  
  31. local function TitleIcon(ButtonOrNot)
  32.     local NewTitleIcon = Instance.new(ButtonOrNot and "ImageButton" or "ImageLabel")
  33.     NewTitleIcon.Name = "TitleIcon"
  34.     NewTitleIcon.BackgroundTransparency = 1
  35.     NewTitleIcon.Image = IconLibraryID
  36.     NewTitleIcon.ImageRectOffset = Vector2.new(524, 764)
  37.     NewTitleIcon.ImageRectSize = Vector2.new(36, 36)
  38.     NewTitleIcon.Size = UDim2.new(0,14,0,14)
  39.     NewTitleIcon.Position = UDim2.new(1,-17,0,3)
  40.     NewTitleIcon.Rotation = 180
  41.     NewTitleIcon.ZIndex = Level
  42.     return NewTitleIcon
  43. end
  44.  
  45. local function TickIcon(ButtonOrNot)
  46.     local NewTickIcon = Instance.new(ButtonOrNot and "ImageButton" or "ImageLabel")
  47.     NewTickIcon.Name = "TickIcon"
  48.     NewTickIcon.BackgroundTransparency = 1
  49.     NewTickIcon.Image = "rbxassetid://3926305904"
  50.     NewTickIcon.ImageRectOffset = Vector2.new(312,4)
  51.     NewTickIcon.ImageRectSize = Vector2.new(24,24)
  52.     NewTickIcon.Size = UDim2.new(1,-6,1,-6)
  53.     NewTickIcon.Position = UDim2.new(0,3,0,3)
  54.     NewTickIcon.ZIndex = Level
  55.     return NewTickIcon
  56. end
  57.  
  58. local function DropdownIcon(ButtonOrNot)
  59.     local NewDropdownIcon = Instance.new(ButtonOrNot and "ImageButton" or "ImageLabel")
  60.     NewDropdownIcon.Name = "DropdownIcon"
  61.     NewDropdownIcon.BackgroundTransparency = 1
  62.     NewDropdownIcon.Image = IconLibraryID2
  63.     NewDropdownIcon.ImageRectOffset = Vector2.new(324,364)
  64.     NewDropdownIcon.ImageRectSize = Vector2.new(36,36)
  65.     NewDropdownIcon.Size = UDim2.new(0,16,0,16)
  66.     NewDropdownIcon.Position = UDim2.new(1,-18,0,2)
  67.     NewDropdownIcon.ZIndex = Level
  68.     return NewDropdownIcon
  69. end
  70.  
  71. local function SearchIcon(ButtonOrNot)
  72.     local NewSearchIcon = Instance.new(ButtonOrNot and "ImageButton" or "ImageLabel")
  73.     NewSearchIcon.Name = "SearchIcon"
  74.     NewSearchIcon.BackgroundTransparency = 1
  75.     NewSearchIcon.Image = IconLibraryID
  76.     NewSearchIcon.ImageRectOffset = Vector2.new(964,324)
  77.     NewSearchIcon.ImageRectSize = Vector2.new(36,36)
  78.     NewSearchIcon.Size = UDim2.new(0,16,0,16)
  79.     NewSearchIcon.Position = UDim2.new(0,2,0,2)
  80.     NewSearchIcon.ZIndex = Level
  81.     return NewSearchIcon
  82. end
  83.  
  84. local function RoundBox(CornerRadius, ButtonOrNot)
  85.     local NewRoundBox = Instance.new(ButtonOrNot and "ImageButton" or "ImageLabel")
  86.     NewRoundBox.BackgroundTransparency = 1
  87.     NewRoundBox.Image = "rbxassetid://3570695787"
  88.     NewRoundBox.SliceCenter = Rect.new(100,100,100,100)
  89.     NewRoundBox.SliceScale = math.clamp((CornerRadius or 5) * 0.01, 0.01, 1)
  90.     NewRoundBox.ScaleType = Enum.ScaleType.Slice
  91.     NewRoundBox.ZIndex = Level
  92.     return NewRoundBox
  93. end
  94.  
  95. local function DropShadow()
  96.     local NewDropShadow = Instance.new("ImageLabel")
  97.     NewDropShadow.Name = "DropShadow"
  98.     NewDropShadow.BackgroundTransparency = 1
  99.     NewDropShadow.Image = DropShadowID
  100.     NewDropShadow.ImageTransparency = DropShadowTransparency
  101.     NewDropShadow.Size = UDim2.new(1,0,1,0)
  102.     NewDropShadow.ZIndex = Level
  103.     return NewDropShadow
  104. end
  105.  
  106. local function Frame()
  107.     local NewFrame = Instance.new("Frame")
  108.     NewFrame.BorderSizePixel = 0
  109.     NewFrame.ZIndex = Level
  110.     return NewFrame
  111. end
  112.  
  113. local function ScrollingFrame()
  114.     local NewScrollingFrame = Instance.new("ScrollingFrame")
  115.     NewScrollingFrame.BackgroundTransparency = 1
  116.     NewScrollingFrame.BorderSizePixel = 0
  117.     NewScrollingFrame.ScrollBarThickness = 0
  118.     NewScrollingFrame.ZIndex = Level
  119.     return NewScrollingFrame
  120. end
  121.  
  122. local function TextButton(Text, Size)
  123.     local NewTextButton = Instance.new("TextButton")
  124.     NewTextButton.Text = Text
  125.     NewTextButton.AutoButtonColor = false
  126.     NewTextButton.Font = MainFont
  127.     NewTextButton.TextColor3 = Color3.fromRGB(255,255,255)
  128.     NewTextButton.BackgroundTransparency = 1
  129.     NewTextButton.TextSize = Size or 12
  130.     NewTextButton.Size = UDim2.new(1,0,1,0)
  131.     NewTextButton.ZIndex = Level
  132.     return NewTextButton
  133. end
  134.  
  135. local function TextBox(Text, Size)
  136.     local NewTextBox = Instance.new("TextBox")
  137.     NewTextBox.Text = Text
  138.     NewTextBox.Font = MainFont
  139.     NewTextBox.TextColor3 = Color3.fromRGB(255,255,255)
  140.     NewTextBox.BackgroundTransparency = 1
  141.     NewTextBox.TextSize = Size or 12
  142.     NewTextBox.Size = UDim2.new(1,0,1,0)
  143.     NewTextBox.ZIndex = Level
  144.     return NewTextBox
  145. end
  146.  
  147. local function TextLabel(Text, Size)
  148.     local NewTextLabel = Instance.new("TextLabel")
  149.     NewTextLabel.Text = Text
  150.     NewTextLabel.Font = MainFont
  151.     NewTextLabel.TextColor3 = Color3.fromRGB(255,255,255)
  152.     NewTextLabel.BackgroundTransparency = 1
  153.     NewTextLabel.TextSize = Size or 12
  154.     NewTextLabel.Size = UDim2.new(1,0,1,0)
  155.     NewTextLabel.ZIndex = Level
  156.     return NewTextLabel
  157. end
  158.  
  159. local function Tween(GuiObject, Dictionary)
  160.     local TweenBase = TweenService:Create(GuiObject, GlobalTweenInfo, Dictionary)
  161.     TweenBase:Play()
  162.     return TweenBase
  163. end
  164.  
  165. local UILibrary = {}
  166.  
  167. function UILibrary.Load(GUITitle)
  168.     local TargetedParent = RunService:IsStudio() and Player:WaitForChild("PlayerGui") or CoreGuiService
  169.    
  170.     local FindOldInstance = TargetedParent:FindFirstChild(GUITitle)
  171.    
  172.     if FindOldInstance then
  173.         FindOldInstance:Destroy()
  174.     end
  175.    
  176.     local NewInstance, ContainerFrame, ContainerShadow, MainFrame
  177.    
  178.     NewInstance = Instance.new("ScreenGui")
  179.     NewInstance.Name = GUITitle
  180.     NewInstance.Parent = TargetedParent
  181.    
  182.     ContainerFrame = Frame()
  183.     ContainerFrame.Name = "ContainerFrame"
  184.     ContainerFrame.Size = UDim2.new(0,500,0,300)
  185.     ContainerFrame.Position = UDim2.new(0.5,-250,0.5,-150)
  186.     ContainerFrame.BackgroundTransparency = 1
  187.     ContainerFrame.Parent = NewInstance
  188.    
  189.     ContainerShadow = DropShadow()
  190.     ContainerShadow.Name = "Shadow"
  191.     ContainerShadow.Parent = ContainerFrame
  192.    
  193.     Level += 1
  194.    
  195.     MainFrame = RoundBox(5)
  196.     MainFrame.ClipsDescendants = true
  197.     MainFrame.Name = "MainFrame"
  198.     MainFrame.Size = UDim2.new(1,-50,1,-30)
  199.     MainFrame.Position = UDim2.new(0,25,0,15)
  200.     MainFrame.ImageColor3 = Color3.fromRGB(30,30,30)
  201.     MainFrame.Parent = ContainerFrame
  202.    
  203.     local MenuBar, DisplayFrame, TitleBar
  204.    
  205.     MenuBar = ScrollingFrame()
  206.     MenuBar.Name = "MenuBar"
  207.     MenuBar.BackgroundTransparency = 0.7
  208.     MenuBar.BackgroundColor3 = Color3.fromRGB(20,20,20)
  209.     MenuBar.Size = UDim2.new(0,100,0,235)
  210.     MenuBar.Position = UDim2.new(0,5,0,30)
  211.     MenuBar.CanvasSize = UDim2.new(0,0,0,0)
  212.     MenuBar.Parent = MainFrame
  213.    
  214.     DisplayFrame = RoundBox(5)
  215.     DisplayFrame.Name = "Display"
  216.     DisplayFrame.ImageColor3 = Color3.fromRGB(20,20,20)
  217.     DisplayFrame.Size = UDim2.new(1,-115,0,235)
  218.     DisplayFrame.Position = UDim2.new(0,110,0,30)
  219.     DisplayFrame.Parent = MainFrame
  220.    
  221.     TitleBar = RoundBox(5)
  222.     TitleBar.Name = "TitleBar"
  223.     TitleBar.ImageColor3 = Color3.fromRGB(40,40,40)
  224.     TitleBar.Size = UDim2.new(1,-10,0,20)
  225.     TitleBar.Position = UDim2.new(0,5,0,5)
  226.     TitleBar.Parent = MainFrame
  227.    
  228.     Level += 1
  229.    
  230.     local MinimiseButton, TitleButton
  231.     local MinimiseToggle = true
  232.    
  233.     MinimiseButton = TitleIcon(true)
  234.     MinimiseButton.Name = "Minimise"
  235.     MinimiseButton.Parent = TitleBar
  236.    
  237.     TitleButton = TextButton(GUITitle, 14)
  238.     TitleButton.Name = "TitleButton"
  239.     TitleButton.Size = UDim2.new(1,-20,1,0)
  240.     TitleButton.Parent = TitleBar
  241.    
  242.     MinimiseButton.MouseButton1Down:Connect(function()
  243.         MinimiseToggle = not MinimiseToggle
  244.         if not MinimiseToggle then
  245.             Tween(MainFrame, {Size = UDim2.new(1,-50,0,30)})
  246.             Tween(MinimiseButton, {Rotation = 0})
  247.             Tween(ContainerShadow, {ImageTransparency = 1})
  248.         else
  249.             Tween(MainFrame, {Size = UDim2.new(1,-50,1,-30)})
  250.             Tween(MinimiseButton, {Rotation = 180})
  251.             Tween(ContainerShadow, {ImageTransparency = DropShadowTransparency})
  252.         end
  253.     end)
  254.    
  255.     TitleButton.MouseButton1Down:Connect(function()
  256.         local LastMX, LastMY = Mouse.X, Mouse.Y
  257.         local Move, Kill
  258.         Move = Mouse.Move:Connect(function()
  259.             local NewMX, NewMY = Mouse.X, Mouse.Y
  260.             local DX, DY = NewMX - LastMX, NewMY - LastMY
  261.             ContainerFrame.Position += UDim2.new(0,DX,0,DY)
  262.             LastMX, LastMY = NewMX, NewMY
  263.         end)
  264.         Kill = UserInputService.InputEnded:Connect(function(input)
  265.             if input.UserInputType == Enum.UserInputType.MouseButton1 then
  266.                 Move:Disconnect()
  267.                 Kill:Disconnect()
  268.             end
  269.         end)
  270.     end)
  271.    
  272.     Level += 1
  273.    
  274.     local MenuListLayout
  275.    
  276.     MenuListLayout = Instance.new("UIListLayout")
  277.     MenuListLayout.SortOrder = Enum.SortOrder.LayoutOrder
  278.     MenuListLayout.Padding = UDim.new(0,5)
  279.     MenuListLayout.Parent = MenuBar
  280.    
  281.     local TabCount = 0
  282.    
  283.     local TabLibrary = {}
  284.    
  285.     function TabLibrary.AddPage(PageTitle, SearchBarIncluded)
  286.         local SearchBarIncluded = (SearchBarIncluded == nil) and true or SearchBarIncluded
  287.        
  288.         local PageContainer = RoundBox(5)
  289.         PageContainer.Name = PageTitle
  290.         PageContainer.Size = UDim2.new(1,0,0,20)
  291.         PageContainer.LayoutOrder = TabCount
  292.         PageContainer.ImageColor3 = (TabCount == 0) and Color3.fromRGB(50,50,50) or Color3.fromRGB(40,40,40)
  293.         PageContainer.Parent = MenuBar
  294.        
  295.         local PageButton = TextButton(PageTitle, 14)
  296.         PageButton.Name = PageTitle.."Button"
  297.         PageButton.TextTransparency = (TabCount == 0) and 0 or 0.5
  298.         PageButton.Parent = PageContainer
  299.        
  300.         PageButton.MouseButton1Down:Connect(function()
  301.             spawn(function()
  302.                 for _, Button in next, MenuBar:GetChildren() do
  303.                     if Button:IsA("GuiObject") then
  304.                         local IsButton = string.find(Button.Name:lower(), PageContainer.Name:lower())
  305.                         local Button2 = Button:FindFirstChild(Button.Name.."Button")
  306.                         Tween(Button, {ImageColor3 = IsButton and Color3.fromRGB(50,50,50) or Color3.fromRGB(40,40,40)})
  307.                         Tween(Button2, {TextTransparency = IsButton and 0 or 0.5})
  308.                     end
  309.                 end
  310.             end)
  311.             spawn(function()
  312.                 for _, Display in next, DisplayFrame:GetChildren() do
  313.                     if Display:IsA("GuiObject") then
  314.                         Display.Visible = string.find(Display.Name:lower(), PageContainer.Name:lower())
  315.                     end
  316.                 end
  317.             end)
  318.         end)
  319.        
  320.         local DisplayPage = ScrollingFrame()
  321.         DisplayPage.Visible = (TabCount == 0)
  322.         DisplayPage.Name = PageTitle
  323.         DisplayPage.Size = UDim2.new(1,0,1,0)
  324.         DisplayPage.Parent = DisplayFrame
  325.        
  326.         TabCount += 1
  327.        
  328.         local DisplayList = Instance.new("UIListLayout")
  329.         DisplayList.SortOrder = Enum.SortOrder.LayoutOrder
  330.         DisplayList.Padding = UDim.new(0,5)
  331.         DisplayList.Parent = DisplayPage
  332.        
  333.         DisplayList:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(function()
  334.             local Y1 = DisplayList.AbsoluteContentSize.Y
  335.             local Y2 = DisplayPage.AbsoluteWindowSize.Y
  336.             DisplayPage.CanvasSize = UDim2.new(0,0,(Y1/Y2)+0.05,0)
  337.         end)
  338.        
  339.         local DisplayPadding = Instance.new("UIPadding")
  340.         DisplayPadding.PaddingBottom = UDim.new(0,5)
  341.         DisplayPadding.PaddingTop = UDim.new(0,5)
  342.         DisplayPadding.PaddingLeft = UDim.new(0,5)
  343.         DisplayPadding.PaddingRight = UDim.new(0,5)
  344.         DisplayPadding.Parent = DisplayPage
  345.        
  346.         if SearchBarIncluded then
  347.             local SearchBarContainer = RoundBox(5)
  348.             SearchBarContainer.Name = "SearchBar"
  349.             SearchBarContainer.ImageColor3 = Color3.fromRGB(35,35,35)
  350.             SearchBarContainer.Size = UDim2.new(1,0,0,20)
  351.             SearchBarContainer.Parent = DisplayPage
  352.            
  353.             local SearchBox = TextBox("Search...")
  354.             SearchBox.Name = "SearchInput"
  355.             SearchBox.Position = UDim2.new(0,20,0,0)
  356.             SearchBox.Size = UDim2.new(1,-20,1,0)
  357.             SearchBox.TextTransparency = 0.5
  358.             SearchBox.TextXAlignment = Enum.TextXAlignment.Left
  359.             SearchBox.Parent = SearchBarContainer
  360.            
  361.             local SearchIcon = SearchIcon()
  362.             SearchIcon.Parent = SearchBarContainer
  363.            
  364.             SearchBox:GetPropertyChangedSignal("Text"):Connect(function()
  365.                 local NewValue = SearchBox.Text
  366.                
  367.                 for _, Element in next, DisplayPage:GetChildren() do
  368.                     if Element:IsA("Frame") then
  369.                         if not string.find(Element.Name:lower(), "label") then
  370.                             if string.find(Element.Name:lower(), NewValue:lower()) then
  371.                                 Element.Visible = true
  372.                             else
  373.                                 Element.Visible = false
  374.                             end
  375.                         end
  376.                     end
  377.                 end
  378.             end)
  379.         end
  380.        
  381.         local PageLibrary = {}
  382.        
  383.         function PageLibrary.AddButton(Text, Callback, Parent, Underline)
  384.             local ButtonContainer = Frame()
  385.             ButtonContainer.Name = Text.."BUTTON"
  386.             ButtonContainer.Size = UDim2.new(1,0,0,20)
  387.             ButtonContainer.BackgroundTransparency = 1
  388.             ButtonContainer.Parent = Parent or DisplayPage
  389.            
  390.             local ButtonForeground = RoundBox(5)
  391.             ButtonForeground.Name = "ButtonForeground"
  392.             ButtonForeground.Size = UDim2.new(1,0,1,0)
  393.             ButtonForeground.ImageColor3 = Color3.fromRGB(35,35,35)
  394.             ButtonForeground.Parent = ButtonContainer
  395.            
  396.             if Underline then
  397.                 local TextSize = TextService:GetTextSize(Text, 12, Enum.Font.Gotham, Vector2.new(0,0))
  398.            
  399.                 local BottomEffect = Frame()
  400.                 BottomEffect.Size = UDim2.new(0,TextSize.X,0,1)
  401.                 BottomEffect.Position = UDim2.new(0.5,(-TextSize.X/2)-1,1,-1)
  402.                 BottomEffect.BackgroundColor3 = Color3.fromRGB(255,255,255)
  403.                 BottomEffect.BackgroundTransparency = 0.5
  404.                 BottomEffect.Parent = ButtonForeground
  405.             end
  406.            
  407.             local HiddenButton = TextButton(Text, 12)
  408.             HiddenButton.Parent = ButtonForeground
  409.            
  410.             HiddenButton.MouseButton1Down:Connect(function()
  411.                 Callback()
  412.                 Tween(ButtonForeground, {ImageColor3 = Color3.fromRGB(45,45,45)})
  413.                 Tween(HiddenButton, {TextTransparency = 0.5})
  414.                 wait(TweenTime)
  415.                 Tween(ButtonForeground, {ImageColor3 = Color3.fromRGB(35,35,35)})
  416.                 Tween(HiddenButton, {TextTransparency = 0})
  417.             end)
  418.         end
  419.        
  420.         function PageLibrary.AddLabel(Text)
  421.             local LabelContainer = Frame()
  422.             LabelContainer.Name = Text.."LABEL"
  423.             LabelContainer.Size = UDim2.new(1,0,0,20)
  424.             LabelContainer.BackgroundTransparency = 1
  425.             LabelContainer.Parent = DisplayPage
  426.            
  427.             local LabelForeground = RoundBox(5)
  428.             LabelForeground.Name = "LabelForeground"
  429.             LabelForeground.ImageColor3 = Color3.fromRGB(45,45,45)
  430.             LabelForeground.Size = UDim2.new(1,0,1,0)
  431.             LabelForeground.Parent = LabelContainer
  432.            
  433.             local HiddenLabel = TextLabel(Text, 12)
  434.             HiddenLabel.Parent = LabelForeground
  435.         end
  436.        
  437.         function PageLibrary.AddDropdown(Text, ConfigurationArray, Callback)
  438.             local DropdownArray = ConfigurationArray or {}
  439.            
  440.             local DropdownToggle = false
  441.            
  442.             local DropdownContainer = Frame()
  443.             DropdownContainer.Size = UDim2.new(1,0,0,20)
  444.             DropdownContainer.Name = Text.."DROPDOWN"
  445.             DropdownContainer.BackgroundTransparency = 1
  446.             DropdownContainer.Parent = DisplayPage
  447.            
  448.             local DropdownForeground = RoundBox(5)
  449.             DropdownForeground.ClipsDescendants = true
  450.             DropdownForeground.ImageColor3 = Color3.fromRGB(35,35,35)
  451.             DropdownForeground.Size = UDim2.new(1,0,1,0)
  452.             DropdownForeground.Parent = DropdownContainer
  453.            
  454.             local DropdownExpander = DropdownIcon(true)
  455.             DropdownExpander.Parent = DropdownForeground
  456.            
  457.             local DropdownLabel = TextLabel(Text, 12)
  458.             DropdownLabel.Size = UDim2.new(1,0,0,20)
  459.             DropdownLabel.Parent = DropdownForeground
  460.            
  461.             local DropdownFrame = Frame()
  462.             DropdownFrame.Position = UDim2.new(0,0,0,20)
  463.             DropdownFrame.BackgroundTransparency = 1
  464.             DropdownFrame.Size = UDim2.new(1,0,0,#DropdownArray*20)
  465.             DropdownFrame.Parent = DropdownForeground
  466.            
  467.             local DropdownList = Instance.new("UIListLayout")
  468.             DropdownList.Parent = DropdownFrame
  469.            
  470.             for OptionIndex, Option in next, DropdownArray do
  471.                 PageLibrary.AddButton(Option, function()
  472.                     Callback(Option)
  473.                     DropdownLabel.Text = Text..": "..Option
  474.                 end, DropdownFrame, OptionIndex < #DropdownArray)
  475.             end
  476.            
  477.             DropdownExpander.MouseButton1Down:Connect(function()
  478.                 DropdownToggle = not DropdownToggle
  479.                 Tween(DropdownContainer, {Size = DropdownToggle and UDim2.new(1,0,0,20+(#DropdownArray*20)) or UDim2.new(1,0,0,20)})
  480.                 Tween(DropdownExpander, {Rotation = DropdownToggle and 135 or 0})
  481.             end)
  482.         end
  483.        
  484.         function PageLibrary.AddColourPicker(Text, DefaultColour, Callback)
  485.             local DefaultColour = DefaultColour or Color3.fromRGB(255,255,255)
  486.            
  487.             local ColourDictionary = {
  488.                 white = Color3.fromRGB(255,255,255),
  489.                 black = Color3.fromRGB(0,0,0),
  490.                 red = Color3.fromRGB(255,0,0),
  491.                 green = Color3.fromRGB(0,255,0),
  492.                 blue = Color3.fromRGB(0,0,255)
  493.             }
  494.            
  495.             if typeof(DefaultColour) == "table" then
  496.                 DefaultColour = Color3.fromRGB(DefaultColour[1] or 255, DefaultColour[2] or 255, DefaultColour[3] or 255)
  497.             elseif typeof(DefaultColour) == "string" then
  498.                 DefaultColour = ColourDictionary[DefaultColour:lower()] or ColourDictionary["white"]
  499.             end
  500.            
  501.             local PickerContainer = Frame()
  502.             PickerContainer.ClipsDescendants = true
  503.             PickerContainer.Size = UDim2.new(1,0,0,20)
  504.             PickerContainer.Name = Text.."COLOURPICKER"
  505.             PickerContainer.BackgroundTransparency = 1
  506.             PickerContainer.Parent = DisplayPage
  507.            
  508.             local ColourTracker = Instance.new("Color3Value")
  509.             ColourTracker.Value = DefaultColour
  510.             ColourTracker.Parent = PickerContainer
  511.            
  512.             local PickerLeftSide, PickerRightSide, PickerFrame = RoundBox(5), RoundBox(5), RoundBox(5)
  513.            
  514.             PickerLeftSide.Size = UDim2.new(1,-22,1,0)
  515.             PickerLeftSide.ImageColor3 = Color3.fromRGB(35,35,35)
  516.             PickerLeftSide.Parent = PickerContainer
  517.            
  518.             PickerRightSide.Size = UDim2.new(0,20,1,0)
  519.             PickerRightSide.Position = UDim2.new(1,-20,0,0)
  520.             PickerRightSide.ImageColor3 = DefaultColour
  521.             PickerRightSide.Parent = PickerContainer
  522.            
  523.             PickerFrame.ImageColor3 = Color3.fromRGB(35,35,35)
  524.             PickerFrame.Size = UDim2.new(1,-22,0,60)
  525.             PickerFrame.Position = UDim2.new(0,0,0,20)
  526.             PickerFrame.Parent = PickerContainer
  527.            
  528.             local PickerList = Instance.new("UIListLayout")
  529.             PickerList.SortOrder = Enum.SortOrder.LayoutOrder
  530.             PickerList.Parent = PickerFrame
  531.            
  532.             local RedPicker = PageLibrary.AddSlider("R", {Min = 0, Max = 255, Def = ColourTracker.Value.R * 255}, function(Value)
  533.                 ColourTracker.Value = Color3.fromRGB(Value, ColourTracker.Value.G * 255, ColourTracker.Value.B * 255)
  534.                 Callback(ColourTracker.Value)
  535.             end, PickerFrame)
  536.            
  537.             local BluePicker = PageLibrary.AddSlider("G", {Min = 0, Max = 255, Def = ColourTracker.Value.G * 255}, function(Value)
  538.                 ColourTracker.Value = Color3.fromRGB(ColourTracker.Value.R * 255, Value, ColourTracker.Value.B * 255)
  539.                 Callback(ColourTracker.Value)
  540.             end, PickerFrame)
  541.            
  542.             local GreenPicker = PageLibrary.AddSlider("B", {Min = 0, Max = 255, Def = ColourTracker.Value.B * 255}, function(Value)
  543.                 ColourTracker.Value = Color3.fromRGB(ColourTracker.Value.R * 255, ColourTracker.Value.G * 255, Value)
  544.                 Callback(ColourTracker.Value)
  545.             end, PickerFrame)
  546.            
  547.             local EffectLeft, EffectRight = Frame(), Frame()
  548.            
  549.             EffectLeft.BackgroundColor3 = Color3.fromRGB(35,35,35)
  550.             EffectLeft.Position = UDim2.new(1,-5,0,0)
  551.             EffectLeft.Size = UDim2.new(0,5,1,0)
  552.             EffectLeft.Parent = PickerLeftSide
  553.            
  554.             EffectRight.BackgroundColor3 = DefaultColour
  555.             EffectRight.Size = UDim2.new(0,5,1,0)
  556.             EffectRight.Parent = PickerRightSide
  557.            
  558.             local PickerLabel = TextLabel(Text, 12)
  559.             PickerLabel.Size = UDim2.new(1,0,0,20)
  560.             PickerLabel.Parent = PickerLeftSide
  561.            
  562.             ColourTracker:GetPropertyChangedSignal("Value"):Connect(function()
  563.                 local NewValue = ColourTracker.Value
  564.                 EffectRight.BackgroundColor3 = NewValue
  565.                 PickerRightSide.ImageColor3 = NewValue
  566.             end)
  567.            
  568.             local PickerToggle = false
  569.            
  570.             local PickerButton = TextButton("")
  571.             PickerButton.Parent = PickerRightSide
  572.            
  573.             PickerButton.MouseButton1Down:Connect(function()
  574.                 PickerToggle = not PickerToggle
  575.                 Tween(PickerContainer, {Size = PickerToggle and UDim2.new(1,0,0,80) or UDim2.new(1,0,0,20)})
  576.             end)
  577.         end
  578.        
  579.         function PageLibrary.AddSlider(Text, ConfigurationDictionary, Callback, Parent)
  580.             local Configuration = ConfigurationDictionary
  581.             local Minimum = Configuration.Minimum or Configuration.minimum or Configuration.Min or Configuration.min
  582.             local Maximum = Configuration.Maximum or Configuration.maximum or Configuration.Max or Configuration.max
  583.             local Default = Configuration.Default or Configuration.default or Configuration.Def or Configuration.def
  584.            
  585.             if Minimum > Maximum then
  586.                 local StoreValue = Minimum
  587.                 Minimum = Maximum
  588.                 Maximum = StoreValue
  589.             end
  590.            
  591.             Default = math.clamp(Default, Minimum, Maximum)
  592.            
  593.             local DefaultScale = Default/Maximum
  594.            
  595.             local SliderContainer = Frame()
  596.             SliderContainer.Name = Text.."SLIDER"
  597.             SliderContainer.Size = UDim2.new(1,0,0,20)
  598.             SliderContainer.BackgroundTransparency = 1
  599.             SliderContainer.Parent = Parent or DisplayPage
  600.            
  601.             local SliderForeground = RoundBox(5)
  602.             SliderForeground.Name = "SliderForeground"
  603.             SliderForeground.ImageColor3 = Color3.fromRGB(35,35,35)
  604.             SliderForeground.Size = UDim2.new(1,0,1,0)
  605.             SliderForeground.Parent = SliderContainer
  606.            
  607.             local SliderButton = TextButton(Text..": "..Default)
  608.             SliderButton.Size = UDim2.new(1,0,1,0)
  609.             SliderButton.ZIndex = 6
  610.             SliderButton.Parent = SliderForeground
  611.            
  612.             local SliderFill = RoundBox(5)
  613.             SliderFill.Size = UDim2.new(DefaultScale,0,1,0)
  614.             SliderFill.ImageColor3 = Color3.fromRGB(70,70,70)
  615.             SliderFill.ZIndex = 5
  616.             SliderFill.ImageTransparency = 0.7
  617.             SliderFill.Parent = SliderButton
  618.            
  619.             SliderButton.MouseButton1Down:Connect(function()
  620.                 Tween(SliderFill, {ImageTransparency = 0.5})
  621.                 local X, Y, XScale, YScale = GetXY(SliderButton)
  622.                 local Value = math.floor(Minimum + ((Maximum - Minimum) * XScale))
  623.                 Callback(Value)
  624.                 SliderButton.Text = Text..": "..tostring(Value)
  625.                 local TargetSize = UDim2.new(XScale,0,1,0)
  626.                 Tween(SliderFill, {Size = TargetSize})
  627.                 local SliderMove, SliderKill
  628.                 SliderMove = Mouse.Move:Connect(function()
  629.                     Tween(SliderFill, {ImageTransparency = 0.5})
  630.                     local X, Y, XScale, YScale = GetXY(SliderButton)
  631.                     local Value = math.floor(Minimum + ((Maximum - Minimum) * XScale))
  632.                     Callback(Value)
  633.                     SliderButton.Text = Text..": "..tostring(Value)
  634.                     local TargetSize = UDim2.new(XScale,0,1,0)
  635.                     Tween(SliderFill, {Size = TargetSize})
  636.                 end)
  637.                 SliderKill = UserInputService.InputEnded:Connect(function(UserInput)
  638.                     if UserInput.UserInputType == Enum.UserInputType.MouseButton1 then
  639.                         Tween(SliderFill, {ImageTransparency = 0.7})
  640.                         SliderMove:Disconnect()
  641.                         SliderKill:Disconnect()
  642.                     end
  643.                 end)
  644.             end)
  645.         end
  646.        
  647.         function PageLibrary.AddToggle(Text, Default, Callback)
  648.             local ThisToggle = Default or false
  649.            
  650.             local ToggleContainer = Frame()
  651.             ToggleContainer.Name = Text.."TOGGLE"
  652.             ToggleContainer.Size = UDim2.new(1,0,0,20)
  653.             ToggleContainer.BackgroundTransparency = 1
  654.             ToggleContainer.Parent = DisplayPage
  655.            
  656.             local ToggleLeftSide, ToggleRightSide, EffectFrame, RightTick = RoundBox(5), RoundBox(5), Frame(), TickIcon()
  657.             local FlatLeft, FlatRight = Frame(), Frame()
  658.            
  659.             ToggleLeftSide.Size = UDim2.new(1,-22,1,0)
  660.             ToggleLeftSide.ImageColor3 = Color3.fromRGB(35,35,35)
  661.             ToggleLeftSide.Parent = ToggleContainer
  662.            
  663.             ToggleRightSide.Position = UDim2.new(1,-20,0,0)
  664.             ToggleRightSide.Size = UDim2.new(0,20,1,0)
  665.             ToggleRightSide.ImageColor3 = Color3.fromRGB(45,45,45)
  666.             ToggleRightSide.Parent = ToggleContainer
  667.            
  668.             FlatLeft.BackgroundColor3 = Color3.fromRGB(35,35,35)
  669.             FlatLeft.Size = UDim2.new(0,5,1,0)
  670.             FlatLeft.Position = UDim2.new(1,-5,0,0)
  671.             FlatLeft.Parent = ToggleLeftSide
  672.            
  673.             FlatRight.BackgroundColor3 = Color3.fromRGB(45,45,45)
  674.             FlatRight.Size = UDim2.new(0,5,1,0)
  675.             FlatRight.Parent = ToggleRightSide
  676.            
  677.             EffectFrame.BackgroundColor3 = ThisToggle and Color3.fromRGB(0,255,109) or Color3.fromRGB(255,160,160)
  678.             EffectFrame.Position = UDim2.new(1,-22,0.2,0)
  679.             EffectFrame.Size = UDim2.new(0,2,0.6,0)
  680.             EffectFrame.Parent = ToggleContainer
  681.            
  682.             RightTick.ImageTransparency = ThisToggle and 0 or 1
  683.             RightTick.Parent = ToggleRightSide
  684.            
  685.             local ToggleButton = TextButton(Text, 12)
  686.             ToggleButton.Name = "ToggleButton"
  687.             ToggleButton.Size = UDim2.new(1,0,1,0)
  688.             ToggleButton.Parent = ToggleLeftSide
  689.            
  690.             ToggleButton.MouseButton1Down:Connect(function()
  691.                 ThisToggle = not ThisToggle
  692.                 Tween(EffectFrame, {BackgroundColor3 = ThisToggle and Color3.fromRGB(0,255,109) or Color3.fromRGB(255,160,160)})
  693.                 Tween(RightTick, {ImageTransparency = ThisToggle and 0 or 1})
  694.                 Callback(ThisToggle)
  695.             end)   
  696.         end
  697.        
  698.         return PageLibrary
  699.     end
  700.    
  701.     return TabLibrary
  702. end
  703.  
  704. return UILibrary
Advertisement
Add Comment
Please, Sign In to add comment