Advertisement
XZTablets

CreateService

Apr 15th, 2020
341
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 17.22 KB | None | 0 0
  1. local player = game.Players.LocalPlayer
  2. local mouse = player:GetMouse()
  3. local runService = game:GetService("RunService")
  4.  
  5. local ui = {}
  6.  
  7. function ui:Init()
  8.     local newui = Instance.new("ScreenGui")
  9.     newui.Name = "NewUI"
  10.     newui.Parent = game.Players.LocalPlayer.PlayerGui
  11.    
  12.     local optionsLib = {}
  13.    
  14.     function optionsLib:GetDescendants()
  15.         return newui:GetDescendants()
  16.     end
  17.    
  18.     function optionsLib:CreatePrimaryWindow()
  19.         local newWindow = Instance.new("Frame")
  20.         newWindow.Name = "PrimaryWindow"
  21.         newWindow.BackgroundColor3 = Color3.fromRGB(61,61,61)
  22.         newWindow.BorderSizePixel = 0
  23.         newWindow.Size = UDim2.new(0,800,0,350)
  24.         newWindow.Position = UDim2.new(0.5,-400,0.5,-175)
  25.         newWindow.Parent = newui
  26.        
  27.         local inview = false
  28.         local dragging = false
  29.         local lastmousex, lastmousey
  30.        
  31.         local drag = coroutine.wrap(function()
  32.             while runService.Heartbeat:Wait() do
  33.                 if dragging then
  34.                     local x, y = mouse.X, mouse.Y
  35.                     local dX, dY = x - lastmousex, y - lastmousey
  36.                     local dP = UDim2.new(0, dX, 0, dY)
  37.                     newWindow.Position = newWindow.Position + dP
  38.                     lastmousex, lastmousey = x, y
  39.                 end
  40.             end
  41.         end)
  42.        
  43.         newWindow.MouseEnter:Connect(function()
  44.             inview = true
  45.         end)
  46.            
  47.         newWindow.MouseLeave:Connect(function()
  48.             if not dragging then
  49.                 inview = false
  50.             end
  51.         end)
  52.            
  53.         mouse.Button1Down:Connect(function()
  54.             if inview then
  55.                 dragging = true
  56.                 lastmousex, lastmousey = mouse.X, mouse.Y
  57.             end
  58.         end)
  59.            
  60.         mouse.Button1Up:Connect(function()
  61.             dragging = false
  62.         end)
  63.            
  64.         drag()
  65.        
  66.         local visibleToggle = true
  67.        
  68.         local extraLib = {}
  69.        
  70.         function extraLib:AddColour(colour, callback)
  71.             local colourContainer = Instance.new("TextButton")
  72.             colourContainer.Name = "ScriptColour"
  73.             colourContainer.BackgroundColor3 = colour
  74.             colourContainer.BorderSizePixel = 0
  75.            
  76.             colourContainer.MouseButton1Down:Connect(function()
  77.                 callback(colour)
  78.             end)
  79.            
  80.             return colourContainer
  81.         end
  82.        
  83.         function extraLib:AddOptionTree(options, callback)
  84.             local optionContainer = Instance.new("ScrollingFrame")
  85.             optionContainer.Name = "OptionTree"
  86.             optionContainer.MidImage = "http://www.roblox.com/asset/?id=4812947"
  87.             optionContainer.BottomImage = "http://www.roblox.com/asset/?id=4812947"
  88.             optionContainer.TopImage = "http://www.roblox.com/asset/?id=4812947"
  89.             optionContainer.ScrollBarImageColor3 = Color3.fromRGB(172,172,172)
  90.             optionContainer.ScrollingDirection = Enum.ScrollingDirection.Y
  91.             optionContainer.BackgroundColor3 = Color3.fromRGB(61,61,61)
  92.             optionContainer.BorderSizePixel = 0
  93.             optionContainer.Parent = newWindow
  94.            
  95.             local optionLayout = Instance.new("UIListLayout")
  96.             optionLayout.Padding = UDim.new(0, 2)
  97.             optionLayout.Parent = optionContainer
  98.            
  99.             for i,v in pairs(options) do
  100.                 local name = v.Name
  101.                 local source = v.Source
  102.                 local optionButton = Instance.new("TextButton")
  103.                 optionButton.Name = "ScriptButton"
  104.                 optionButton.Size = UDim2.new(1,-12,0,20)
  105.                 optionButton.BackgroundColor3 = Color3.fromRGB(61,61,61)
  106.                 optionButton.Text = ("   "..name)
  107.                 optionButton.TextXAlignment = Enum.TextXAlignment.Left
  108.                 optionButton.Font = Enum.Font.SourceSans
  109.                 optionButton.TextColor3 = Color3.fromRGB(255,255,255)
  110.                 optionButton.TextSize = 14
  111.                 optionButton.BorderSizePixel = 0
  112.                 optionButton.AutoButtonColor = false
  113.                 optionButton.BorderColor3 = Color3.fromRGB(229,78,255)
  114.                 optionButton.Parent = optionContainer
  115.                 optionButton.MouseEnter:Connect(function()
  116.                     for i = 0, 2, 1 do
  117.                         optionButton.BorderSizePixel = i
  118.                         wait()
  119.                     end
  120.                 end)
  121.                 optionButton.MouseLeave:Connect(function()
  122.                     for i = 2, 0, -1 do
  123.                         optionButton.BorderSizePixel = i
  124.                         wait()
  125.                     end
  126.                 end)
  127.                 optionButton.MouseButton1Down:Connect(function()
  128.                     callback(source)
  129.                 end)
  130.             end
  131.             return optionContainer
  132.         end
  133.        
  134.         function extraLib:AddLabel(text)
  135.             local scriptLabel = Instance.new("TextLabel")
  136.             scriptLabel.BackgroundColor3 = Color3.fromRGB(31,31,31)
  137.             scriptLabel.BorderSizePixel = 0
  138.             scriptLabel.Size = UDim2.new(1, 0, 0, 18)
  139.             scriptLabel.Font = Enum.Font.SourceSans
  140.             scriptLabel.Text = text
  141.             scriptLabel.TextSize = 18
  142.             scriptLabel.TextColor3 = Color3.fromRGB(166,166,166)
  143.             scriptLabel.Parent = newWindow
  144.            
  145.             return scriptLabel
  146.         end
  147.        
  148.         function extraLib:AddInput(callback)
  149.             local inputBox = Instance.new("TextBox")
  150.             inputBox.BackgroundTransparency = 1
  151.             inputBox.Font = Enum.Font.SourceSans
  152.             inputBox.Text = ""
  153.             inputBox.PlaceholderText = "Write here..."
  154.             inputBox.TextColor3 = Color3.fromRGB(178,178,178)
  155.             inputBox.TextSize = 18
  156.             inputBox.ClearTextOnFocus = false
  157.             inputBox.TextXAlignment = Enum.TextXAlignment.Left
  158.             inputBox.TextYAlignment = Enum.TextYAlignment.Top
  159.             inputBox.MultiLine = true
  160.             inputBox.TextWrapped = true
  161.             inputBox.Parent = newWindow
  162.            
  163.             inputBox.FocusLost:Connect(function()
  164.                 callback(inputBox.Text)
  165.             end)
  166.            
  167.             return inputBox
  168.         end
  169.        
  170.         function extraLib:AddButton(title, callback)
  171.             local scriptButton = Instance.new("TextButton")
  172.             scriptButton.Name = "ScriptButton"
  173.             scriptButton.BackgroundColor3 = Color3.fromRGB(76,76,76)
  174.             scriptButton.AutoButtonColor = false
  175.             scriptButton.BorderColor3 = Color3.fromRGB(177,177,177)
  176.             scriptButton.BorderSizePixel = 0
  177.             scriptButton.Font = Enum.Font.SourceSans
  178.             scriptButton.Text = title
  179.             scriptButton.TextColor3 = Color3.fromRGB(255,255,255)
  180.             scriptButton.TextSize = 20
  181.             scriptButton.Parent = newWindow
  182.            
  183.             scriptButton.MouseEnter:Connect(function()
  184.                 scriptButton.BackgroundColor3 = Color3.fromRGB(159, 61, 162)
  185.                 scriptButton.BorderSizePixel = 1
  186.             end)
  187.             scriptButton.MouseLeave:Connect(function()
  188.                 scriptButton.BackgroundColor3 = Color3.fromRGB(76, 76, 76)
  189.                 scriptButton.BorderSizePixel = 0
  190.             end)
  191.             scriptButton.MouseButton1Down:Connect(function()
  192.                 callback()
  193.             end)
  194.                
  195.             return scriptButton
  196.         end
  197.        
  198.         function extraLib:AddContainer(clips, scrolling)
  199.             local scrolling = scrolling or false
  200.             local newContainer
  201.             if scrolling then
  202.                 newContainer = Instance.new("ScrollingFrame")
  203.                 newContainer.MidImage = "http://www.roblox.com/asset/?id=4812947"
  204.                 newContainer.BottomImage = "http://www.roblox.com/asset/?id=4812947"
  205.                 newContainer.TopImage = "http://www.roblox.com/asset/?id=4812947"
  206.                 newContainer.ScrollingDirection = Enum.ScrollingDirection.Y
  207.             else
  208.                 newContainer = Instance.new("Frame")
  209.             end
  210.             newContainer.Name = "Container"
  211.             newContainer.BackgroundColor3 = Color3.fromRGB(47,47,47)
  212.             newContainer.BorderSizePixel = 0
  213.             newContainer.ClipsDescendants = clips or false
  214.             newContainer.Parent = newWindow
  215.            
  216.             return newContainer
  217.         end
  218.        
  219.         function extraLib:ToggleVisibility()
  220.             visibleToggle = not visibleToggle
  221.             newWindow.Visible = visibleToggle
  222.         end
  223.        
  224.         function extraLib:AddTitle(title, logo)
  225.             local titleContainer = Instance.new("Frame")
  226.             titleContainer.Name = "TitleBar"
  227.             titleContainer.Size = UDim2.new(1,0,0,30)
  228.             titleContainer.Position = UDim2.new(0,0,0,0)
  229.             titleContainer.BackgroundColor3 = Color3.fromRGB(61,61,61)
  230.             titleContainer.BorderSizePixel = 0
  231.             titleContainer.Parent = newWindow
  232.            
  233.             local titleLabel = Instance.new("TextLabel")
  234.             titleLabel.Name = "Title"
  235.             titleLabel.Size = UDim2.new(1,0,1,0)
  236.             titleLabel.BackgroundTransparency = 1
  237.             titleLabel.Font = Enum.Font.SourceSans
  238.             titleLabel.Text = title
  239.             titleLabel.TextColor3 = Color3.fromRGB(255,255,255)
  240.             titleLabel.TextSize = 18
  241.             titleLabel.Parent = titleContainer
  242.            
  243.             local logoEnabled = false
  244.            
  245.             if logo then
  246.                 logoEnabled = logo.Enabled or false
  247.             end
  248.            
  249.             if logoEnabled then
  250.                 local text = logo.Text
  251.                
  252.                 local primaryLabel = Instance.new("TextLabel")
  253.                 primaryLabel.Name = "LogoEffect1"
  254.                 primaryLabel.Size = UDim2.new(0,30,0,30)
  255.                 primaryLabel.Position = UDim2.new(0,0,0,0)
  256.                 primaryLabel.BackgroundTransparency = 1
  257.                 primaryLabel.Text = text:sub(1,1)
  258.                 primaryLabel.Font = Enum.Font.SourceSansBold
  259.                 primaryLabel.TextSize = 30
  260.                 primaryLabel.TextColor3 = Color3.fromRGB(255,255,255)
  261.                 primaryLabel.Parent = titleContainer
  262.                
  263.                 local secondaryLabel = Instance.new("TextLabel")
  264.                 secondaryLabel.Name = "LogoEffect2"
  265.                 secondaryLabel.Size = UDim2.new(0,25,0,25)
  266.                 secondaryLabel.Position = UDim2.new(1,-12,0,0)
  267.                 secondaryLabel.BackgroundTransparency = 1
  268.                 secondaryLabel.Text = text:sub(2)
  269.                 secondaryLabel.Font = Enum.Font.SourceSansBold
  270.                 secondaryLabel.TextSize = 12
  271.                 secondaryLabel.TextYAlignment = Enum.TextYAlignment.Bottom
  272.                 secondaryLabel.TextColor3 = Color3.fromRGB(229,78,255)
  273.                 secondaryLabel.Parent = primaryLabel
  274.             end
  275.            
  276.             return titleContainer
  277.         end
  278.        
  279.         return extraLib
  280.     end
  281.    
  282.     function optionsLib:CreateSecondaryWindow()
  283.         local newWindow = Instance.new("Frame")
  284.         newWindow.Name = "SecondaryWindow"
  285.         newWindow.BackgroundColor3 = Color3.fromRGB(47,47,47)
  286.         newWindow.BorderSizePixel = 0
  287.         newWindow.Size = UDim2.new(0,500,0,280)
  288.         newWindow.Position = UDim2.new(0.5,-250,0.5,-140)
  289.         newWindow.Parent = newui
  290.        
  291.         local inview = false
  292.         local dragging = false
  293.         local lastmousex, lastmousey
  294.        
  295.         local drag2 = coroutine.wrap(function()
  296.             while runService.Heartbeat:Wait() do
  297.                 if dragging then
  298.                     local x, y = mouse.X, mouse.Y
  299.                     local dX, dY = x - lastmousex, y - lastmousey
  300.                     local dP = UDim2.new(0, dX, 0, dY)
  301.                     newWindow.Position = newWindow.Position + dP
  302.                     lastmousex, lastmousey = x, y
  303.                 end
  304.             end
  305.         end)
  306.        
  307.         newWindow.MouseEnter:Connect(function()
  308.             inview = true
  309.         end)
  310.            
  311.         newWindow.MouseLeave:Connect(function()
  312.             if not dragging then
  313.                 inview = false
  314.             end
  315.         end)
  316.            
  317.         mouse.Button1Down:Connect(function()
  318.             if inview then
  319.                 dragging = true
  320.                 lastmousex, lastmousey = mouse.X, mouse.Y
  321.             end
  322.         end)
  323.            
  324.         mouse.Button1Up:Connect(function()
  325.             dragging = false
  326.         end)
  327.        
  328.         drag2()
  329.        
  330.         local visibleToggle = true
  331.        
  332.         local extraLib = {}
  333.        
  334.         function extraLib:AddOptionTree(options, callback)
  335.             local optionContainer = Instance.new("ScrollingFrame")
  336.             optionContainer.Name = "OptionTree"
  337.             optionContainer.MidImage = "http://www.roblox.com/asset/?id=4812947"
  338.             optionContainer.BottomImage = "http://www.roblox.com/asset/?id=4812947"
  339.             optionContainer.TopImage = "http://www.roblox.com/asset/?id=4812947"
  340.             optionContainer.ScrollBarImageColor3 = Color3.fromRGB(172,172,172)
  341.             optionContainer.ScrollingDirection = Enum.ScrollingDirection.Y
  342.             optionContainer.BackgroundColor3 = Color3.fromRGB(61,61,61)
  343.             optionContainer.BorderSizePixel = 0
  344.             optionContainer.Parent = newWindow
  345.            
  346.             local optionLayout = Instance.new("UIListLayout")
  347.             optionLayout.Padding = UDim.new(0, 2)
  348.             optionLayout.Parent = optionContainer
  349.            
  350.             for i,v in pairs(options) do
  351.                 local name = v.Name
  352.                 local source = v.Source
  353.                 local optionButton = Instance.new("TextButton")
  354.                 optionButton.Name = "ScriptButton"
  355.                 optionButton.Size = UDim2.new(1,-12,0,20)
  356.                 optionButton.BackgroundColor3 = Color3.fromRGB(61,61,61)
  357.                 optionButton.Text = ("   "..name)
  358.                 optionButton.TextXAlignment = Enum.TextXAlignment.Left
  359.                 optionButton.Font = Enum.Font.SourceSans
  360.                 optionButton.TextColor3 = Color3.fromRGB(255,255,255)
  361.                 optionButton.TextSize = 14
  362.                 optionButton.BorderSizePixel = 0
  363.                 optionButton.AutoButtonColor = false
  364.                 optionButton.BorderColor3 = Color3.fromRGB(229,78,255)
  365.                 optionButton.Parent = optionContainer
  366.                 optionButton.MouseEnter:Connect(function()
  367.                     for i = 0, 2, 1 do
  368.                         optionButton.BorderSizePixel = i
  369.                         wait()
  370.                     end
  371.                 end)
  372.                 optionButton.MouseLeave:Connect(function()
  373.                     for i = 2, 0, -1 do
  374.                         optionButton.BorderSizePixel = i
  375.                         wait()
  376.                     end
  377.                 end)
  378.                 optionButton.MouseButton1Down:Connect(function()
  379.                     callback(source)
  380.                 end)
  381.             end
  382.             return optionContainer
  383.         end
  384.        
  385.         function extraLib:AddLabel(text)
  386.             local scriptLabel = Instance.new("TextLabel")
  387.             scriptLabel.BackgroundColor3 = Color3.fromRGB(31,31,31)
  388.             scriptLabel.BorderSizePixel = 0
  389.             scriptLabel.Size = UDim2.new(1, 0, 0, 18)
  390.             scriptLabel.Font = Enum.Font.SourceSans
  391.             scriptLabel.Text = text
  392.             scriptLabel.TextSize = 18
  393.             scriptLabel.TextColor3 = Color3.fromRGB(166,166,166)
  394.             scriptLabel.Parent = newWindow
  395.            
  396.             return scriptLabel
  397.         end
  398.        
  399.         function extraLib:AddInput(callback)
  400.             local inputBox = Instance.new("TextBox")
  401.             inputBox.BackgroundTransparency = 1
  402.             inputBox.Font = Enum.Font.SourceSans
  403.             inputBox.Text = ""
  404.             inputBox.PlaceholderText = "Write here..."
  405.             inputBox.TextColor3 = Color3.fromRGB(178,178,178)
  406.             inputBox.TextSize = 18
  407.             inputBox.ClearTextOnFocus = false
  408.             inputBox.TextXAlignment = Enum.TextXAlignment.Left
  409.             inputBox.TextYAlignment = Enum.TextYAlignment.Top
  410.             inputBox.MultiLine = true
  411.             inputBox.TextWrapped = true
  412.             inputBox.Parent = newWindow
  413.            
  414.             inputBox.FocusLost:Connect(function()
  415.                 callback(inputBox.Text)
  416.             end)
  417.            
  418.             return inputBox
  419.         end
  420.        
  421.         function extraLib:AddButton(title, callback)
  422.             local scriptButton = Instance.new("TextButton")
  423.             scriptButton.Name = "ScriptButton"
  424.             scriptButton.BackgroundColor3 = Color3.fromRGB(76,76,76)
  425.             scriptButton.AutoButtonColor = false
  426.             scriptButton.BorderColor3 = Color3.fromRGB(177,177,177)
  427.             scriptButton.BorderSizePixel = 0
  428.             scriptButton.Font = Enum.Font.SourceSans
  429.             scriptButton.Text = title
  430.             scriptButton.TextColor3 = Color3.fromRGB(255,255,255)
  431.             scriptButton.TextSize = 20
  432.             scriptButton.Parent = newWindow
  433.            
  434.             scriptButton.MouseEnter:Connect(function()
  435.                 scriptButton.BackgroundColor3 = Color3.fromRGB(159, 61, 162)
  436.                 scriptButton.BorderSizePixel = 1
  437.             end)
  438.             scriptButton.MouseLeave:Connect(function()
  439.                 scriptButton.BackgroundColor3 = Color3.fromRGB(76, 76, 76)
  440.                 scriptButton.BorderSizePixel = 0
  441.             end)
  442.             scriptButton.MouseButton1Down:Connect(function()
  443.                 callback()
  444.             end)
  445.                
  446.             return scriptButton
  447.         end
  448.        
  449.         function extraLib:AddColour(colour, callback)
  450.             local colourContainer = Instance.new("TextButton")
  451.             colourContainer.Text = ""
  452.             colourContainer.Name = "ScriptColour"
  453.             colourContainer.BackgroundColor3 = colour
  454.             colourContainer.AutoButtonColor = false
  455.             colourContainer.BorderSizePixel = 0
  456.            
  457.             colourContainer.MouseButton1Down:Connect(function()
  458.                 callback(colour)
  459.             end)
  460.            
  461.             return colourContainer
  462.         end
  463.        
  464.         function extraLib:AddContainer(clips, scrolling)
  465.             local scrolling = scrolling or false
  466.             local newContainer
  467.             if scrolling then
  468.                 newContainer = Instance.new("ScrollingFrame")
  469.                 newContainer.MidImage = "http://www.roblox.com/asset/?id=4812947"
  470.                 newContainer.BottomImage = "http://www.roblox.com/asset/?id=4812947"
  471.                 newContainer.TopImage = "http://www.roblox.com/asset/?id=4812947"
  472.                 newContainer.ScrollingDirection = Enum.ScrollingDirection.Y
  473.             else
  474.                 newContainer = Instance.new("Frame")
  475.             end
  476.             newContainer.Name = "Container"
  477.             newContainer.BackgroundColor3 = Color3.fromRGB(47,47,47)
  478.             newContainer.BorderSizePixel = 0
  479.             newContainer.ClipsDescendants = clips or false
  480.             newContainer.Parent = newWindow
  481.            
  482.             return newContainer
  483.         end
  484.        
  485.         function extraLib:ToggleVisibility()
  486.             visibleToggle = not visibleToggle
  487.             newWindow.Visible = visibleToggle
  488.         end
  489.        
  490.         function extraLib:AddTitle(title, logo)
  491.             local titleContainer = Instance.new("Frame")
  492.             titleContainer.Name = "TitleBar"
  493.             titleContainer.Size = UDim2.new(1,0,0,30)
  494.             titleContainer.Position = UDim2.new(0,0,0,0)
  495.             titleContainer.BackgroundColor3 = Color3.fromRGB(61,61,61)
  496.             titleContainer.BorderSizePixel = 0
  497.             titleContainer.Parent = newWindow
  498.            
  499.             local titleLabel = Instance.new("TextLabel")
  500.             titleLabel.Name = "Title"
  501.             titleLabel.Size = UDim2.new(1,0,1,0)
  502.             titleLabel.BackgroundTransparency = 1
  503.             titleLabel.Font = Enum.Font.SourceSans
  504.             titleLabel.Text = title
  505.             titleLabel.TextColor3 = Color3.fromRGB(255,255,255)
  506.             titleLabel.TextSize = 18
  507.             titleLabel.Parent = titleContainer
  508.            
  509.             local logoEnabled = false
  510.            
  511.             if logo then
  512.                 logoEnabled = logo.Enabled or false
  513.             end
  514.            
  515.             if logoEnabled then
  516.                 local text = logo.Text
  517.                
  518.                 local primaryLabel = Instance.new("TextLabel")
  519.                 primaryLabel.Name = "LogoEffect1"
  520.                 primaryLabel.Size = UDim2.new(0,30,0,30)
  521.                 primaryLabel.Position = UDim2.new(0,0,0,0)
  522.                 primaryLabel.BackgroundTransparency = 1
  523.                 primaryLabel.Text = text:sub(1,1)
  524.                 primaryLabel.Font = Enum.Font.SourceSansBold
  525.                 primaryLabel.TextSize = 30
  526.                 primaryLabel.TextColor3 = Color3.fromRGB(255,255,255)
  527.                 primaryLabel.Parent = titleContainer
  528.                
  529.                 local secondaryLabel = Instance.new("TextLabel")
  530.                 secondaryLabel.Name = "LogoEffect2"
  531.                 secondaryLabel.Size = UDim2.new(0,25,0,25)
  532.                 secondaryLabel.Position = UDim2.new(1,-12,0,0)
  533.                 secondaryLabel.BackgroundTransparency = 1
  534.                 secondaryLabel.Text = text:sub(2)
  535.                 secondaryLabel.Font = Enum.Font.SourceSansBold
  536.                 secondaryLabel.TextSize = 12
  537.                 secondaryLabel.TextYAlignment = Enum.TextYAlignment.Bottom
  538.                 secondaryLabel.TextColor3 = Color3.fromRGB(229,78,255)
  539.                 secondaryLabel.Parent = primaryLabel
  540.             end
  541.            
  542.             return titleContainer
  543.         end
  544.        
  545.         return extraLib
  546.     end
  547.    
  548.     return optionsLib
  549. end
  550.  
  551. return ui
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement