Advertisement
ThomRosa

Library (OPR)

Apr 5th, 2020
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 11.74 KB | None | 0 0
  1. local library = {}
  2. _G.flags = {}
  3.  
  4. function library:Window(name, windowFlag)
  5.     local ScreenGui = Instance.new("ScreenGui")
  6.     local Window = Instance.new("Frame")
  7.     local Top = Instance.new("Frame")
  8.     local Title = Instance.new("TextLabel")
  9.     local Close = Instance.new("TextButton")
  10.     local PageList = Instance.new("ScrollingFrame")
  11.     local PageListLayout = Instance.new("UIGridLayout")
  12.     local mainWindowFlag = windowFlag
  13.     _G.flags[mainWindowFlag] = {}
  14.     _G.flags[mainWindowFlag].pages = {}
  15.  
  16.     ScreenGui.Parent = game.CoreGui
  17.     ScreenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
  18.  
  19.     Window.Name = "Window"
  20.     Window.Parent = ScreenGui
  21.     Window.BackgroundColor3 = Color3.fromRGB(35, 35, 35)
  22.     Window.BorderSizePixel = 0
  23.     Window.Position = UDim2.new(0.316471338, 0, 0.334152341, 0)
  24.     Window.Size = UDim2.new(0, 594, 0, 270)
  25.     Window.Active = true
  26.     Window.Draggable = true
  27.  
  28.     Top.Name = "Top"
  29.     Top.Parent = Window
  30.     Top.BackgroundColor3 = Color3.fromRGB(45, 45, 45)
  31.     Top.BorderSizePixel = 0
  32.     Top.Size = UDim2.new(0, 594, 0, 26)
  33.  
  34.     Title.Name = "Title"
  35.     Title.Parent = Top
  36.     Title.BackgroundColor3 = Color3.fromRGB(45, 45, 45)
  37.     Title.BackgroundTransparency = 1.000
  38.     Title.BorderSizePixel = 0
  39.     Title.Size = UDim2.new(0, 573, 0, 26)
  40.     Title.Font = Enum.Font.SourceSans
  41.     Title.Text = name
  42.     Title.TextColor3 = Color3.fromRGB(170, 170, 170)
  43.     Title.TextSize = 14.000
  44.     Title.TextWrapped = true
  45.  
  46.     Close.Name = "Close"
  47.     Close.Parent = Top
  48.     Close.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  49.     Close.BackgroundTransparency = 1.000
  50.     Close.Position = UDim2.new(0.964646339, 0, 0, 0)
  51.     Close.Size = UDim2.new(0, 21, 0, 26)
  52.     Close.Font = Enum.Font.SourceSans
  53.     Close.Text = "X"
  54.     Close.TextColor3 = Color3.fromRGB(170, 170, 170)
  55.     Close.TextSize = 14.000
  56.     Close.MouseButton1Click:Connect(function()
  57.         ScreenGui:Destroy()
  58.     end)
  59.  
  60.     PageList.Name = "PageList"
  61.     PageList.Parent = Window
  62.     PageList.BackgroundColor3 = Color3.fromRGB(35, 35, 35)
  63.     PageList.BorderSizePixel = 0
  64.     PageList.Position = UDim2.new(0, 0, 0.118518516, 0)
  65.     PageList.Size = UDim2.new(0, 100, 0, 238)
  66.     PageList.CanvasSize = UDim2.new(0, 0, 5, 0)
  67.     PageList.ScrollBarThickness = 8
  68.  
  69.     PageListLayout.Name = "PageListLayout"
  70.     PageListLayout.Parent = PageList
  71.     PageListLayout.SortOrder = Enum.SortOrder.LayoutOrder
  72.     PageListLayout.CellPadding = UDim2.new(0, 5, 0, 2)
  73.     PageListLayout.CellSize = UDim2.new(0, 92, 0, 20)
  74.  
  75.     local UIS = game:GetService("UserInputService")
  76.     UIS.InputBegan:Connect(function(k)
  77.         if k.KeyCode == Enum.KeyCode.RightAlt then
  78.             Window.Visible = not Window.Visible
  79.         end
  80.     end)
  81.  
  82.     local library2 = {}
  83.  
  84.     function library2:Page(name, pageFlag)
  85.         local Page = Instance.new("TextButton")
  86.         local Container = Instance.new("ScrollingFrame")
  87.         local ContainerLayout = Instance.new("UIGridLayout")
  88.         local mainPageFlag = pageFlag
  89.         _G.flags[mainWindowFlag].pages[mainPageFlag] = {}
  90.         _G.flags[mainWindowFlag].pages[mainPageFlag].textboxes = {}
  91.  
  92.         Container.Name = "Container"
  93.         Container.Parent = Window
  94.         Container.BackgroundColor3 = Color3.fromRGB(35, 35, 35)
  95.         Container.BorderSizePixel = 0
  96.         Container.Position = UDim2.new(0.183501691, 0, 0.118518516, 0)
  97.         Container.Size = UDim2.new(0, 484, 0, 238)
  98.         Container.CanvasSize = UDim2.new(0, 0, 5, 0)
  99.         Container.ScrollBarThickness = 8
  100.         Container.Visible = false
  101.  
  102.         ContainerLayout.Name = "ContainerLayout"
  103.         ContainerLayout.Parent = Container
  104.         ContainerLayout.FillDirection = Enum.FillDirection.Vertical
  105.         ContainerLayout.HorizontalAlignment = Enum.HorizontalAlignment.Center
  106.         ContainerLayout.SortOrder = Enum.SortOrder.LayoutOrder
  107.         ContainerLayout.CellPadding = UDim2.new(0, 14, 0, 2)
  108.         ContainerLayout.CellSize = UDim2.new(0, 475, 0, 20)
  109.  
  110.         Page.Name = "Page"
  111.         Page.Parent = PageList
  112.         Page.BackgroundColor3 = Color3.fromRGB(45, 45, 45)
  113.         Page.BorderSizePixel = 0
  114.         Page.Size = UDim2.new(0, 90, 0, 20)
  115.         Page.Font = Enum.Font.SourceSans
  116.         Page.TextColor3 = Color3.fromRGB(170, 170, 170)
  117.         Page.TextSize = 14.000
  118.         Page.Text = name
  119.         Page.MouseButton1Click:Connect(function()
  120.             for i,v in next, ScreenGui:GetDescendants() do
  121.                 if v.Name == "Container" then
  122.                     v.Visible = false
  123.                     Container.Visible = true
  124.                 end
  125.             end
  126.         end)
  127.  
  128.         local library3 = {}
  129.  
  130.         function library3:Button(name, callback)
  131.             local callback = callback or function() end
  132.  
  133.             local Button = Instance.new("Frame")
  134.             local Obj = Instance.new("TextButton")
  135.             local ButtonText = Instance.new("TextLabel")
  136.  
  137.             Button.Name = "Button"
  138.             Button.Parent = Container
  139.             Button.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  140.             Button.BackgroundTransparency = 1.000
  141.             Button.Size = UDim2.new(0, 476, 0, 20)
  142.            
  143.             Obj.Name = "Obj"
  144.             Obj.Parent = Button
  145.             Obj.BackgroundColor3 = Color3.fromRGB(45, 45, 45)
  146.             Obj.BorderSizePixel = 0
  147.             Obj.Position = UDim2.new(0.673154712, 0, 0, 0)
  148.             Obj.Size = UDim2.new(0, 154, 0, 20)
  149.             Obj.Font = Enum.Font.SourceSans
  150.             Obj.TextColor3 = Color3.fromRGB(170, 170, 170)
  151.             Obj.TextSize = 14.000
  152.            
  153.             ButtonText.Name = "ButtonText"
  154.             ButtonText.Parent = Button
  155.             ButtonText.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  156.             ButtonText.BackgroundTransparency = 1.000
  157.             ButtonText.Size = UDim2.new(0, 319, 0, 20)
  158.             ButtonText.Font = Enum.Font.SourceSans
  159.             ButtonText.TextColor3 = Color3.fromRGB(170, 170, 170)
  160.             ButtonText.TextSize = 14.000
  161.             ButtonText.TextXAlignment = Enum.TextXAlignment.Left
  162.             ButtonText.Text = name
  163.  
  164.             Obj.MouseButton1Click:Connect(function()
  165.                 pcall(callback)
  166.             end)
  167.         end
  168.  
  169.         function library3:Toggle(name, callback)
  170.             local Toggle = Instance.new("Frame")
  171.             local ToggleText = Instance.new("TextLabel")
  172.             local Object = Instance.new("Frame")
  173.             local ToggleButton = Instance.new("TextButton")
  174.  
  175.             local actions = {}
  176.             local enabled = false
  177.             callback = callback or function() end
  178.            
  179.             Toggle.Name = "Toggle"
  180.             Toggle.Parent = Container
  181.             Toggle.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  182.             Toggle.BackgroundTransparency = 1.000
  183.             Toggle.Size = UDim2.new(0, 476, 0, 20)
  184.            
  185.             ToggleText.Name = "ToggleText"
  186.             ToggleText.Parent = Toggle
  187.             ToggleText.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  188.             ToggleText.BackgroundTransparency = 1.000
  189.             ToggleText.Size = UDim2.new(0, 319, 0, 20)
  190.             ToggleText.Font = Enum.Font.SourceSans
  191.             ToggleText.TextColor3 = Color3.fromRGB(170, 170, 170)
  192.             ToggleText.TextSize = 14.000
  193.             ToggleText.TextXAlignment = Enum.TextXAlignment.Left
  194.             ToggleText.Text = name
  195.            
  196.             Object.Name = "Object"
  197.             Object.Parent = Toggle
  198.             Object.BackgroundColor3 = Color3.fromRGB(45, 45, 45)
  199.             Object.BorderColor3 = Color3.fromRGB(180, 0, 0)
  200.             Object.Position = UDim2.new(0.905263066, 0, 0.200000003, 0)
  201.             Object.Size = UDim2.new(0, 29, 0, 11)
  202.            
  203.             ToggleButton.Name = "ToggleButton"
  204.             ToggleButton.Parent = Object
  205.             ToggleButton.BackgroundColor3 = Color3.fromRGB(35, 35, 35)
  206.             ToggleButton.BorderColor3 = Color3.fromRGB(180, 0, 0)
  207.             ToggleButton.Position = UDim2.new(-0.17, 0,-0.137, 0)
  208.             ToggleButton.Size = UDim2.new(0, 14, 0, 14)
  209.             ToggleButton.Selected = true
  210.             ToggleButton.Font = Enum.Font.SourceSans
  211.             ToggleButton.Text = ""
  212.             ToggleButton.TextColor3 = Color3.fromRGB(0, 0, 0)
  213.             ToggleButton.TextSize = 14.000
  214.  
  215.             local function Fire()
  216.                 enabled = not enabled
  217.                 ToggleButton:TweenPosition(enabled and UDim2.new(0.67, 0,-0.137, 0) or  UDim2.new(-0.17, 0,-0.137, 0), "InOut", Linear, 0.1)
  218.                 ToggleButton.BorderColor3 = enabled and Color3.fromRGB(0, 180, 0) or Color3.fromRGB(180, 0, 0)
  219.                 Object.BorderColor3 = enabled and Color3.fromRGB(0, 180, 0) or Color3.fromRGB(180, 0, 0)
  220.                 pcall(callback, enabled)
  221.             end
  222.  
  223.             ToggleButton.MouseButton1Click:Connect(Fire)
  224.  
  225.             function actions:Set(arg)
  226.                 ToggleButton:TweenPosition(enabled and UDim2.new(0.67, 0,-0.137, 0) or  UDim2.new(-0.17, 0,-0.137, 0), "InOut", Linear, 0.1)
  227.                 ToggleButton.BorderColor3 = enabled and Color3.fromRGB(0, 180, 0) or Color3.fromRGB(180, 0, 0)
  228.                 Object.BorderColor3 = enabled and Color3.fromRGB(0, 180, 0) or Color3.fromRGB(180, 0, 0)
  229.                 pcall(callback, arg)
  230.             end
  231.         end
  232.  
  233.         function library3:TextBox(name, placeholdertext, textBoxFlag, callback)
  234.             local TextBox = Instance.new("Frame")
  235.             local TextBoxText = Instance.new("TextLabel")
  236.             local TextBox_2 = Instance.new("TextBox")
  237.             callback = callback or function() end
  238.             local mainTextBoxFlag = textBoxFlag
  239.             _G.flags[mainWindowFlag].pages[mainPageFlag].textboxes[mainTextBoxFlag] = ""
  240.  
  241.             TextBox.Name = "TextBox"
  242.             TextBox.Parent = Container
  243.             TextBox.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  244.             TextBox.BackgroundTransparency = 1.000
  245.             TextBox.Size = UDim2.new(0, 476, 0, 20)
  246.  
  247.             TextBoxText.Name = "TextBoxText"
  248.             TextBoxText.Parent = TextBox
  249.             TextBoxText.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  250.             TextBoxText.BackgroundTransparency = 1.000
  251.             TextBoxText.Size = UDim2.new(0, 319, 0, 20)
  252.             TextBoxText.Font = Enum.Font.SourceSans
  253.             TextBoxText.TextColor3 = Color3.fromRGB(170, 170, 170)
  254.             TextBoxText.TextSize = 14.000
  255.             TextBoxText.TextXAlignment = Enum.TextXAlignment.Left
  256.             TextBoxText.Text = name
  257.  
  258.             TextBox_2.Parent = TextBox
  259.             TextBox_2.BackgroundColor3 = Color3.fromRGB(45, 45, 45)
  260.             TextBox_2.BorderSizePixel = 0
  261.             TextBox_2.Position = UDim2.new(0.671578944, 0, 0, 0)
  262.             TextBox_2.Size = UDim2.new(0, 154, 0, 20)
  263.             TextBox_2.ClearTextOnFocus = false
  264.             TextBox_2.Font = Enum.Font.SourceSans
  265.             TextBox_2.PlaceholderColor3 = Color3.fromRGB(208, 208, 208)
  266.             TextBox_2.PlaceholderText = placeholdertext
  267.             TextBox_2.TextColor3 = Color3.fromRGB(170, 170, 170)
  268.             TextBox_2.TextSize = 14.000
  269.             TextBox_2.Text = ""
  270.  
  271.             local function onFocusLost(enterPressed, inputObject)
  272.                 if enterPressed then
  273.                     _G.flags[mainWindowFlag].pages[mainPageFlag].textboxes[mainTextBoxFlag] = TextBox_2.Text
  274.                     pcall(callback)
  275.                 else
  276.                     _G.flags[mainWindowFlag].pages[mainPageFlag].textboxes[mainTextBoxFlag] = TextBox_2.Text
  277.                 end
  278.             end
  279.  
  280.             TextBox_2.FocusLost:Connect(onFocusLost)
  281.         end
  282.  
  283.         return library3
  284.     end
  285.     return library2
  286. end
  287. return library
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement