Advertisement
DogeOfTheDoges

doge's UI library

Jun 29th, 2020
1,757
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 11.41 KB | None | 0 0
  1. local Mouse = game.Players.LocalPlayer:GetMouse()
  2.  
  3. local Library = {}
  4.  
  5. function Library:CreateWindow(title)
  6.     local BodyYSize = 0
  7.    
  8.     local InputService = game:GetService("UserInputService")
  9.     local CoolUIlib = Instance.new("ScreenGui")
  10.     local TopMain = Instance.new("ImageLabel")
  11.     local BodyMain = Instance.new("Frame")
  12.     local Container = Instance.new("Frame")
  13.     local UIListLayout = Instance.new("UIListLayout")
  14.     local TitleText = Instance.new("TextLabel")
  15.    
  16.     local function Resize(Value)
  17.         BodyYSize = BodyYSize + Value
  18.        
  19.         Container.Size = UDim2.new(0, 155, 0, BodyYSize)
  20.         BodyMain.Size = UDim2.new(0, 155, 0, BodyYSize)
  21.     end
  22.    
  23.     CoolUIlib.Name = "CoolUIlib"
  24.     CoolUIlib.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
  25.     CoolUIlib.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
  26.    
  27.     TopMain.Name = "TopMain"
  28.     TopMain.Parent = CoolUIlib
  29.     TopMain.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  30.     TopMain.BackgroundTransparency = 1.000
  31.     TopMain.BorderSizePixel = 0
  32.     TopMain.Position = UDim2.new(0.0431854166, 0, 0.16103521, 0)
  33.     TopMain.Size = UDim2.new(0, 155, 0, 40)
  34.     TopMain.Image = "http://www.roblox.com/asset/?id=5247156107"
  35.    
  36.     -- Drag Function
  37.     local function dragify(Frame)
  38.    
  39.     -- Locals
  40.     local dragSpeed = .25 -- You can edit this. (Smoothness)
  41.    
  42.     -- No need to edit
  43.     local dragToggle = nil
  44.     local dragInput = nil
  45.     local dragStart = nil
  46.    
  47.         -- Update Frame Position
  48.         function updateInput(input)
  49.             local Delta = input.Position - dragStart
  50.             local Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + Delta.X, startPos.Y.Scale, startPos.Y.Offset + Delta.Y)
  51.             game:GetService("TweenService"):Create(Frame, TweenInfo.new(.25), {Position = Position}):Play()
  52.         end
  53.        
  54.         -- User is is inputting
  55.         Frame.InputBegan:Connect(function(input)
  56.             if (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then
  57.                 dragToggle = true
  58.                 dragStart = input.Position
  59.                 startPos = Frame.Position
  60.                 input.Changed:Connect(function()
  61.                     if (input.UserInputState == Enum.UserInputState.End) then
  62.                         dragToggle = false
  63.                     end
  64.                 end)
  65.             end
  66.         end)
  67.        
  68.         -- Frame Input Changed so get the input
  69.         Frame.InputChanged:Connect(function(input)
  70.             if (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then
  71.                 dragInput = input
  72.             end
  73.         end)
  74.        
  75.         -- User is dragging the frame
  76.         game:GetService("UserInputService").InputChanged:Connect(function(input)
  77.             if (input == dragInput and dragToggle) then
  78.                 updateInput(input)
  79.             end
  80.         end)
  81.     end
  82.    
  83.     -- Call Drag Function
  84.     dragify(TopMain) -- Enable dragging
  85.    
  86.     BodyMain.Name = "BodyMain"
  87.     BodyMain.Parent = TopMain
  88.     BodyMain.BackgroundColor3 = Color3.fromRGB(38, 38, 38)
  89.     BodyMain.BorderSizePixel = 0
  90.     BodyMain.Position = UDim2.new(-0, 0, 0.845938504, 0)
  91.     BodyMain.Size = UDim2.new(0, 155, 0, 0)
  92.    
  93.     Container.Name = "Container"
  94.     Container.Parent = TopMain
  95.     Container.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  96.     Container.BackgroundTransparency = 1.000
  97.     Container.Position = UDim2.new(0, 0, 1, 0)
  98.     Container.Size = UDim2.new(0, 155, 0, 0)
  99.     Container.ClipsDescendants = true
  100.    
  101.     UIListLayout.Parent = Container
  102.     UIListLayout.HorizontalAlignment = Enum.HorizontalAlignment.Center
  103.     UIListLayout.SortOrder = Enum.SortOrder.LayoutOrder
  104.     UIListLayout.Padding = UDim.new(0, 6)
  105.    
  106.     TitleText.Name = "TitleText"
  107.     TitleText.Parent = TopMain
  108.     TitleText.Active = true
  109.     TitleText.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  110.     TitleText.BackgroundTransparency = 1.000
  111.     TitleText.Size = UDim2.new(0, 155, 0, 36)
  112.     TitleText.Font = Enum.Font.GothamBold
  113.     TitleText.Text = title
  114.     TitleText.TextColor3 = Color3.fromRGB(191, 191, 191)
  115.     TitleText.TextSize = 18.000
  116.    
  117.     local a = {}
  118.    
  119.     --[[
  120.         function a:CreateButton(text)
  121.             --thing
  122.         end
  123.     ]]
  124.    
  125.     function a:CreateButton(text, callback)
  126.         local callback = callback or function() end
  127.        
  128.         Resize(49)
  129.        
  130.         local ButtonBox = Instance.new("ImageLabel")
  131.         local ButtonRectangle = Instance.new("ImageLabel")
  132.         local ButtonText = Instance.new("TextButton")
  133.        
  134.         ButtonBox.Name = "ButtonBox"
  135.         ButtonBox.Parent = Container
  136.         ButtonBox.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  137.         ButtonBox.BackgroundTransparency = 1.000
  138.         ButtonBox.BorderSizePixel = 0
  139.         ButtonBox.Position = UDim2.new(0, 0, 2.62814832, 0)
  140.         ButtonBox.Size = UDim2.new(0, 155, 0, 43)
  141.         ButtonBox.Image = "http://www.roblox.com/asset/?id=5247155672"
  142.        
  143.         ButtonRectangle.Name = "ButtonRectangle"
  144.         ButtonRectangle.Parent = ButtonBox
  145.         ButtonRectangle.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  146.         ButtonRectangle.BackgroundTransparency = 1.000
  147.         ButtonRectangle.BorderSizePixel = 0
  148.         ButtonRectangle.Position = UDim2.new(0.136441737, 0, 0.0930232555, 0)
  149.         ButtonRectangle.Size = UDim2.new(0, 112, 0, 35)
  150.         ButtonRectangle.Image = "http://www.roblox.com/asset/?id=5247155729"
  151.        
  152.         ButtonText.Name = "ButtonText"
  153.         ButtonText.Parent = ButtonBox
  154.         ButtonText.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  155.         ButtonText.BackgroundTransparency = 1.000
  156.         ButtonText.Position = UDim2.new(0.136441723, 0, 0.0929998383, 0)
  157.         ButtonText.Size = UDim2.new(0, 111, 0, 35)
  158.         ButtonText.Font = Enum.Font.GothamSemibold
  159.         ButtonText.Text = text
  160.         ButtonText.TextColor3 = Color3.fromRGB(191, 191, 191)
  161.         ButtonText.TextSize = 14.000
  162.        
  163.         ButtonText.MouseButton1Click:Connect(function()
  164.             --[[ButtonText.ImageTransparency = 0.3
  165.             wait()
  166.             ButtonText.ImageTransparency = 0]]
  167.             local c = Instance.new("ImageLabel", ButtonText)
  168.             c.BackgroundTransparency = 1
  169.             c.Image = "rbxassetid://3570695787"
  170.             c.ImageTransparency = 0.6
  171.             c.Position = UDim2.new(0, (Mouse.X - c.AbsolutePosition.X), 0, (Mouse.Y - c.AbsolutePosition.Y))
  172.             c.ScaleType = "Slice"
  173.             c.SliceCenter = Rect.new(100, 100, 100, 100)
  174.             c.SliceScale = 1
  175.             local Size = 0
  176.             if ButtonText.AbsoluteSize.X > ButtonText.AbsoluteSize.Y then
  177.                 Size = ButtonText.AbsoluteSize.X*1.5
  178.             elseif ButtonText.AbsoluteSize.X < ButtonText.AbsoluteSize.Y then
  179.                 Size = ButtonText.AbsoluteSize.Y*1.5
  180.             elseif ButtonText.AbsoluteSize.X == ButtonText.AbsoluteSize.Y then
  181.                 Size = ButtonText.AbsoluteSize.X*1.5
  182.             end
  183.             c:TweenSizeAndPosition(UDim2.new(0, Size, 0, Size), UDim2.new(.5, -Size/2, .5, -Size/2), "Out", "Linear", .5)
  184.             ButtonText.MouseButton1Up:Connect(function()
  185.                 while c.ImageTransparency ~= 1 do
  186.                     wait()
  187.                     c.ImageTransparency = c.ImageTransparency + 0.02
  188.                     if c.ImageTransparency == 1 then c:Destroy() end
  189.                 end
  190.             end)
  191.         end)
  192.        
  193.         ButtonText.MouseButton1Click:Connect(function()
  194.             pcall(callback)
  195.         end)
  196.     end
  197.    
  198.     function a:CreateToggle(callback)
  199.         local callback = callback or function() end
  200.        
  201.         Resize(49)
  202.        
  203.         local CheckBox = Instance.new("ImageLabel")
  204.         local CheckRectangle = Instance.new("ImageLabel")
  205.         local CheckPart = Instance.new("ImageLabel")
  206.         local ToggleButton = Instance.new("TextButton")
  207.        
  208.         CheckBox.Name = "CheckBox"
  209.         CheckBox.Parent = Container
  210.         CheckBox.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  211.         CheckBox.BackgroundTransparency = 1.000
  212.         CheckBox.BorderSizePixel = 0
  213.         CheckBox.Position = UDim2.new(0, 0, 4.1961112, 0)
  214.         CheckBox.Size = UDim2.new(0, 155, 0, 43)
  215.         CheckBox.Image = "http://www.roblox.com/asset/?id=5247155794"
  216.        
  217.         CheckRectangle.Name = "CheckRectangle"
  218.         CheckRectangle.Parent = CheckBox
  219.         CheckRectangle.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  220.         CheckRectangle.BackgroundTransparency = 1.000
  221.         CheckRectangle.BorderSizePixel = 0
  222.         CheckRectangle.Position = UDim2.new(0.283819318, 0, 0.0929998383, 0)
  223.         CheckRectangle.Size = UDim2.new(0, 66, 0, 34)
  224.         CheckRectangle.Image = "http://www.roblox.com/asset/?id=5247155881"
  225.        
  226.         CheckPart.Name = "CheckPart"
  227.         CheckPart.Parent = CheckRectangle
  228.         CheckPart.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  229.         CheckPart.BackgroundTransparency = 1.000
  230.         CheckPart.Size = UDim2.new(0, 34, 0, 34)
  231.         CheckPart.Image = "http://www.roblox.com/asset/?id=5247155834"
  232.        
  233.         ToggleButton.Name = "ToggleButton"
  234.         ToggleButton.Parent = CheckRectangle
  235.         ToggleButton.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  236.         ToggleButton.BackgroundTransparency = 1.000
  237.         ToggleButton.Size = UDim2.new(0, 66, 0, 34)
  238.         ToggleButton.AutoButtonColor = false
  239.         ToggleButton.Font = Enum.Font.SourceSans
  240.         ToggleButton.Text = ""
  241.         ToggleButton.TextColor3 = Color3.fromRGB(0, 0, 0)
  242.         ToggleButton.TextSize = 14.000
  243.        
  244.         local TweenService = game:GetService("TweenService")
  245.         local TweenSettings_Toggle = TweenInfo.new(0.3,Enum.EasingStyle.Quad, Enum.EasingDirection.InOut, 0, false, 0)
  246.        
  247.         local OnPos = UDim2.new(0.485, 0, 0, 0)
  248.         local OffPos = UDim2.new(0, 0, 0, 0)
  249.        
  250.         local Button_TweenIn = TweenService:Create(CheckPart, TweenSettings_Toggle, {Position = OnPos,})
  251.         local Button_TweenOut = TweenService:Create(CheckPart, TweenSettings_Toggle, {Position = OffPos,})
  252.        
  253.         local Toggled = false
  254.        
  255.         ToggleButton.MouseButton1Click:Connect(function()
  256.             if Toggled then
  257.                 Toggled = false
  258.                 Button_TweenIn:Pause()
  259.                 Button_TweenOut:Play()
  260.                 wait(0.2)
  261.                 CheckRectangle.ImageColor3 = Color3.fromRGB(255, 255, 255)
  262.             else
  263.                 Toggled = true
  264.                 Button_TweenOut:Pause()
  265.                 Button_TweenIn:Play()
  266.                 wait(0.2)
  267.                 CheckRectangle.ImageColor3 = Color3.fromRGB(106, 255, 168)
  268.                 pcall(callback, Toggled)
  269.             end
  270.         end)
  271.  
  272.     end
  273.    
  274.     function a:CreateLabel(text)
  275.         Resize(42)
  276.        
  277.         local text = text or ""
  278.        
  279.         local LabelBox = Instance.new("ImageLabel")
  280.         local LabelText = Instance.new("TextButton")
  281.        
  282.         LabelBox.Name = "LabelBox"
  283.         LabelBox.Parent = Container
  284.         LabelBox.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  285.         LabelBox.BackgroundTransparency = 1.000
  286.         LabelBox.BorderSizePixel = 0
  287.         LabelBox.Position = UDim2.new(-0.00217737956, 0, 1.35555577, 0)
  288.         LabelBox.Size = UDim2.new(0, 155, 0, 36)
  289.         LabelBox.Image = "http://www.roblox.com/asset/?id=5247156056"
  290.        
  291.         LabelText.Name = "LabelText"
  292.         LabelText.Parent = LabelBox
  293.         LabelText.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  294.         LabelText.BackgroundTransparency = 1.000
  295.         LabelText.Size = UDim2.new(0, 155, 0, 36)
  296.         LabelText.Font = Enum.Font.GothamSemibold
  297.         LabelText.Text = text
  298.         LabelText.TextColor3 = Color3.fromRGB(191, 191, 191)
  299.         LabelText.TextSize = 14.000
  300.         LabelText.TextWrapped = true
  301.     end
  302.    
  303.     function a:CreateInput(placeholder, callback)
  304.         Resize(49)
  305.        
  306.         local placeholder = placeholder or "Input"
  307.         local callback = callback or function() end
  308.        
  309.         local InputBox = Instance.new("ImageLabel")
  310.         local ButtonRectangle_2 = Instance.new("ImageLabel")
  311.         local InputText = Instance.new("TextBox")
  312.        
  313.         InputBox.Name = "InputBox"
  314.         InputBox.Parent = Container
  315.         InputBox.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  316.         InputBox.BackgroundTransparency = 1.000
  317.         InputBox.BorderSizePixel = 0
  318.         InputBox.Position = UDim2.new(0, 0, 5.62481499, 0)
  319.         InputBox.Size = UDim2.new(0, 155, 0, 43)
  320.         InputBox.Image = "http://www.roblox.com/asset/?id=5247155932"
  321.        
  322.         InputText.Name = "InputText"
  323.         InputText.Parent = InputBox
  324.         InputText.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  325.         InputText.BackgroundTransparency = 1.000
  326.         InputText.Position = UDim2.new(0.136000007, 0, 0.0930000022, 0)
  327.         InputText.Size = UDim2.new(0, 112, 0, 35)
  328.         InputText.ZIndex = 2
  329.         InputText.Font = Enum.Font.SourceSans
  330.         InputText.PlaceholderColor3 = Color3.fromRGB(107, 107, 107)
  331.         InputText.PlaceholderText = placeholder
  332.         InputText.Text = ""
  333.         InputText.TextColor3 = Color3.fromRGB(0, 0, 0)
  334.         InputText.TextSize = 14.000
  335.        
  336.         ButtonRectangle_2.Name = "ButtonRectangle"
  337.         ButtonRectangle_2.Parent = InputBox
  338.         ButtonRectangle_2.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  339.         ButtonRectangle_2.BackgroundTransparency = 1.000
  340.         ButtonRectangle_2.BorderSizePixel = 0
  341.         ButtonRectangle_2.Position = UDim2.new(0.136441737, 0, 0.0930232555, 0)
  342.         ButtonRectangle_2.Size = UDim2.new(0, 112, 0, 35)
  343.         ButtonRectangle_2.Image = "http://www.roblox.com/asset/?id=5247155729"
  344.        
  345.         local inputvalue = Instance.new("StringValue")
  346.        
  347.         inputvalue.Name = "inputvalue"
  348.         inputvalue.Parent = InputText
  349.         inputvalue.Value = ""
  350.        
  351.         local typing = false
  352.        
  353.         InputText.Focused:Connect(function()
  354.             typing = true
  355.            
  356.             ButtonRectangle_2.ImageColor3 = Color3.fromRGB(194, 194, 194)
  357.         end)
  358.        
  359.         InputText.FocusLost:Connect(function()
  360.             typing = false
  361.            
  362.             ButtonRectangle_2.ImageColor3 = Color3.fromRGB(255, 255, 255)
  363.            
  364.             inputvalue.Value = InputText.Text
  365.            
  366.             pcall(callback(inputvalue.Value))
  367.         end)
  368.        
  369.     end
  370.    
  371.     return a;
  372. end
  373.  
  374. return Library;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement