9_cVv

ui library v3

Sep 6th, 2021 (edited)
1,284
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 17.44 KB | None | 0 0
  1. function dragify(Frame)
  2.     local dragToggle = nil
  3.     local dragSpeed = .25
  4.     local dragInput = nil
  5.     local dragStart = nil
  6.     local startPos = nil
  7.  
  8.     local function updateInput(input)
  9.         local Delta = input.Position - dragStart
  10.         local Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + Delta.X, startPos.Y.Scale, startPos.Y.Offset + Delta.Y)
  11.         game:GetService("TweenService"):Create(Frame, TweenInfo.new(dragSpeed), {Position = Position}):Play()
  12.     end
  13.  
  14.     Frame.InputBegan:Connect(function(input)
  15.         if (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then
  16.           dragToggle = true
  17.           dragStart = input.Position
  18.           startPos = Frame.Position
  19.           input.Changed:Connect(function()
  20.                 if (input.UserInputState == Enum.UserInputState.End) then
  21.                   dragToggle = false
  22.                 end
  23.            end)
  24.         end
  25.     end)
  26.  
  27.     Frame.InputChanged:Connect(function(input)
  28.         if (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then
  29.           dragInput = input
  30.         end
  31.     end)
  32.  
  33.     game:GetService("UserInputService").InputChanged:Connect(function(input)
  34.         if input == dragInput and dragToggle then
  35.           updateInput(input)
  36.         end
  37.     end)
  38. end
  39.  
  40. function create_gui()
  41.     local UILibrary3 = Instance.new('ScreenGui')
  42.     local section = Instance.new'TextLabel'
  43.     local frame = Instance.new'Frame'
  44.     local UICorner = Instance.new'UICorner'
  45.     local tempbutton = Instance.new'TextButton'
  46.     local UIListLayout = Instance.new'UIListLayout'
  47.     local templabel = Instance.new'TextLabel'
  48.     local tempbox = Instance.new'TextBox'
  49.     local tempdropdown = Instance.new'TextButton'
  50.     local indicator = Instance.new'TextButton'
  51.     local container = Instance.new'Frame'
  52.     local UIListLayout_2 = Instance.new'UIListLayout'
  53.     local UICorner_2 = Instance.new'UICorner'
  54.     local __ = Instance.new'Frame'
  55.     local close = Instance.new'TextButton'
  56.     local minimize = Instance.new'TextButton'
  57.  
  58.     UILibrary3.Name = 'UI-Library 3'
  59.     UILibrary3.Parent = game:GetService'Players'.LocalPlayer:WaitForChild'PlayerGui'
  60.     UILibrary3.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
  61.  
  62.     section.BackgroundColor3 = Color3.fromRGB(29.000000171363, 29.000000171363, 29.000000171363)
  63.     section.BorderSizePixel = 0
  64.     section.LayoutOrder = 1
  65.     section.Name = 'section'
  66.     section.Parent = UILibrary3
  67.     section.Position = UDim2.new(0.0186824463, 0, 0.0133657409, 0)
  68.     section.Size = UDim2.new(0, 284, 0, 25)
  69.     section.Visible = false
  70.     section.Font = Enum.Font.TitilliumWeb
  71.     section.Text = 'Name'
  72.     section.TextColor3 = Color3.fromRGB(255, 255, 255)
  73.     section.TextScaled = true
  74.     section.TextSize = 14
  75.     section.TextWrapped = true
  76.  
  77.     frame.BackgroundColor3 = Color3.fromRGB(23.000000528991, 23.000000528991, 23.000000528991)
  78.     frame.BorderSizePixel = 0
  79.     frame.LayoutOrder = 1
  80.     frame.Name = 'frame'
  81.     frame.Parent = section
  82.     frame.Position = UDim2.new(0, 0, 1.04166663, 0)
  83.     frame.Size = UDim2.new(0, 284, 0, 363)
  84.  
  85.     UICorner.CornerRadius = UDim.new(0, 5)
  86.     UICorner.Parent = frame
  87.  
  88.     tempbutton.BackgroundColor3 = Color3.fromRGB(15.000000055879, 15.000000055879, 15.000000055879)
  89.     tempbutton.BorderSizePixel = 0
  90.     tempbutton.Name = 'tempbutton'
  91.     tempbutton.Parent = frame
  92.     tempbutton.Position = UDim2.new(0, 0, 0.0165289249, 0)
  93.     tempbutton.Size = UDim2.new(0, 284, 0, 35)
  94.     tempbutton.Visible = false
  95.     tempbutton.Font = Enum.Font.TitilliumWeb
  96.     tempbutton.Text = 'button'
  97.     tempbutton.TextColor3 = Color3.fromRGB(255, 255, 255)
  98.     tempbutton.TextScaled = true
  99.     tempbutton.TextSize = 14
  100.     tempbutton.TextWrapped = true
  101.  
  102.     UIListLayout.Parent = frame
  103.     UIListLayout.SortOrder = Enum.SortOrder.LayoutOrder
  104.  
  105.     templabel.BackgroundColor3 = Color3.fromRGB(15.000000055879, 15.000000055879, 15.000000055879)
  106.     templabel.BorderSizePixel = 0
  107.     templabel.Name = 'templabel'
  108.     templabel.Parent = frame
  109.     templabel.Position = UDim2.new(0, 0, 0.0964187309, 0)
  110.     templabel.Size = UDim2.new(0, 284, 0, 35)
  111.     templabel.Visible = false
  112.     templabel.Font = Enum.Font.TitilliumWeb
  113.     templabel.Text = 'label'
  114.     templabel.TextColor3 = Color3.fromRGB(255, 255, 255)
  115.     templabel.TextScaled = true
  116.     templabel.TextSize = 14
  117.     templabel.TextWrapped = true
  118.  
  119.     tempbox.BackgroundColor3 = Color3.fromRGB(15.000000055879, 15.000000055879, 15.000000055879)
  120.     tempbox.BorderSizePixel = 0
  121.     tempbox.Name = 'tempbox'
  122.     tempbox.Parent = frame
  123.     tempbox.Position = UDim2.new(0, 0, 0.192837462, 0)
  124.     tempbox.Size = UDim2.new(0, 284, 0, 35)
  125.     tempbox.Visible = false
  126.     tempbox.Font = Enum.Font.TitilliumWeb
  127.     tempbox.PlaceholderColor3 = Color3.fromRGB(155.00000596046, 155.00000596046, 155.00000596046)
  128.     tempbox.PlaceholderText = 'box'
  129.     tempbox.Text = ''
  130.     tempbox.TextColor3 = Color3.fromRGB(255, 255, 255)
  131.     tempbox.TextScaled = true
  132.     tempbox.TextSize = 14
  133.     tempbox.TextWrapped = true
  134.  
  135.     tempdropdown.BackgroundColor3 = Color3.fromRGB(15.000000055879, 15.000000055879, 15.000000055879)
  136.     tempdropdown.BorderSizePixel = 0
  137.     tempdropdown.Name = 'tempdropdown'
  138.     tempdropdown.Parent = frame
  139.     tempdropdown.Position = UDim2.new(0, 0, 0.0165289249, 0)
  140.     tempdropdown.Size = UDim2.new(0, 284, 0, 35)
  141.     tempdropdown.Visible = false
  142.     tempdropdown.Font = Enum.Font.TitilliumWeb
  143.     tempdropdown.Text = 'dropdown'
  144.     tempdropdown.TextColor3 = Color3.fromRGB(255, 255, 255)
  145.     tempdropdown.TextScaled = true
  146.     tempdropdown.TextSize = 14
  147.     tempdropdown.TextWrapped = true
  148.  
  149.     indicator.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  150.     indicator.BackgroundTransparency = 1
  151.     indicator.BorderSizePixel = 0
  152.     indicator.LayoutOrder = 1
  153.     indicator.Name = 'indicator'
  154.     indicator.Parent = tempdropdown
  155.     indicator.Position = UDim2.new(0.911764681, 0, 0, 0)
  156.     indicator.Rotation = 90
  157.     indicator.Size = UDim2.new(0, 25, 0, 31)
  158.     indicator.Font = Enum.Font.Ubuntu
  159.     indicator.Text = '<'
  160.     indicator.TextColor3 = Color3.fromRGB(255, 255, 255)
  161.     indicator.TextSize = 17
  162.     indicator.TextWrapped = true
  163.  
  164.     container.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  165.     container.BackgroundTransparency = 1
  166.     container.BorderSizePixel = 0
  167.     container.Name = 'container'
  168.     container.Parent = tempdropdown
  169.     container.Position = UDim2.new(0, 0, 1, 0)
  170.     container.Size = UDim2.new(0, 285, 0, 0)
  171.  
  172.     UIListLayout_2.Parent = container
  173.     UIListLayout_2.SortOrder = Enum.SortOrder.LayoutOrder
  174.  
  175.     UICorner_2.CornerRadius = UDim.new(0, 5)
  176.     UICorner_2.Parent = section
  177.  
  178.     __.BackgroundColor3 = Color3.fromRGB(29.000000171363, 29.000000171363, 29.000000171363)
  179.     __.BorderSizePixel = 0
  180.     __.Name = '__'
  181.     __.Parent = section
  182.     __.Position = UDim2.new(0, 0, 0.791666687, 0)
  183.     __.Size = UDim2.new(0, 284, 0, 12)
  184.  
  185.     close.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  186.     close.BackgroundTransparency = 1
  187.     close.BorderSizePixel = 0
  188.     close.LayoutOrder = 1
  189.     close.Name = 'close'
  190.     close.Parent = section
  191.     close.Position = UDim2.new(0.918806911, 0, 0, 0)
  192.     close.Size = UDim2.new(0, 25, 0, 31)
  193.     close.Font = Enum.Font.Ubuntu
  194.     close.Text = 'X'
  195.     close.TextColor3 = Color3.fromRGB(255, 255, 255)
  196.     close.TextSize = 17
  197.     close.TextWrapped = true
  198.  
  199.     minimize.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  200.     minimize.BackgroundTransparency = 1
  201.     minimize.BorderSizePixel = 0
  202.     minimize.LayoutOrder = 1
  203.     minimize.Name = 'minimize'
  204.     minimize.Parent = section
  205.     minimize.Position = UDim2.new(0.830778718, 0, 0, 0)
  206.     minimize.Size = UDim2.new(0, 25, 0, 31)
  207.     minimize.Font = Enum.Font.Ubuntu
  208.     minimize.Text = '-'
  209.     minimize.TextColor3 = Color3.fromRGB(255, 255, 255)
  210.     minimize.TextSize = 17
  211.     minimize.TextWrapped = true
  212.  
  213.     pcall(function()UILibrary3.Parent=game:GetService'CoreGui';--[[syn.protect_gui(UILibrary3)]]end)
  214.     return UILibrary3, section, tempbutton, templabel, tempbox, tempdropdown
  215. end
  216.  
  217. function tween(object, tweentime, info)
  218.     game:GetService'TweenService':Create(object, TweenInfo.new(tweentime, 8), info):Play()
  219. end
  220.  
  221. local main = {}
  222. function main:CreateGui(name)
  223.     local gui, section, tempbutton, templabel, tempbox, tempdropdown = create_gui()
  224.     local sections = {}
  225.     local firstsection = nil
  226.     local createsections = {}
  227.  
  228.     gui.Name = name or 'Gui'
  229.  
  230.     function createsections:CreateSection(name)
  231.         local section = section:Clone()
  232.         local open = true
  233.         local closeEvent = Instance.new'BindableEvent'
  234.         local minimizeEvent = Instance.new'BindableEvent'
  235.         section.Parent = gui
  236.         section.Visible = true
  237.         section.Name = name or 'Section'
  238.         section.Text = name or 'Section'
  239.         dragify(section)
  240.  
  241.         section.close.MouseButton1Click:connect(function()
  242.             closeEvent:Fire()
  243.             if open then
  244.                 for a,object in pairs(section.frame:GetChildren()) do
  245.                     pcall(function()
  246.                         tween(object, .35, {TextTransparency = 1})
  247.                         tween(object, .35, {BackgroundTransparency = 1})
  248.                     end)
  249.                 end
  250.                 tween(section.frame, .45, {Size = UDim2.new(0, 284, 0, 0)})
  251.                 tween(section['__'], .55, {BackgroundTransparency = 1})
  252.                 tween(section, .65, {TextTransparency = 1})
  253.                 tween(section, .65, {BackgroundTransparency = 1})
  254.                 tween(section.close, .65, {TextTransparency = 1})
  255.                 tween(section.close, .65, {BackgroundTransparency = 1})
  256.                 tween(section.minimize, .65, {TextTransparency = 1})
  257.                 tween(section.minimize, .65, {BackgroundTransparency = 1})
  258.                 wait(.65)
  259.             end
  260.             section:Destroy()
  261.             pcall(function()
  262.                 table.remove(sections, table.find(sections, section))
  263.             end)
  264.         end)
  265.         section.minimize.MouseButton1Click:connect(function()
  266.             open = not open
  267.             minimizeEvent:Fire(open)
  268.             if open then
  269.                 section.minimize.Text = '-'
  270.                 for a,object in pairs(section.frame:GetChildren()) do
  271.                     pcall(function()
  272.                         tween(object, .35, {TextTransparency = 0})
  273.                         tween(object, .35, {BackgroundTransparency = 0})
  274.                     end)
  275.                 end
  276.                 tween(section.frame, .45, {Size = UDim2.new(0, 284, 0, 363)})
  277.             else
  278.                 section.minimize.Text = '+'
  279.                 for a,object in pairs(section.frame:GetChildren()) do
  280.                     pcall(function()
  281.                         tween(object, .35, {TextTransparency = 1})
  282.                         tween(object, .35, {BackgroundTransparency = 1})
  283.                     end)
  284.                 end
  285.                 tween(section.frame, .45, {Size = UDim2.new(0, 284, 0, 0)})
  286.             end
  287.         end)
  288.         local createobjects = {}
  289.  
  290.         function createobjects:TextButton(name, func)
  291.             local button = tempbutton:Clone()
  292.  
  293.             button.Name,button.Text = name or 'button',name or 'button'
  294.             button.Visible = true
  295.             button.Parent = section.frame
  296.             if func then
  297.                 button.MouseButton1Click:connect(func)
  298.             end
  299.             return button
  300.         end
  301.         function createobjects:TextLabel(name)
  302.             local label = templabel:Clone()
  303.  
  304.             label.Name,label.Text = name or 'label',name or 'label'
  305.             label.Visible = true
  306.             label.Parent = section.frame
  307.  
  308.             return label
  309.         end
  310.         function createobjects:TextBox(name, placeholder, func)
  311.             local box = tempbox:Clone()
  312.  
  313.             box.Name,box.Text,box.PlaceholderText = name or 'box', '',placeholder or name or 'box'
  314.             box.Visible = true
  315.             box.Parent = section.frame
  316.  
  317.             if func then
  318.                 box:GetPropertyChangedSignal'Text':connect(func)
  319.             end
  320.             return box
  321.         end
  322.         function createobjects:DropDown(name, objects)
  323.             local dropdownOpen = false
  324.             local debounce = false
  325.             local dropdown = tempdropdown:Clone()
  326.             dropdown.Name,dropdown.Text = name or 'dropdown', name or 'dropdown'
  327.             dropdown.Visible = true
  328.             dropdown.Parent = section.frame
  329.  
  330.             dropdown.container.ChildAdded:connect(function(child)
  331.                 if child then
  332.                     child.Visible = false
  333.                     child.TextTransparency, child.BackgroundTransparency = 1,1
  334.                 end
  335.             end)
  336.             if objects then
  337.                 for i,object in pairs(objects) do
  338.                     if object then
  339.                         object.Parent = dropdown.container
  340.                     end
  341.                 end
  342.             end
  343.  
  344.             closeEvent.Event:connect(function()
  345.                 dropdown.indicator.Rotation = 90
  346.                 for i,object in pairs(dropdown.container:GetChildren()) do
  347.                     if not object:IsA'UIListLayout' then
  348.                         tween(object, .5, {TextTransparency = 1})
  349.                         tween(object, .5, {BackgroundTransparency = 1})
  350.                     end
  351.                 end
  352.                 wait(.5)
  353.                 for i,object in pairs(dropdown.container:GetChildren()) do
  354.                     if not object:IsA'UIListLayout' then
  355.                         object.Visible = false
  356.                     end
  357.                 end
  358.                 tween(dropdown.container, .45, {Size = UDim2.new(0, 285, 0, 0)})
  359.             end)
  360.             minimizeEvent.Event:connect(function(toggle)
  361.                 if toggle then
  362.                     local offset = 0
  363.                     for i,object in pairs(dropdown.container:GetChildren()) do
  364.                         if not object:IsA'UIListLayout' then
  365.                             offset += object.Size.X.Offset
  366.                             object.Visible = true
  367.                             tween(object, .5, {TextTransparency = 0})
  368.                             tween(object, .5, {BackgroundTransparency = 0})
  369.                         end
  370.                     end
  371.                     tween(dropdown.container, .45, {Size = UDim2.new(0, 285, 0, offset)})
  372.                 else
  373.                     for i,object in pairs(dropdown.container:GetChildren()) do
  374.                         if not object:IsA'UIListLayout' then
  375.                             tween(object, .5, {TextTransparency = 1})
  376.                             tween(object, .5, {BackgroundTransparency = 1})
  377.                         end
  378.                     end
  379.                     wait(.5)
  380.                     for i,object in pairs(dropdown.container:GetChildren()) do
  381.                         if not object:IsA'UIListLayout' then
  382.                             object.Visible = false
  383.                         end
  384.                     end
  385.                     tween(dropdown.container, .45, {Size = UDim2.new(0, 285, 0, 0)})
  386.                 end
  387.             end)
  388.  
  389.             local function toggle()
  390.                 if not debounce then
  391.                     debounce = true
  392.                     dropdownOpen = not dropdownOpen
  393.                     if dropdownOpen then
  394.                         dropdown.indicator.Rotation = -90
  395.                         local offset = 0
  396.                         for i,object in pairs(dropdown.container:GetChildren()) do
  397.                             if not object:IsA'UIListLayout' then
  398.                                 offset += object.Size.X.Offset
  399.                                 object.Visible = true
  400.                                 tween(object, .5, {TextTransparency = 0})
  401.                                 tween(object, .5, {BackgroundTransparency = 0})
  402.                             end
  403.                         end
  404.                         tween(dropdown.container, .45, {Size = UDim2.new(0, 285, 0, offset)})
  405.                     else
  406.                         dropdown.indicator.Rotation = 90
  407.                         for i,object in pairs(dropdown.container:GetChildren()) do
  408.                             if not object:IsA'UIListLayout' then
  409.                                 tween(object, .5, {TextTransparency = 1})
  410.                                 tween(object, .5, {BackgroundTransparency = 1})
  411.                             end
  412.                         end
  413.                         wait(.5)
  414.                         for i,object in pairs(dropdown.container:GetChildren()) do
  415.                             if not object:IsA'UIListLayout' then
  416.                                 object.Visible = false
  417.                             end
  418.                         end
  419.                         tween(dropdown.container, .45, {Size = UDim2.new(0, 285, 0, 0)})
  420.                     end
  421.                     wait(.5)
  422.                     debounce = false
  423.                 end
  424.             end
  425.             dropdown.MouseButton1Click:connect(toggle)
  426.             dropdown.indicator.MouseButton1Click:connect(toggle)
  427.         end
  428.         table.insert(sections, section)
  429.         if not firstsection then
  430.             firstsection = section
  431.         end
  432.         section.Position = UDim2.new(-.12, #sections  * 300, 0, 0)
  433.         return createobjects
  434.     end
  435.     return createsections
  436. end
  437.  
  438. return main
Add Comment
Please, Sign In to add comment