Advertisement
StarTechHub

Untitled

Apr 10th, 2020
405
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 7.12 KB | None | 0 0
  1. local lib = {}
  2. local UIS = game:GetService("UserInputService")
  3. function dragify(Frame)
  4.     dragToggle = nil
  5.     local dragSpeed = 10
  6.     dragInput = nil
  7.     dragStart = nil
  8.     local dragPos = nil
  9.     function updateInput(input)
  10.         local Delta = input.Position - dragStart
  11.         local Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + Delta.X, startPos.Y.Scale, startPos.Y.Offset + Delta.Y)
  12.         game:GetService("TweenService"):Create(Frame, TweenInfo.new(0.25), {Position = Position}):Play()
  13.     end
  14.     Frame.InputBegan:Connect(function(input)
  15.         if (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) and UIS:GetFocusedTextBox() == nil 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.     Frame.InputChanged:Connect(function(input)
  27.         if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
  28.             dragInput = input
  29.         end
  30.     end)
  31.     game:GetService("UserInputService").InputChanged:Connect(function(input)
  32.         if input == dragInput and dragToggle then
  33.             updateInput(input)
  34.         end
  35.     end)
  36. end
  37.  
  38.  
  39.  
  40. function lib:CreateMain(uiname)
  41. local main = Instance.new("ScreenGui")
  42. local mainframe = Instance.new("Frame")
  43. local tabs = Instance.new("Frame")
  44. local tabholder = Instance.new("Frame")
  45. local UIListLayout = Instance.new("UIListLayout")
  46. local borderline = Instance.new("Frame")
  47. local borderline_2 = Instance.new("Frame")
  48. local borderline_3 = Instance.new("Frame")
  49. local name = Instance.new("TextLabel")
  50. local tabframeholder = Instance.new('Folder')
  51.  
  52. local open = main
  53.  
  54. main.Name = "main"
  55. main.Parent = game.CoreGui
  56.  
  57. mainframe.Name = "mainframe"
  58. mainframe.Parent = main
  59. mainframe.BackgroundColor3 = Color3.new(0.164706, 0.164706, 0.164706)
  60. mainframe.BorderColor3 = Color3.new(0.105882, 0.105882, 0.105882)
  61. mainframe.BorderSizePixel = 2
  62. mainframe.Position = UDim2.new(0, 169, 0, 102)
  63. mainframe.Size = UDim2.new(0, 575, 0, 275)
  64.  
  65.  
  66.  
  67. dragify(mainframe)
  68.  
  69. borderline_3.Name = "borderline"
  70. borderline_3.Parent = mainframe
  71. borderline_3.BackgroundColor3 = Color3.new(0.203922, 0.203922, 0.203922)
  72. borderline_3.BorderSizePixel = 0
  73. borderline_3.Position = UDim2.new(-0.00178891385, 0, 0.10095942, 0)
  74. borderline_3.Size = UDim2.new(0, 124, 0, 5)
  75. borderline_3.ZIndex = 2
  76.  
  77. tabs.Name = "tabs"
  78. tabs.Parent = mainframe
  79. tabs.BackgroundColor3 = Color3.new(0.172549, 0.172549, 0.172549)
  80. tabs.BorderSizePixel = 0
  81. tabs.Position = UDim2.new(0.00408165762, 0, 0.119409539, 0)
  82. tabs.Size = UDim2.new(0, 116, 0, 238)
  83.  
  84.  
  85. tabholder.Name = "tabholder"
  86. tabholder.Parent = tabs
  87. tabholder.BackgroundColor3 = Color3.new(1, 1, 1)
  88. tabholder.BackgroundTransparency = 1
  89. tabholder.Position = UDim2.new(-0.00862068962, 0, 0.018018065, 0)
  90. tabholder.Size = UDim2.new(0, 121, 0, 237)
  91.  
  92. UIListLayout.Parent = tabholder
  93. UIListLayout.SortOrder = Enum.SortOrder.LayoutOrder
  94.  
  95. borderline.Name = "borderline_1"
  96. borderline.Parent = mainframe
  97. borderline.BackgroundColor3 = Color3.new(0.203922, 0.203922, 0.203922)
  98. borderline.BorderSizePixel = 0
  99. borderline.Position = UDim2.new(0.213887751, 0, 0, 0)
  100. borderline.Size = UDim2.new(0, 5, 0, 271)
  101. borderline.ZIndex = 2
  102.  
  103. borderline_2.Name = "borderline_2"
  104. borderline_2.Parent = mainframe
  105. borderline_2.BackgroundColor3 = Color3.new(0.203922, 0.203922, 0.203922)
  106. borderline_2.BorderSizePixel = 0
  107. borderline_2.Position = UDim2.new(0.221223041, 0, 0.0825092122, 0)
  108. borderline_2.Size = UDim2.new(0, 447, 0, 5)
  109. borderline_2.ZIndex = 2
  110.  
  111.  
  112. name.Name = "name"
  113. name.Parent = mainframe
  114. name.BackgroundColor3 = Color3.new(1, 1, 1)
  115. name.BackgroundTransparency = 1
  116. name.Size = UDim2.new(0, 117, 0, 27)
  117. name.ZIndex = 2
  118. name.Font = Enum.Font.GothamSemibold
  119. name.Text = uiname
  120. name.TextColor3 = Color3.new(1, 1, 1)
  121. name.TextSize = 15
  122.  
  123.  
  124. tabframeholder.Name = 'tabframeholder'
  125. tabframeholder.Parent = mainframe
  126.  
  127.     local sectionlibrary = {}
  128.     local sectionCount = 0
  129.     function sectionlibrary:CreateSection(sectionname)
  130.         local tab = Instance.new("TextButton")
  131.         local tabframe = Instance.new("ScrollingFrame")
  132.         local tabline = Instance.new("Frame")
  133.         local UIPadding = Instance.new("UIPadding")
  134.         local UIListLayout = Instance.new('UIListLayout')
  135.        
  136.        
  137.        
  138.         tab.Name = tostring(sectionname)
  139.         tab.Parent = tabholder
  140.         tab.BackgroundColor3 = Color3.new(1, 1, 1)
  141.         tab.BackgroundTransparency = 1
  142.         tab.Position = UDim2.new(-0.00862068962, 0, 0.227731258, 0)
  143.         tab.Size = UDim2.new(0, 117, 0, 28)
  144.         tab.Font = Enum.Font.Gotham
  145.         tab.Text = sectionname
  146.         tab.TextColor3 = Color3.new(1, 1, 1)
  147.         tab.TextSize = 14
  148.  
  149.    
  150.         tabframe.Name = tostring(sectionname)
  151.         tabframe.Parent = tabframeholder
  152.         tabframe.BackgroundColor3 = Color3.new(1, 1, 1)
  153.         tabframe.BackgroundTransparency = 1
  154.         tabframe.ClipsDescendants = true
  155.         tabframe.Visible = true
  156.         tabframe.CanvasSize = UDim2.new(0, 0, 0, 100)
  157.         tabframe.ScrollBarThickness = 4
  158.         tabframe.Position = UDim2.new(0.222832292, 0, 0.100959472, 0)
  159.         tabframe.Size = UDim2.new(0, 446, 0, 247)
  160.  
  161.         tabline.Name = "tabline"
  162.         tabline.Parent = tab
  163.         tabline.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  164.         tabline.BorderSizePixel = 0
  165.         tabline.Position = UDim2.new(0.102564104, 0, 0.142857134, 0)
  166.         tabline.Size = UDim2.new(0, 2, 0, 20)
  167.  
  168.         UIListLayout.Parent = tabframe
  169.         UIListLayout.SortOrder = Enum.SortOrder.LayoutOrder
  170.         UIListLayout.Padding = UDim.new(0.01, 0)
  171.        
  172.         UIPadding.Parent = tabframe
  173.         UIPadding.PaddingLeft = UDim.new(0, 25)
  174.         UIPadding.PaddingTop = UDim.new(0, 5)
  175.        
  176.         if sectionCount == 0 then
  177.         tabframe:TweenSize(UDim2.new(0, 446, 0, 247), "Out", "Quad", 1, false, nil)
  178.         tabline:TweenSize(UDim2.new(0, 2, 0, 20), "Out", "Quad", 0.3, false, nil)
  179.         else
  180.         tabline.Size = UDim2.new(0, 2, 0, 0)
  181.         tabframe.Size = UDim2.new(0, 409, 0, 0)
  182.         end
  183.  
  184.         sectionCount = sectionCount + 1
  185.  
  186.         tab.MouseButton1Click:Connect(function()
  187.             for i, v in pairs(main.mainframe.tabframeholder:GetChildren()) do
  188.                 if v.Name ~= tostring(sectionname) then
  189.                 v:TweenSize(UDim2.new(0, 409, 0, 0), "Out", "Quad", 0.7, false, nil)
  190.                 end
  191.             end
  192.             for i, v in pairs(main.mainframe.tabs.tabholder:GetChildren()) do
  193.                 if v:IsA("TextButton") and v.Name ~= tostring(sectionname) then
  194.                     v.tabline:TweenSize(UDim2.new(0, 2, 0, 0), "Out", "Quad", 0.3, false, nil)
  195.                 end
  196.             end
  197.             wait(0.9)
  198.             main.mainframe.tabframeholder[tostring(sectionname)]:TweenSize(UDim2.new(0, 446, 0, 247), "Out", "Quad", 1, false, nil)
  199.             main.mainframe.tabs.tabholder[tostring(sectionname)].tabline:TweenSize(UDim2.new(0, 2, 0, 20), "Out", "Quad", 0.3, false, nil)
  200.         end)
  201.        
  202.    
  203.     return sectionlibrary;
  204. end
  205. return lib;
  206. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement