ScriptingFluff

wally's ui lib v2

Apr 28th, 2020
783
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 47.40 KB | None | 0 0
  1. if game.GameId == 833423526 then print("magik"); print("uwu"); end
  2. local library = {count = 0, queue = {}, callbacks = {}, rainbowtable = {}, toggled = true, binds = {}};
  3. local defaults; do
  4.     local dragger = {}; do
  5.         local mouse        = game:GetService("Players").LocalPlayer:GetMouse();
  6.         local inputService = game:GetService('UserInputService');
  7.         local heartbeat    = game:GetService("RunService").Heartbeat;
  8.         -- // credits to Ririchi / Inori for this cute drag function :)
  9.         function dragger.new(frame)
  10.             local s, event = pcall(function()
  11.                 return frame.MouseEnter
  12.             end)
  13.    
  14.             if s then
  15.                 frame.Active = true;
  16.                
  17.                 event:connect(function()
  18.                     local input = frame.InputBegan:connect(function(key)
  19.                         if key.UserInputType == Enum.UserInputType.MouseButton1 then
  20.                             local objectPosition = Vector2.new(mouse.X - frame.AbsolutePosition.X, mouse.Y - frame.AbsolutePosition.Y);
  21.                             while heartbeat:wait() and inputService:IsMouseButtonPressed(Enum.UserInputType.MouseButton1) do
  22.                                 pcall(function()
  23.                                     frame:TweenPosition(UDim2.new(0, mouse.X - objectPosition.X + (frame.Size.X.Offset * frame.AnchorPoint.X), 0, mouse.Y - objectPosition.Y + (frame.Size.Y.Offset * frame.AnchorPoint.Y)), 'Out', 'Linear', 0.1, true);
  24.                                 end)
  25.                             end
  26.                         end
  27.                     end)
  28.    
  29.                     local leave;
  30.                     leave = frame.MouseLeave:connect(function()
  31.                         input:disconnect();
  32.                         leave:disconnect();
  33.                     end)
  34.                 end)
  35.             end
  36.         end
  37.  
  38.         game:GetService('UserInputService').InputBegan:connect(function(key, gpe)
  39.             if (not gpe) then
  40.                 if key.KeyCode == Enum.KeyCode.RightControl then
  41.                     library.toggled = not library.toggled;
  42.                     for i, data in next, library.queue do
  43.                         local pos = (library.toggled and data.p or UDim2.new(-1, 0, -0.5,0))
  44.                         data.w:TweenPosition(pos, (library.toggled and 'Out' or 'In'), 'Quad', 0.15, true)
  45.                         wait();
  46.                     end
  47.                 end
  48.             end
  49.         end)
  50.     end
  51.    
  52.     local types = {}; do
  53.         types.__index = types;
  54.         function types.window(name, options)
  55.             library.count = library.count + 1
  56.             local newWindow = library:Create('Frame', {
  57.                 Name = name;
  58.                 Size = UDim2.new(0, 190, 0, 30);
  59.                 BackgroundColor3 = options.topcolor;
  60.                 BorderSizePixel = 0;
  61.                 Parent = library.container;
  62.                 Position = UDim2.new(0, (15 + (200 * library.count) - 200), 0, 0);
  63.                 ZIndex = 3;
  64.                 library:Create('TextLabel', {
  65.                     Text = name;
  66.                     Size = UDim2.new(1, -10, 1, 0);
  67.                     Position = UDim2.new(0, 5, 0, 0);
  68.                     BackgroundTransparency = 1;
  69.                     Font = Enum.Font.Code;
  70.                     TextSize = options.titlesize;
  71.                     Font = options.titlefont;
  72.                     TextColor3 = options.titletextcolor;
  73.                     TextStrokeTransparency = library.options.titlestroke;
  74.                     TextStrokeColor3 = library.options.titlestrokecolor;
  75.                     ZIndex = 3;
  76.                 });
  77.                 library:Create("TextButton", {
  78.                     Size = UDim2.new(0, 30, 0, 30);
  79.                     Position = UDim2.new(1, -35, 0, 0);
  80.                     BackgroundTransparency = 1;
  81.                     Text = "-";
  82.                     TextSize = options.titlesize;
  83.                     Font = options.titlefont;--Enum.Font.Code;
  84.                     Name = 'window_toggle';
  85.                     TextColor3 = options.titletextcolor;
  86.                     TextStrokeTransparency = library.options.titlestroke;
  87.                     TextStrokeColor3 = library.options.titlestrokecolor;
  88.                     ZIndex = 3;
  89.                 });
  90.                 library:Create("Frame", {
  91.                     Name = 'Underline';
  92.                     Size = UDim2.new(1, 0, 0, 2);
  93.                     Position = UDim2.new(0, 0, 1, -2);
  94.                     BackgroundColor3 = (options.underlinecolor ~= "rainbow" and options.underlinecolor or Color3.new());
  95.                     BorderSizePixel = 0;
  96.                     ZIndex = 3;
  97.                 });
  98.                 library:Create('Frame', {
  99.                     Name = 'container';
  100.                     Position = UDim2.new(0, 0, 1, 0);
  101.                     Size = UDim2.new(1, 0, 0, 0);
  102.                     BorderSizePixel = 0;
  103.                     BackgroundColor3 = options.bgcolor;
  104.                     ClipsDescendants = false;
  105.                     library:Create('UIListLayout', {
  106.                         Name = 'List';
  107.                         SortOrder = Enum.SortOrder.LayoutOrder;
  108.                     })
  109.                 });
  110.             })
  111.            
  112.             if options.underlinecolor == "rainbow" then
  113.                 table.insert(library.rainbowtable, newWindow:FindFirstChild('Underline'))
  114.             end
  115.  
  116.             local window = setmetatable({
  117.                 count = 0;
  118.                 object = newWindow;
  119.                 container = newWindow.container;
  120.                 toggled = true;
  121.                 flags   = {};
  122.  
  123.             }, types)
  124.  
  125.             table.insert(library.queue, {
  126.                 w = window.object;
  127.                 p = window.object.Position;
  128.             })
  129.  
  130.             newWindow:FindFirstChild("window_toggle").MouseButton1Click:connect(function()
  131.                 window.toggled = not window.toggled;
  132.                 newWindow:FindFirstChild("window_toggle").Text = (window.toggled and "+" or "-")
  133.                 if (not window.toggled) then
  134.                     window.container.ClipsDescendants = true;
  135.                 end
  136.                 wait();
  137.                 local y = 0;
  138.                 for i, v in next, window.container:GetChildren() do
  139.                     if (not v:IsA('UIListLayout')) then
  140.                         y = y + v.AbsoluteSize.Y;
  141.                     end
  142.                 end
  143.  
  144.                 local targetSize = window.toggled and UDim2.new(1, 0, 0, y+5) or UDim2.new(1, 0, 0, 0);
  145.                 local targetDirection = window.toggled and "In" or "Out"
  146.  
  147.                 window.container:TweenSize(targetSize, targetDirection, "Quad", 0.15, true)
  148.                 wait(.15)
  149.                 if window.toggled then
  150.                     window.container.ClipsDescendants = false;
  151.                 end
  152.             end)
  153.  
  154.             return window;
  155.         end
  156.        
  157.         function types:Resize()
  158.             local y = 0;
  159.             for i, v in next, self.container:GetChildren() do
  160.                 if (not v:IsA('UIListLayout')) then
  161.                     y = y + v.AbsoluteSize.Y;
  162.                 end
  163.             end
  164.             self.container.Size = UDim2.new(1, 0, 0, y+5)
  165.         end
  166.        
  167.         function types:GetOrder()
  168.             local c = 0;
  169.             for i, v in next, self.container:GetChildren() do
  170.                 if (not v:IsA('UIListLayout')) then
  171.                     c = c + 1
  172.                 end
  173.             end
  174.             return c
  175.         end
  176.        
  177.         function types:Label(text)
  178.             local v = game:GetService'TextService':GetTextSize(text, 18, Enum.Font.SourceSans, Vector2.new(math.huge, math.huge))
  179.             local object = library:Create('Frame', {
  180.                 Size = UDim2.new(1, 0, 0, v.Y + 5);
  181.                 BackgroundTransparency  = 1;
  182.                 library:Create('TextLabel', {
  183.                     Size = UDim2.new(1, 0, 1, 0);
  184.                     Position = UDim2.new(0, 10, 0, 0);
  185.                     LayoutOrder = self:GetOrder();
  186.  
  187.                     Text = text;
  188.                     TextSize = 18;
  189.                     Font = Enum.Font.SourceSans;
  190.                     TextColor3 = Color3.fromRGB(255, 255, 255);
  191.                     BackgroundTransparency = 1;
  192.                     TextXAlignment = Enum.TextXAlignment.Left;
  193.                     TextWrapped = true;
  194.                 });
  195.                 Parent = self.container
  196.             })
  197.             self:Resize();
  198.         end
  199.  
  200.         function types:Toggle(name, options, callback)
  201.             local default  = options.default or false;
  202.             local location = options.location or self.flags;
  203.             local flag     = options.flag or "";
  204.             local callback = callback or function() end;
  205.            
  206.             location[flag] = default;
  207.  
  208.             local check = library:Create('Frame', {
  209.                 BackgroundTransparency = 1;
  210.                 Size = UDim2.new(1, 0, 0, 25);
  211.                 LayoutOrder = self:GetOrder();
  212.                 library:Create('TextLabel', {
  213.                     Name = name;
  214.                     Text = "\r" .. name;
  215.                     BackgroundTransparency = 1;
  216.                     TextColor3 = library.options.textcolor;
  217.                     Position = UDim2.new(0, 5, 0, 0);
  218.                     Size     = UDim2.new(1, -5, 1, 0);
  219.                     TextXAlignment = Enum.TextXAlignment.Left;
  220.                     Font = library.options.font;
  221.                     TextSize = library.options.fontsize;
  222.                     TextStrokeTransparency = library.options.textstroke;
  223.                     TextStrokeColor3 = library.options.strokecolor;
  224.                     library:Create('TextButton', {
  225.                         Text = (location[flag] and utf8.char(10003) or "");
  226.                         Font = library.options.font;
  227.                         TextSize = library.options.fontsize;
  228.                         Name = 'Checkmark';
  229.                         Size = UDim2.new(0, 20, 0, 20);
  230.                         Position = UDim2.new(1, -25, 0, 4);
  231.                         TextColor3 = library.options.textcolor;
  232.                         BackgroundColor3 = library.options.bgcolor;
  233.                         BorderColor3 = library.options.bordercolor;
  234.                         TextStrokeTransparency = library.options.textstroke;
  235.                         TextStrokeColor3 = library.options.strokecolor;
  236.                     })
  237.                 });
  238.                 Parent = self.container;
  239.             });
  240.                
  241.             local function click(t)
  242.                 location[flag] = not location[flag];
  243.                 callback(location[flag])
  244.                 check:FindFirstChild(name).Checkmark.Text = location[flag] and utf8.char(10003) or "";
  245.             end
  246.  
  247.             check:FindFirstChild(name).Checkmark.MouseButton1Click:connect(click)
  248.             library.callbacks[flag] = click;
  249.  
  250.             if location[flag] == true then
  251.                 callback(location[flag])
  252.             end
  253.  
  254.             self:Resize();
  255.             return {
  256.                 Set = function(self, b)
  257.                     location[flag] = b;
  258.                     callback(location[flag])
  259.                     check:FindFirstChild(name).Checkmark.Text = location[flag] and utf8.char(10003) or "";
  260.                 end
  261.             }
  262.         end
  263.        
  264.         function types:Button(name, callback)
  265.             callback = callback or function() end;
  266.            
  267.             local check = library:Create('Frame', {
  268.                 BackgroundTransparency = 1;
  269.                 Size = UDim2.new(1, 0, 0, 25);
  270.                 LayoutOrder = self:GetOrder();
  271.                 library:Create('TextButton', {
  272.                     Name = name;
  273.                     Text = name;
  274.                     BackgroundColor3 = library.options.btncolor;
  275.                     BorderColor3 = library.options.bordercolor;
  276.                     TextStrokeTransparency = library.options.textstroke;
  277.                     TextStrokeColor3 = library.options.strokecolor;
  278.                     TextColor3 = library.options.textcolor;
  279.                     Position = UDim2.new(0, 5, 0, 5);
  280.                     Size     = UDim2.new(1, -10, 0, 20);
  281.                     Font = library.options.font;
  282.                     TextSize = library.options.fontsize;
  283.                 });
  284.                 Parent = self.container;
  285.             });
  286.            
  287.             check:FindFirstChild(name).MouseButton1Click:connect(callback)
  288.             self:Resize();
  289.  
  290.             return {
  291.                 Fire = function()
  292.                     callback();
  293.                 end
  294.             }
  295.         end
  296.        
  297.         function types:Box(name, options, callback) --type, default, data, location, flag)
  298.             local type   = options.type or "";
  299.             local default = options.default or "";
  300.             local data = options.data
  301.             local location = options.location or self.flags;
  302.             local flag     = options.flag or "";
  303.             local callback = callback or function() end;
  304.             local min      = options.min or 0;
  305.             local max      = options.max or 9e9;
  306.  
  307.             if type == 'number' and (not tonumber(default)) then
  308.                 location[flag] = default;
  309.             else
  310.                 location[flag] = "";
  311.                 default = "";
  312.             end
  313.  
  314.             local check = library:Create('Frame', {
  315.                 BackgroundTransparency = 1;
  316.                 Size = UDim2.new(1, 0, 0, 25);
  317.                 LayoutOrder = self:GetOrder();
  318.                 library:Create('TextLabel', {
  319.                     Name = name;
  320.                     Text = "\r" .. name;
  321.                     BackgroundTransparency = 1;
  322.                     TextColor3 = library.options.textcolor;
  323.                     TextStrokeTransparency = library.options.textstroke;
  324.                     TextStrokeColor3 = library.options.strokecolor;
  325.                     Position = UDim2.new(0, 5, 0, 0);
  326.                     Size     = UDim2.new(1, -5, 1, 0);
  327.                     TextXAlignment = Enum.TextXAlignment.Left;
  328.                     Font = library.options.font;
  329.                     TextSize = library.options.fontsize;
  330.                     library:Create('TextBox', {
  331.                         TextStrokeTransparency = library.options.textstroke;
  332.                         TextStrokeColor3 = library.options.strokecolor;
  333.                         Text = tostring(default);
  334.                         Font = library.options.font;
  335.                         TextSize = library.options.fontsize;
  336.                         Name = 'Box';
  337.                         Size = UDim2.new(0, 60, 0, 20);
  338.                         Position = UDim2.new(1, -65, 0, 3);
  339.                         TextColor3 = library.options.textcolor;
  340.                         BackgroundColor3 = library.options.boxcolor;
  341.                         BorderColor3 = library.options.bordercolor;
  342.                         PlaceholderColor3 = library.options.placeholdercolor;
  343.                     })
  344.                 });
  345.                 Parent = self.container;
  346.             });
  347.        
  348.             local box = check:FindFirstChild(name):FindFirstChild('Box');
  349.             box.FocusLost:connect(function(e)
  350.                 local old = location[flag];
  351.                 if type == "number" then
  352.                     local num = tonumber(box.Text)
  353.                     if (not num) then
  354.                         box.Text = tonumber(location[flag])
  355.                     else
  356.                         location[flag] = math.clamp(num, min, max)
  357.                         box.Text = tonumber(location[flag])
  358.                     end
  359.                 else
  360.                     location[flag] = tostring(box.Text)
  361.                 end
  362.  
  363.                 callback(location[flag], old, e)
  364.             end)
  365.            
  366.             if type == 'number' then
  367.                 box:GetPropertyChangedSignal('Text'):connect(function()
  368.                     box.Text = string.gsub(box.Text, "[%a+]", "");
  369.                 end)
  370.             end
  371.            
  372.             self:Resize();
  373.             return box
  374.         end
  375.        
  376.         function types:Bind(name, options, callback)
  377.             local location     = options.location or self.flags;
  378.             local keyboardOnly = options.kbonly or false
  379.             local flag         = options.flag or "";
  380.             local callback     = callback or function() end;
  381.             local default      = options.default;
  382.  
  383.             local passed = true;
  384.             if keyboardOnly and (tostring(default):find('MouseButton')) then
  385.                 passed = false
  386.             end
  387.             if passed then
  388.                location[flag] = default
  389.             end
  390.            
  391.             local banned = {
  392.                 Return = true;
  393.                 Space = true;
  394.                 Tab = true;
  395.                 Unknown = true;
  396.             }
  397.            
  398.             local shortNames = {
  399.                 RightControl = 'RightCtrl';
  400.                 LeftControl = 'LeftCtrl';
  401.                 LeftShift = 'LShift';
  402.                 RightShift = 'RShift';
  403.                 MouseButton1 = "Mouse1";
  404.                 MouseButton2 = "Mouse2";
  405.             }
  406.            
  407.             local allowed = {
  408.                 MouseButton1 = true;
  409.                 MouseButton2 = true;
  410.             }      
  411.  
  412.             local nm = (default and (shortNames[default.Name] or default.Name) or "None");
  413.             local check = library:Create('Frame', {
  414.                 BackgroundTransparency = 1;
  415.                 Size = UDim2.new(1, 0, 0, 30);
  416.                 LayoutOrder = self:GetOrder();
  417.                 library:Create('TextLabel', {
  418.                     Name = name;
  419.                     Text = "\r" .. name;
  420.                     BackgroundTransparency = 1;
  421.                     TextColor3 = library.options.textcolor;
  422.                     Position = UDim2.new(0, 5, 0, 0);
  423.                     Size     = UDim2.new(1, -5, 1, 0);
  424.                     TextXAlignment = Enum.TextXAlignment.Left;
  425.                     Font = library.options.font;
  426.                     TextSize = library.options.fontsize;
  427.                     TextStrokeTransparency = library.options.textstroke;
  428.                     TextStrokeColor3 = library.options.strokecolor;
  429.                     BorderColor3     = library.options.bordercolor;
  430.                     BorderSizePixel  = 1;
  431.                     library:Create('TextButton', {
  432.                         Name = 'Keybind';
  433.                         Text = nm;
  434.                         TextStrokeTransparency = library.options.textstroke;
  435.                         TextStrokeColor3 = library.options.strokecolor;
  436.                         Font = library.options.font;
  437.                         TextSize = library.options.fontsize;
  438.                         Size = UDim2.new(0, 60, 0, 20);
  439.                         Position = UDim2.new(1, -65, 0, 5);
  440.                         TextColor3 = library.options.textcolor;
  441.                         BackgroundColor3 = library.options.bgcolor;
  442.                         BorderColor3     = library.options.bordercolor;
  443.                         BorderSizePixel  = 1;
  444.                     })
  445.                 });
  446.                 Parent = self.container;
  447.             });
  448.              
  449.             local button = check:FindFirstChild(name).Keybind;
  450.             button.MouseButton1Click:connect(function()
  451.                 library.binding = true
  452.  
  453.                 button.Text = "..."
  454.                 local a, b = game:GetService('UserInputService').InputBegan:wait();
  455.                 local name = tostring(a.KeyCode.Name);
  456.                 local typeName = tostring(a.UserInputType.Name);
  457.  
  458.                 if (a.UserInputType ~= Enum.UserInputType.Keyboard and (allowed[a.UserInputType.Name]) and (not keyboardOnly)) or (a.KeyCode and (not banned[a.KeyCode.Name])) then
  459.                     local name = (a.UserInputType ~= Enum.UserInputType.Keyboard and a.UserInputType.Name or a.KeyCode.Name);
  460.                     location[flag] = (a);
  461.                     button.Text = shortNames[name] or name;
  462.                    
  463.                 else
  464.                     if (location[flag]) then
  465.                         if (not pcall(function()
  466.                             return location[flag].UserInputType
  467.                         end)) then
  468.                             local name = tostring(location[flag])
  469.                             button.Text = shortNames[name] or name
  470.                         else
  471.                             local name = (location[flag].UserInputType ~= Enum.UserInputType.Keyboard and location[flag].UserInputType.Name or location[flag].KeyCode.Name);
  472.                             button.Text = shortNames[name] or name;
  473.                         end
  474.                     end
  475.                 end
  476.  
  477.                 wait(0.1)  
  478.                 library.binding = false;
  479.             end)
  480.            
  481.             if location[flag] then
  482.                 button.Text = shortNames[tostring(location[flag].Name)] or tostring(location[flag].Name)
  483.             end
  484.  
  485.             library.binds[flag] = {
  486.                 location = location;
  487.                 callback = callback;
  488.             };
  489.  
  490.             self:Resize();
  491.         end
  492.    
  493.         function types:Section(name)
  494.             local order = self:GetOrder();
  495.             local determinedSize = UDim2.new(1, 0, 0, 25)
  496.             local determinedPos = UDim2.new(0, 0, 0, 4);
  497.             local secondarySize = UDim2.new(1, 0, 0, 20);
  498.                        
  499.             if order == 0 then
  500.                 determinedSize = UDim2.new(1, 0, 0, 21)
  501.                 determinedPos = UDim2.new(0, 0, 0, -1);
  502.                 secondarySize = nil
  503.             end
  504.            
  505.             local check = library:Create('Frame', {
  506.                 Name = 'Section';
  507.                 BackgroundTransparency = 1;
  508.                 Size = determinedSize;
  509.                 BackgroundColor3 = library.options.sectncolor;
  510.                 BorderSizePixel = 0;
  511.                 LayoutOrder = order;
  512.                 library:Create('TextLabel', {
  513.                     Name = 'section_lbl';
  514.                     Text = name;
  515.                     BackgroundTransparency = 0;
  516.                     BorderSizePixel = 0;
  517.                     BackgroundColor3 = library.options.sectncolor;
  518.                     TextColor3 = library.options.textcolor;
  519.                     Position = determinedPos;
  520.                     Size     = (secondarySize or UDim2.new(1, 0, 1, 0));
  521.                     Font = library.options.font;
  522.                     TextSize = library.options.fontsize;
  523.                     TextStrokeTransparency = library.options.textstroke;
  524.                     TextStrokeColor3 = library.options.strokecolor;
  525.                 });
  526.                 Parent = self.container;
  527.             });
  528.        
  529.             self:Resize();
  530.         end
  531.  
  532.         function types:Slider(name, options, callback)
  533.             local default = options.default or options.min;
  534.             local min     = options.min or 0;
  535.             local max      = options.max or 1;
  536.             local location = options.location or self.flags;
  537.             local precise  = options.precise  or false -- e.g 0, 1 vs 0, 0.1, 0.2, ...
  538.             local flag     = options.flag or "";
  539.             local callback = callback or function() end
  540.  
  541.             location[flag] = default;
  542.  
  543.             local check = library:Create('Frame', {
  544.                 BackgroundTransparency = 1;
  545.                 Size = UDim2.new(1, 0, 0, 25);
  546.                 LayoutOrder = self:GetOrder();
  547.                 library:Create('TextLabel', {
  548.                     Name = name;
  549.                     TextStrokeTransparency = library.options.textstroke;
  550.                     TextStrokeColor3 = library.options.strokecolor;
  551.                     Text = "\r" .. name;
  552.                     BackgroundTransparency = 1;
  553.                     TextColor3 = library.options.textcolor;
  554.                     Position = UDim2.new(0, 5, 0, 2);
  555.                     Size     = UDim2.new(1, -5, 1, 0);
  556.                     TextXAlignment = Enum.TextXAlignment.Left;
  557.                     Font = library.options.font;
  558.                     TextSize = library.options.fontsize;
  559.                     library:Create('Frame', {
  560.                         Name = 'Container';
  561.                         Size = UDim2.new(0, 60, 0, 20);
  562.                         Position = UDim2.new(1, -65, 0, 3);
  563.                         BackgroundTransparency = 1;
  564.                         --BorderColor3 = library.options.bordercolor;
  565.                         BorderSizePixel = 0;
  566.                         library:Create('TextLabel', {
  567.                             Name = 'ValueLabel';
  568.                             Text = default;
  569.                             BackgroundTransparency = 1;
  570.                             TextColor3 = library.options.textcolor;
  571.                             Position = UDim2.new(0, -10, 0, 0);
  572.                             Size     = UDim2.new(0, 1, 1, 0);
  573.                             TextXAlignment = Enum.TextXAlignment.Right;
  574.                             Font = library.options.font;
  575.                             TextSize = library.options.fontsize;
  576.                             TextStrokeTransparency = library.options.textstroke;
  577.                             TextStrokeColor3 = library.options.strokecolor;
  578.                         });
  579.                         library:Create('TextButton', {
  580.                             Name = 'Button';
  581.                             Size = UDim2.new(0, 5, 1, -2);
  582.                             Position = UDim2.new(0, 0, 0, 1);
  583.                             AutoButtonColor = false;
  584.                             Text = "";
  585.                             BackgroundColor3 = Color3.fromRGB(20, 20, 20);
  586.                             BorderSizePixel = 0;
  587.                             ZIndex = 2;
  588.                             TextStrokeTransparency = library.options.textstroke;
  589.                             TextStrokeColor3 = library.options.strokecolor;
  590.                         });
  591.                         library:Create('Frame', {
  592.                             Name = 'Line';
  593.                             BackgroundTransparency = 0;
  594.                             Position = UDim2.new(0, 0, 0.5, 0);
  595.                             Size     = UDim2.new(1, 0, 0, 1);
  596.                             BackgroundColor3 = Color3.fromRGB(255, 255, 255);
  597.                             BorderSizePixel = 0;
  598.                         });
  599.                     })
  600.                 });
  601.                 Parent = self.container;
  602.             });
  603.  
  604.             local overlay = check:FindFirstChild(name);
  605.  
  606.             local renderSteppedConnection;
  607.             local inputBeganConnection;
  608.             local inputEndedConnection;
  609.             local mouseLeaveConnection;
  610.             local mouseDownConnection;
  611.             local mouseUpConnection;
  612.  
  613.             check:FindFirstChild(name).Container.MouseEnter:connect(function()
  614.                 local function update()
  615.                     if renderSteppedConnection then renderSteppedConnection:disconnect() end
  616.                    
  617.  
  618.                     renderSteppedConnection = game:GetService('RunService').RenderStepped:connect(function()
  619.                         local mouse = game:GetService("UserInputService"):GetMouseLocation()
  620.                         local percent = (mouse.X - overlay.Container.AbsolutePosition.X) / (overlay.Container.AbsoluteSize.X)
  621.                         percent = math.clamp(percent, 0, 1)
  622.                         percent = tonumber(string.format("%.2f", percent))
  623.  
  624.                         overlay.Container.Button.Position = UDim2.new(math.clamp(percent, 0, 0.99), 0, 0, 1)
  625.                        
  626.                         local num = min + (max - min) * percent
  627.                         local value = (precise and num or math.floor(num))
  628.  
  629.                         overlay.Container.ValueLabel.Text = value;
  630.                         callback(tonumber(value))
  631.                         location[flag] = tonumber(value)
  632.                     end)
  633.                 end
  634.  
  635.                 local function disconnect()
  636.                     if renderSteppedConnection then renderSteppedConnection:disconnect() end
  637.                     if inputBeganConnection then inputBeganConnection:disconnect() end
  638.                     if inputEndedConnection then inputEndedConnection:disconnect() end
  639.                     if mouseLeaveConnection then mouseLeaveConnection:disconnect() end
  640.                     if mouseUpConnection then mouseUpConnection:disconnect() end
  641.                 end
  642.  
  643.                 inputBeganConnection = check:FindFirstChild(name).Container.InputBegan:connect(function(input)
  644.                     if input.UserInputType == Enum.UserInputType.MouseButton1 then
  645.                         update()
  646.                     end
  647.                 end)
  648.  
  649.                 inputEndedConnection = check:FindFirstChild(name).Container.InputEnded:connect(function(input)
  650.                     if input.UserInputType == Enum.UserInputType.MouseButton1 then
  651.                         disconnect()
  652.                     end
  653.                 end)
  654.  
  655.                 mouseDownConnection = check:FindFirstChild(name).Container.Button.MouseButton1Down:connect(update)
  656.                 mouseUpConnection   = game:GetService("UserInputService").InputEnded:connect(function(a, b)
  657.                     if a.UserInputType == Enum.UserInputType.MouseButton1 and (mouseDownConnection.Connected) then
  658.                         disconnect()
  659.                     end
  660.                 end)
  661.             end)    
  662.  
  663.             if default ~= min then
  664.                 local percent = 1 - ((max - default) / (max - min))
  665.                 local number  = default
  666.  
  667.                 number = tonumber(string.format("%.2f", number))
  668.                 if (not precise) then
  669.                     number = math.floor(number)
  670.                 end
  671.  
  672.                 overlay.Container.Button.Position  = UDim2.new(math.clamp(percent, 0, 0.99), 0,  0, 1)
  673.                 overlay.Container.ValueLabel.Text  = number
  674.             end
  675.  
  676.             self:Resize();
  677.             return {
  678.                 Set = function(self, value)
  679.                     local percent = 1 - ((max - value) / (max - min))
  680.                     local number  = value
  681.  
  682.                     number = tonumber(string.format("%.2f", number))
  683.                     if (not precise) then
  684.                         number = math.floor(number)
  685.                     end
  686.  
  687.                     overlay.Container.Button.Position  = UDim2.new(math.clamp(percent, 0, 0.99), 0,  0, 1)
  688.                     overlay.Container.ValueLabel.Text  = number
  689.                     location[flag] = number
  690.                     callback(number)
  691.                 end
  692.             }
  693.         end
  694.  
  695.         function types:SearchBox(text, options, callback)
  696.             local list = options.list or {};
  697.             local flag = options.flag or "";
  698.             local location = options.location or self.flags;
  699.             local callback = callback or function() end;
  700.  
  701.             local busy = false;
  702.             local box = library:Create('Frame', {
  703.                 BackgroundTransparency = 1;
  704.                 Size = UDim2.new(1, 0, 0, 25);
  705.                 LayoutOrder = self:GetOrder();
  706.                 library:Create('TextBox', {
  707.                     Text = "";
  708.                     PlaceholderText = text;
  709.                     PlaceholderColor3 = Color3.fromRGB(60, 60, 60);
  710.                     Font = library.options.font;
  711.                     TextSize = library.options.fontsize;
  712.                     Name = 'Box';
  713.                     Size = UDim2.new(1, -10, 0, 20);
  714.                     Position = UDim2.new(0, 5, 0, 4);
  715.                     TextColor3 = library.options.textcolor;
  716.                     BackgroundColor3 = library.options.dropcolor;
  717.                     BorderColor3 = library.options.bordercolor;
  718.                     TextStrokeTransparency = library.options.textstroke;
  719.                     TextStrokeColor3 = library.options.strokecolor;
  720.                     library:Create('ScrollingFrame', {
  721.                         Position = UDim2.new(0, 0, 1, 1);
  722.                         Name = 'Container';
  723.                         BackgroundColor3 = library.options.btncolor;
  724.                         ScrollBarThickness = 0;
  725.                         BorderSizePixel = 0;
  726.                         BorderColor3 = library.options.bordercolor;
  727.                         Size = UDim2.new(1, 0, 0, 0);
  728.                         library:Create('UIListLayout', {
  729.                             Name = 'ListLayout';
  730.                             SortOrder = Enum.SortOrder.LayoutOrder;
  731.                         });
  732.                         ZIndex = 2;
  733.                     });
  734.                 });
  735.                 Parent = self.container;
  736.             })
  737.  
  738.             local function rebuild(text)
  739.                 box:FindFirstChild('Box').Container.ScrollBarThickness = 0
  740.                 for i, child in next, box:FindFirstChild('Box').Container:GetChildren() do
  741.                     if (not child:IsA('UIListLayout')) then
  742.                         child:Destroy();
  743.                     end
  744.                 end
  745.  
  746.                 if #text > 0 then
  747.                     for i, v in next, list do
  748.                         if string.sub(string.lower(v), 1, string.len(text)) == string.lower(text) then
  749.                             local button = library:Create('TextButton', {
  750.                                 Text = v;
  751.                                 Font = library.options.font;
  752.                                 TextSize = library.options.fontsize;
  753.                                 TextColor3 = library.options.textcolor;
  754.                                 BorderColor3 = library.options.bordercolor;
  755.                                 TextStrokeTransparency = library.options.textstroke;
  756.                                 TextStrokeColor3 = library.options.strokecolor;
  757.                                 Parent = box:FindFirstChild('Box').Container;
  758.                                 Size = UDim2.new(1, 0, 0, 20);
  759.                                 LayoutOrder = i;
  760.                                 BackgroundColor3 = library.options.btncolor;
  761.                                 ZIndex = 2;
  762.                             })
  763.  
  764.                             button.MouseButton1Click:connect(function()
  765.                                 busy = true;
  766.                                 box:FindFirstChild('Box').Text = button.Text;
  767.                                 wait();
  768.                                 busy = false;
  769.  
  770.                                 location[flag] = button.Text;
  771.                                 callback(location[flag])
  772.  
  773.                                 box:FindFirstChild('Box').Container.ScrollBarThickness = 0
  774.                                 for i, child in next, box:FindFirstChild('Box').Container:GetChildren() do
  775.                                     if (not child:IsA('UIListLayout')) then
  776.                                         child:Destroy();
  777.                                     end
  778.                                 end
  779.                                 box:FindFirstChild('Box').Container:TweenSize(UDim2.new(1, 0, 0, 0), 'Out', 'Quad', 0.25, true)
  780.                             end)
  781.                         end
  782.                     end
  783.                 end
  784.  
  785.                 local c = box:FindFirstChild('Box').Container:GetChildren()
  786.                 local ry = (20 * (#c)) - 20
  787.  
  788.                 local y = math.clamp((20 * (#c)) - 20, 0, 100)
  789.                 if ry > 100 then
  790.                     box:FindFirstChild('Box').Container.ScrollBarThickness = 5;
  791.                 end
  792.  
  793.                 box:FindFirstChild('Box').Container:TweenSize(UDim2.new(1, 0, 0, y), 'Out', 'Quad', 0.25, true)
  794.                 box:FindFirstChild('Box').Container.CanvasSize = UDim2.new(1, 0, 0, (20 * (#c)) - 20)
  795.             end
  796.  
  797.             box:FindFirstChild('Box'):GetPropertyChangedSignal('Text'):connect(function()
  798.                 if (not busy) then
  799.                     rebuild(box:FindFirstChild('Box').Text)
  800.                 end
  801.             end);
  802.  
  803.             local function reload(new_list)
  804.                 list = new_list;
  805.                 rebuild("")
  806.             end
  807.             self:Resize();
  808.             return reload, box:FindFirstChild('Box');
  809.         end
  810.        
  811.         function types:Dropdown(name, options, callback)
  812.             local location = options.location or self.flags;
  813.             local flag = options.flag or "";
  814.             local callback = callback or function() end;
  815.             local list = options.list or {};
  816.  
  817.             location[flag] = list[1]
  818.             local check = library:Create('Frame', {
  819.                 BackgroundTransparency = 1;
  820.                 Size = UDim2.new(1, 0, 0, 25);
  821.                 BackgroundColor3 = Color3.fromRGB(25, 25, 25);
  822.                 BorderSizePixel = 0;
  823.                 LayoutOrder = self:GetOrder();
  824.                 library:Create('Frame', {
  825.                     Name = 'dropdown_lbl';
  826.                     BackgroundTransparency = 0;
  827.                     BackgroundColor3 = library.options.dropcolor;
  828.                     Position = UDim2.new(0, 5, 0, 4);
  829.                     BorderColor3 = library.options.bordercolor;
  830.                     Size     = UDim2.new(1, -10, 0, 20);
  831.                     library:Create('TextLabel', {
  832.                         Name = 'Selection';
  833.                         Size = UDim2.new(1, 0, 1, 0);
  834.                         Text = list[1];
  835.                         TextColor3 = library.options.textcolor;
  836.                         BackgroundTransparency = 1;
  837.                         Font = library.options.font;
  838.                         TextSize = library.options.fontsize;
  839.                         TextStrokeTransparency = library.options.textstroke;
  840.                         TextStrokeColor3 = library.options.strokecolor;
  841.                     });
  842.                     library:Create("TextButton", {
  843.                         Name = 'drop';
  844.                         BackgroundTransparency = 1;
  845.                         Size = UDim2.new(0, 20, 1, 0);
  846.                         Position = UDim2.new(1, -25, 0, 0);
  847.                         Text = 'v';
  848.                         TextColor3 = library.options.textcolor;
  849.                         Font = library.options.font;
  850.                         TextSize = library.options.fontsize;
  851.                         TextStrokeTransparency = library.options.textstroke;
  852.                         TextStrokeColor3 = library.options.strokecolor;
  853.                     })
  854.                 });
  855.                 Parent = self.container;
  856.             });
  857.            
  858.             local button = check:FindFirstChild('dropdown_lbl').drop;
  859.             local input;
  860.            
  861.             button.MouseButton1Click:connect(function()
  862.                 if (input and input.Connected) then
  863.                     return
  864.                 end
  865.                
  866.                 check:FindFirstChild('dropdown_lbl'):WaitForChild('Selection').TextColor3 = Color3.fromRGB(60, 60, 60);
  867.                 check:FindFirstChild('dropdown_lbl'):WaitForChild('Selection').Text = name;
  868.                 local c = 0;
  869.                 for i, v in next, list do
  870.                     c = c + 20;
  871.                 end
  872.  
  873.                 local size = UDim2.new(1, 0, 0, c)
  874.  
  875.                 local clampedSize;
  876.                 local scrollSize = 0;
  877.                 if size.Y.Offset > 100 then
  878.                     clampedSize = UDim2.new(1, 0, 0, 100)
  879.                     scrollSize = 5;
  880.                 end
  881.                
  882.                 local goSize = (clampedSize ~= nil and clampedSize) or size;    
  883.                 local container = library:Create('ScrollingFrame', {
  884.                     TopImage = 'rbxasset://textures/ui/Scroll/scroll-middle.png';
  885.                     BottomImage = 'rbxasset://textures/ui/Scroll/scroll-middle.png';
  886.                     Name = 'DropContainer';
  887.                     Parent = check:FindFirstChild('dropdown_lbl');
  888.                     Size = UDim2.new(1, 0, 0, 0);
  889.                     BackgroundColor3 = library.options.bgcolor;
  890.                     BorderColor3 = library.options.bordercolor;
  891.                     Position = UDim2.new(0, 0, 1, 0);
  892.                     ScrollBarThickness = scrollSize;
  893.                     CanvasSize = UDim2.new(0, 0, 0, size.Y.Offset);
  894.                     ZIndex = 5;
  895.                     ClipsDescendants = true;
  896.                     library:Create('UIListLayout', {
  897.                         Name = 'List';
  898.                         SortOrder = Enum.SortOrder.LayoutOrder
  899.                     })
  900.                 })
  901.  
  902.                 for i, v in next, list do
  903.                     local btn = library:Create('TextButton', {
  904.                         Size = UDim2.new(1, 0, 0, 20);
  905.                         BackgroundColor3 = library.options.btncolor;
  906.                         BorderColor3 = library.options.bordercolor;
  907.                         Text = v;
  908.                         Font = library.options.font;
  909.                         TextSize = library.options.fontsize;
  910.                         LayoutOrder = i;
  911.                         Parent = container;
  912.                         ZIndex = 5;
  913.                         TextColor3 = library.options.textcolor;
  914.                         TextStrokeTransparency = library.options.textstroke;
  915.                         TextStrokeColor3 = library.options.strokecolor;
  916.                     })
  917.                    
  918.                     btn.MouseButton1Click:connect(function()
  919.                         check:FindFirstChild('dropdown_lbl'):WaitForChild('Selection').TextColor3 = library.options.textcolor
  920.                         check:FindFirstChild('dropdown_lbl'):WaitForChild('Selection').Text = btn.Text;
  921.  
  922.                         location[flag] = tostring(btn.Text);
  923.                         callback(location[flag])
  924.  
  925.                         game:GetService('Debris'):AddItem(container, 0)
  926.                         input:disconnect();
  927.                     end)
  928.                 end
  929.                
  930.                 container:TweenSize(goSize, 'Out', 'Quad', 0.15, true)
  931.                
  932.                 local function isInGui(frame)
  933.                     local mloc = game:GetService('UserInputService'):GetMouseLocation();
  934.                     local mouse = Vector2.new(mloc.X, mloc.Y - 36);
  935.                    
  936.                     local x1, x2 = frame.AbsolutePosition.X, frame.AbsolutePosition.X + frame.AbsoluteSize.X;
  937.                     local y1, y2 = frame.AbsolutePosition.Y, frame.AbsolutePosition.Y + frame.AbsoluteSize.Y;
  938.                
  939.                     return (mouse.X >= x1 and mouse.X <= x2) and (mouse.Y >= y1 and mouse.Y <= y2)
  940.                 end
  941.                
  942.                 input = game:GetService('UserInputService').InputBegan:connect(function(a)
  943.                     if a.UserInputType == Enum.UserInputType.MouseButton1 and (not isInGui(container)) then
  944.                         check:FindFirstChild('dropdown_lbl'):WaitForChild('Selection').TextColor3 = library.options.textcolor
  945.                         check:FindFirstChild('dropdown_lbl'):WaitForChild('Selection').Text       = location[flag];
  946.  
  947.                         container:TweenSize(UDim2.new(1, 0, 0, 0), 'In', 'Quad', 0.15, true)
  948.                         wait(0.15)
  949.  
  950.                         game:GetService('Debris'):AddItem(container, 0)
  951.                         input:disconnect();
  952.                     end
  953.                 end)
  954.             end)
  955.            
  956.             self:Resize();
  957.             local function reload(self, array)
  958.                 options = array;
  959.                 location[flag] = array[1];
  960.                 pcall(function()
  961.                     input:disconnect()
  962.                 end)
  963.                 check:WaitForChild('dropdown_lbl').Selection.Text = location[flag]
  964.                 check:FindFirstChild('dropdown_lbl'):WaitForChild('Selection').TextColor3 = library.options.textcolor
  965.                 game:GetService('Debris'):AddItem(container, 0)
  966.             end
  967.  
  968.             return {
  969.                 Refresh = reload;
  970.             }
  971.         end
  972.     end
  973.    
  974.     function library:Create(class, data)
  975.         local obj = Instance.new(class);
  976.         for i, v in next, data do
  977.             if i ~= 'Parent' then
  978.                
  979.                 if typeof(v) == "Instance" then
  980.                     v.Parent = obj;
  981.                 else
  982.                     obj[i] = v
  983.                 end
  984.             end
  985.         end
  986.        
  987.         obj.Parent = data.Parent;
  988.         return obj
  989.     end
  990.    
  991.     function library:CreateWindow(name, options)
  992.         if (not library.container) then
  993.             library.container = self:Create("ScreenGui", {
  994.                 self:Create('Frame', {
  995.                     Name = 'Container';
  996.                     Size = UDim2.new(1, -30, 1, 0);
  997.                     Position = UDim2.new(0, 20, 0, 20);
  998.                     BackgroundTransparency = 1;
  999.                     Active = false;
  1000.                 });
  1001.                 Parent = game:GetService("CoreGui");
  1002.             }):FindFirstChild('Container');
  1003.         end
  1004.        
  1005.         if (not library.options) then
  1006.             library.options = setmetatable(options or {}, {__index = defaults})
  1007.         end
  1008.        
  1009.         local window = types.window(name, library.options);
  1010.         dragger.new(window.object);
  1011.         return window
  1012.     end
  1013.    
  1014.     default = {
  1015.         topcolor       = Color3.fromRGB(30, 30, 30);
  1016.         titlecolor     = Color3.fromRGB(255, 255, 255);
  1017.        
  1018.         underlinecolor = Color3.fromRGB(0, 255, 140);
  1019.         bgcolor        = Color3.fromRGB(35, 35, 35);
  1020.         boxcolor       = Color3.fromRGB(35, 35, 35);
  1021.         btncolor       = Color3.fromRGB(25, 25, 25);
  1022.         dropcolor      = Color3.fromRGB(25, 25, 25);
  1023.         sectncolor     = Color3.fromRGB(25, 25, 25);
  1024.         bordercolor    = Color3.fromRGB(60, 60, 60);
  1025.  
  1026.         font           = Enum.Font.SourceSans;
  1027.         titlefont      = Enum.Font.Code;
  1028.  
  1029.         fontsize       = 17;
  1030.         titlesize      = 18;
  1031.  
  1032.         textstroke     = 1;
  1033.         titlestroke    = 1;
  1034.  
  1035.         strokecolor    = Color3.fromRGB(0, 0, 0);
  1036.  
  1037.         textcolor      = Color3.fromRGB(255, 255, 255);
  1038.         titletextcolor = Color3.fromRGB(255, 255, 255);
  1039.  
  1040.         placeholdercolor = Color3.fromRGB(255, 255, 255);
  1041.         titlestrokecolor = Color3.fromRGB(0, 0, 0);
  1042.     }
  1043.  
  1044.     library.options = setmetatable({}, {__index = default})
  1045.  
  1046.     spawn(function()
  1047.         while true do
  1048.             for i=0, 1, 1 / 300 do              
  1049.                 for _, obj in next, library.rainbowtable do
  1050.                     obj.BackgroundColor3 = Color3.fromHSV(i, 1, 1);
  1051.                 end
  1052.                 wait()
  1053.             end;
  1054.         end
  1055.     end)
  1056.  
  1057.     local function isreallypressed(bind, inp)
  1058.         local key = bind
  1059.         if typeof(key) == "Instance" then
  1060.             if key.UserInputType == Enum.UserInputType.Keyboard and inp.KeyCode == key.KeyCode then
  1061.                 return true;
  1062.             elseif tostring(key.UserInputType):find('MouseButton') and inp.UserInputType == key.UserInputType then
  1063.                 return true
  1064.             end
  1065.         end
  1066.         if tostring(key):find'MouseButton1' then
  1067.             return key == inp.UserInputType
  1068.         else
  1069.             return key == inp.KeyCode
  1070.         end
  1071.     end
  1072.  
  1073.     game:GetService("UserInputService").InputBegan:connect(function(input)
  1074.         if (not library.binding) then
  1075.             for idx, binds in next, library.binds do
  1076.                 local real_binding = binds.location[idx];
  1077.                 if real_binding and isreallypressed(real_binding, input) then
  1078.                     binds.callback()
  1079.                 end
  1080.             end
  1081.         end
  1082.     end)
  1083. end
  1084.  
  1085. return library
Add Comment
Please, Sign In to add comment