IvesAwadi

Untitled

Jul 25th, 2020
1,388
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 47.52 KB | None | 0 0
  1. local library = {count = 0, queue = {}, callbacks = {}, rainbowtable = {}, toggled = true, binds = {}};
  2. local credits = {"IvesAwadi#0418","https://discord.gg/FEBN9AW"}
  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.         function types:Section(name)
  493.             local order = self:GetOrder();
  494.             local determinedSize = UDim2.new(1, 0, 0, 25)
  495.             local determinedPos = UDim2.new(0, 0, 0, 4);
  496.             local secondarySize = UDim2.new(1, 0, 0, 20);
  497.                        
  498.             if order == 0 then
  499.                 determinedSize = UDim2.new(1, 0, 0, 21)
  500.                 determinedPos = UDim2.new(0, 0, 0, -1);
  501.                 secondarySize = nil
  502.             end
  503.            
  504.             local check = library:Create('Frame', {
  505.                 Name = 'Section';
  506.                 BackgroundTransparency = 1;
  507.                 Size = determinedSize;
  508.                 BackgroundColor3 = library.options.sectncolor;
  509.                 BorderSizePixel = 0;
  510.                 LayoutOrder = order;
  511.                 library:Create('TextLabel', {
  512.                     Name = 'section_lbl';
  513.                     Text = name;
  514.                     BackgroundTransparency = 0;
  515.                     BorderSizePixel = 0;
  516.                     BackgroundColor3 = library.options.sectncolor;
  517.                     TextColor3 = library.options.textcolor;
  518.                     Position = determinedPos;
  519.                     Size     = (secondarySize or UDim2.new(1, 0, 1, 0));
  520.                     Font = library.options.font;
  521.                     TextSize = library.options.fontsize;
  522.                     TextStrokeTransparency = library.options.textstroke;
  523.                     TextStrokeColor3 = library.options.strokecolor;
  524.                 });
  525.                 Parent = self.container;
  526.             });
  527.        
  528.             self:Resize();
  529.         end
  530.         function types:Credits()
  531.             for i,d in pairs(credits) do
  532.                 self:Section(d)
  533.             end
  534.         end
  535.         function types:Slider(name, options, callback)
  536.             local default = options.default or options.min;
  537.             local min     = options.min or 0;
  538.             local max      = options.max or 1;
  539.             local location = options.location or self.flags;
  540.             local precise  = options.precise  or false -- e.g 0, 1 vs 0, 0.1, 0.2, ...
  541.             local flag     = options.flag or "";
  542.             local callback = callback or function() end
  543.  
  544.             location[flag] = default;
  545.  
  546.             local check = library:Create('Frame', {
  547.                 BackgroundTransparency = 1;
  548.                 Size = UDim2.new(1, 0, 0, 25);
  549.                 LayoutOrder = self:GetOrder();
  550.                 library:Create('TextLabel', {
  551.                     Name = name;
  552.                     TextStrokeTransparency = library.options.textstroke;
  553.                     TextStrokeColor3 = library.options.strokecolor;
  554.                     Text = "\r" .. name;
  555.                     BackgroundTransparency = 1;
  556.                     TextColor3 = library.options.textcolor;
  557.                     Position = UDim2.new(0, 5, 0, 2);
  558.                     Size     = UDim2.new(1, -5, 1, 0);
  559.                     TextXAlignment = Enum.TextXAlignment.Left;
  560.                     Font = library.options.font;
  561.                     TextSize = library.options.fontsize;
  562.                     library:Create('Frame', {
  563.                         Name = 'Container';
  564.                         Size = UDim2.new(0, 60, 0, 20);
  565.                         Position = UDim2.new(1, -65, 0, 3);
  566.                         BackgroundTransparency = 1;
  567.                         --BorderColor3 = library.options.bordercolor;
  568.                         BorderSizePixel = 0;
  569.                         library:Create('TextLabel', {
  570.                             Name = 'ValueLabel';
  571.                             Text = default;
  572.                             BackgroundTransparency = 1;
  573.                             TextColor3 = library.options.textcolor;
  574.                             Position = UDim2.new(0, -10, 0, 0);
  575.                             Size     = UDim2.new(0, 1, 1, 0);
  576.                             TextXAlignment = Enum.TextXAlignment.Right;
  577.                             Font = library.options.font;
  578.                             TextSize = library.options.fontsize;
  579.                             TextStrokeTransparency = library.options.textstroke;
  580.                             TextStrokeColor3 = library.options.strokecolor;
  581.                         });
  582.                         library:Create('TextButton', {
  583.                             Name = 'Button';
  584.                             Size = UDim2.new(0, 5, 1, -2);
  585.                             Position = UDim2.new(0, 0, 0, 1);
  586.                             AutoButtonColor = false;
  587.                             Text = "";
  588.                             BackgroundColor3 = Color3.fromRGB(20, 20, 20);
  589.                             BorderSizePixel = 0;
  590.                             ZIndex = 2;
  591.                             TextStrokeTransparency = library.options.textstroke;
  592.                             TextStrokeColor3 = library.options.strokecolor;
  593.                         });
  594.                         library:Create('Frame', {
  595.                             Name = 'Line';
  596.                             BackgroundTransparency = 0;
  597.                             Position = UDim2.new(0, 0, 0.5, 0);
  598.                             Size     = UDim2.new(1, 0, 0, 1);
  599.                             BackgroundColor3 = Color3.fromRGB(255, 255, 255);
  600.                             BorderSizePixel = 0;
  601.                         });
  602.                     })
  603.                 });
  604.                 Parent = self.container;
  605.             });
  606.  
  607.             local overlay = check:FindFirstChild(name);
  608.  
  609.             local renderSteppedConnection;
  610.             local inputBeganConnection;
  611.             local inputEndedConnection;
  612.             local mouseLeaveConnection;
  613.             local mouseDownConnection;
  614.             local mouseUpConnection;
  615.  
  616.             check:FindFirstChild(name).Container.MouseEnter:connect(function()
  617.                 local function update()
  618.                     if renderSteppedConnection then renderSteppedConnection:disconnect() end
  619.                    
  620.  
  621.                     renderSteppedConnection = game:GetService('RunService').RenderStepped:connect(function()
  622.                         local mouse = game:GetService("UserInputService"):GetMouseLocation()
  623.                         local percent = (mouse.X - overlay.Container.AbsolutePosition.X) / (overlay.Container.AbsoluteSize.X)
  624.                         percent = math.clamp(percent, 0, 1)
  625.                         percent = tonumber(string.format("%.2f", percent))
  626.  
  627.                         overlay.Container.Button.Position = UDim2.new(math.clamp(percent, 0, 0.99), 0, 0, 1)
  628.                        
  629.                         local num = min + (max - min) * percent
  630.                         local value = (precise and num or math.floor(num))
  631.  
  632.                         overlay.Container.ValueLabel.Text = value;
  633.                         callback(tonumber(value))
  634.                         location[flag] = tonumber(value)
  635.                     end)
  636.                 end
  637.  
  638.                 local function disconnect()
  639.                     if renderSteppedConnection then renderSteppedConnection:disconnect() end
  640.                     if inputBeganConnection then inputBeganConnection:disconnect() end
  641.                     if inputEndedConnection then inputEndedConnection:disconnect() end
  642.                     if mouseLeaveConnection then mouseLeaveConnection:disconnect() end
  643.                     if mouseUpConnection then mouseUpConnection:disconnect() end
  644.                 end
  645.  
  646.                 inputBeganConnection = check:FindFirstChild(name).Container.InputBegan:connect(function(input)
  647.                     if input.UserInputType == Enum.UserInputType.MouseButton1 then
  648.                         update()
  649.                     end
  650.                 end)
  651.  
  652.                 inputEndedConnection = check:FindFirstChild(name).Container.InputEnded:connect(function(input)
  653.                     if input.UserInputType == Enum.UserInputType.MouseButton1 then
  654.                         disconnect()
  655.                     end
  656.                 end)
  657.  
  658.                 mouseDownConnection = check:FindFirstChild(name).Container.Button.MouseButton1Down:connect(update)
  659.                 mouseUpConnection   = game:GetService("UserInputService").InputEnded:connect(function(a, b)
  660.                     if a.UserInputType == Enum.UserInputType.MouseButton1 and (mouseDownConnection.Connected) then
  661.                         disconnect()
  662.                     end
  663.                 end)
  664.             end)    
  665.  
  666.             if default ~= min then
  667.                 local percent = 1 - ((max - default) / (max - min))
  668.                 local number  = default
  669.  
  670.                 number = tonumber(string.format("%.2f", number))
  671.                 if (not precise) then
  672.                     number = math.floor(number)
  673.                 end
  674.  
  675.                 overlay.Container.Button.Position  = UDim2.new(math.clamp(percent, 0, 0.99), 0,  0, 1)
  676.                 overlay.Container.ValueLabel.Text  = number
  677.             end
  678.  
  679.             self:Resize();
  680.             return {
  681.                 Set = function(self, value)
  682.                     local percent = 1 - ((max - value) / (max - min))
  683.                     local number  = value
  684.  
  685.                     number = tonumber(string.format("%.2f", number))
  686.                     if (not precise) then
  687.                         number = math.floor(number)
  688.                     end
  689.  
  690.                     overlay.Container.Button.Position  = UDim2.new(math.clamp(percent, 0, 0.99), 0,  0, 1)
  691.                     overlay.Container.ValueLabel.Text  = number
  692.                     location[flag] = number
  693.                     callback(number)
  694.                 end
  695.             }
  696.         end
  697.  
  698.         function types:SearchBox(text, options, callback)
  699.             local list = options.list or {};
  700.             local flag = options.flag or "";
  701.             local location = options.location or self.flags;
  702.             local callback = callback or function() end;
  703.  
  704.             local busy = false;
  705.             local box = library:Create('Frame', {
  706.                 BackgroundTransparency = 1;
  707.                 Size = UDim2.new(1, 0, 0, 25);
  708.                 LayoutOrder = self:GetOrder();
  709.                 library:Create('TextBox', {
  710.                     Text = "";
  711.                     PlaceholderText = text;
  712.                     PlaceholderColor3 = Color3.fromRGB(60, 60, 60);
  713.                     Font = library.options.font;
  714.                     TextSize = library.options.fontsize;
  715.                     Name = 'Box';
  716.                     Size = UDim2.new(1, -10, 0, 20);
  717.                     Position = UDim2.new(0, 5, 0, 4);
  718.                     TextColor3 = library.options.textcolor;
  719.                     BackgroundColor3 = library.options.dropcolor;
  720.                     BorderColor3 = library.options.bordercolor;
  721.                     TextStrokeTransparency = library.options.textstroke;
  722.                     TextStrokeColor3 = library.options.strokecolor;
  723.                     library:Create('ScrollingFrame', {
  724.                         Position = UDim2.new(0, 0, 1, 1);
  725.                         Name = 'Container';
  726.                         BackgroundColor3 = library.options.btncolor;
  727.                         ScrollBarThickness = 0;
  728.                         BorderSizePixel = 0;
  729.                         BorderColor3 = library.options.bordercolor;
  730.                         Size = UDim2.new(1, 0, 0, 0);
  731.                         library:Create('UIListLayout', {
  732.                             Name = 'ListLayout';
  733.                             SortOrder = Enum.SortOrder.LayoutOrder;
  734.                         });
  735.                         ZIndex = 2;
  736.                     });
  737.                 });
  738.                 Parent = self.container;
  739.             })
  740.  
  741.             local function rebuild(text)
  742.                 box:FindFirstChild('Box').Container.ScrollBarThickness = 0
  743.                 for i, child in next, box:FindFirstChild('Box').Container:GetChildren() do
  744.                     if (not child:IsA('UIListLayout')) then
  745.                         child:Destroy();
  746.                     end
  747.                 end
  748.  
  749.                 if #text > 0 then
  750.                     for i, v in next, list do
  751.                         if string.sub(string.lower(v), 1, string.len(text)) == string.lower(text) then
  752.                             local button = library:Create('TextButton', {
  753.                                 Text = v;
  754.                                 Font = library.options.font;
  755.                                 TextSize = library.options.fontsize;
  756.                                 TextColor3 = library.options.textcolor;
  757.                                 BorderColor3 = library.options.bordercolor;
  758.                                 TextStrokeTransparency = library.options.textstroke;
  759.                                 TextStrokeColor3 = library.options.strokecolor;
  760.                                 Parent = box:FindFirstChild('Box').Container;
  761.                                 Size = UDim2.new(1, 0, 0, 20);
  762.                                 LayoutOrder = i;
  763.                                 BackgroundColor3 = library.options.btncolor;
  764.                                 ZIndex = 2;
  765.                             })
  766.  
  767.                             button.MouseButton1Click:connect(function()
  768.                                 busy = true;
  769.                                 box:FindFirstChild('Box').Text = button.Text;
  770.                                 wait();
  771.                                 busy = false;
  772.  
  773.                                 location[flag] = button.Text;
  774.                                 callback(location[flag])
  775.  
  776.                                 box:FindFirstChild('Box').Container.ScrollBarThickness = 0
  777.                                 for i, child in next, box:FindFirstChild('Box').Container:GetChildren() do
  778.                                     if (not child:IsA('UIListLayout')) then
  779.                                         child:Destroy();
  780.                                     end
  781.                                 end
  782.                                 box:FindFirstChild('Box').Container:TweenSize(UDim2.new(1, 0, 0, 0), 'Out', 'Quad', 0.25, true)
  783.                             end)
  784.                         end
  785.                     end
  786.                 end
  787.  
  788.                 local c = box:FindFirstChild('Box').Container:GetChildren()
  789.                 local ry = (20 * (#c)) - 20
  790.  
  791.                 local y = math.clamp((20 * (#c)) - 20, 0, 100)
  792.                 if ry > 100 then
  793.                     box:FindFirstChild('Box').Container.ScrollBarThickness = 5;
  794.                 end
  795.  
  796.                 box:FindFirstChild('Box').Container:TweenSize(UDim2.new(1, 0, 0, y), 'Out', 'Quad', 0.25, true)
  797.                 box:FindFirstChild('Box').Container.CanvasSize = UDim2.new(1, 0, 0, (20 * (#c)) - 20)
  798.             end
  799.  
  800.             box:FindFirstChild('Box'):GetPropertyChangedSignal('Text'):connect(function()
  801.                 if (not busy) then
  802.                     rebuild(box:FindFirstChild('Box').Text)
  803.                 end
  804.             end);
  805.  
  806.             local function reload(new_list)
  807.                 list = new_list;
  808.                 rebuild("")
  809.             end
  810.             self:Resize();
  811.             return reload, box:FindFirstChild('Box');
  812.         end
  813.        
  814.         function types:Dropdown(name, options, callback)
  815.             local location = options.location or self.flags;
  816.             local flag = options.flag or "";
  817.             local callback = callback or function() end;
  818.             local list = options.list or {};
  819.  
  820.             location[flag] = list[1]
  821.             local check = library:Create('Frame', {
  822.                 BackgroundTransparency = 1;
  823.                 Size = UDim2.new(1, 0, 0, 25);
  824.                 BackgroundColor3 = Color3.fromRGB(25, 25, 25);
  825.                 BorderSizePixel = 0;
  826.                 LayoutOrder = self:GetOrder();
  827.                 library:Create('Frame', {
  828.                     Name = 'dropdown_lbl';
  829.                     BackgroundTransparency = 0;
  830.                     BackgroundColor3 = library.options.dropcolor;
  831.                     Position = UDim2.new(0, 5, 0, 4);
  832.                     BorderColor3 = library.options.bordercolor;
  833.                     Size     = UDim2.new(1, -10, 0, 20);
  834.                     library:Create('TextLabel', {
  835.                         Name = 'Selection';
  836.                         Size = UDim2.new(1, 0, 1, 0);
  837.                         Text = list[1];
  838.                         TextColor3 = library.options.textcolor;
  839.                         BackgroundTransparency = 1;
  840.                         Font = library.options.font;
  841.                         TextSize = library.options.fontsize;
  842.                         TextStrokeTransparency = library.options.textstroke;
  843.                         TextStrokeColor3 = library.options.strokecolor;
  844.                     });
  845.                     library:Create("TextButton", {
  846.                         Name = 'drop';
  847.                         BackgroundTransparency = 1;
  848.                         Size = UDim2.new(0, 20, 1, 0);
  849.                         Position = UDim2.new(1, -25, 0, 0);
  850.                         Text = 'v';
  851.                         TextColor3 = library.options.textcolor;
  852.                         Font = library.options.font;
  853.                         TextSize = library.options.fontsize;
  854.                         TextStrokeTransparency = library.options.textstroke;
  855.                         TextStrokeColor3 = library.options.strokecolor;
  856.                     })
  857.                 });
  858.                 Parent = self.container;
  859.             });
  860.            
  861.             local button = check:FindFirstChild('dropdown_lbl').drop;
  862.             local input;
  863.            
  864.             button.MouseButton1Click:connect(function()
  865.                 if (input and input.Connected) then
  866.                     return
  867.                 end
  868.                
  869.                 check:FindFirstChild('dropdown_lbl'):WaitForChild('Selection').TextColor3 = Color3.fromRGB(60, 60, 60);
  870.                 check:FindFirstChild('dropdown_lbl'):WaitForChild('Selection').Text = name;
  871.                 local c = 0;
  872.                 for i, v in next, list do
  873.                     c = c + 20;
  874.                 end
  875.  
  876.                 local size = UDim2.new(1, 0, 0, c)
  877.  
  878.                 local clampedSize;
  879.                 local scrollSize = 0;
  880.                 if size.Y.Offset > 100 then
  881.                     clampedSize = UDim2.new(1, 0, 0, 100)
  882.                     scrollSize = 5;
  883.                 end
  884.                
  885.                 local goSize = (clampedSize ~= nil and clampedSize) or size;    
  886.                 local container = library:Create('ScrollingFrame', {
  887.                     TopImage = 'rbxasset://textures/ui/Scroll/scroll-middle.png';
  888.                     BottomImage = 'rbxasset://textures/ui/Scroll/scroll-middle.png';
  889.                     Name = 'DropContainer';
  890.                     Parent = check:FindFirstChild('dropdown_lbl');
  891.                     Size = UDim2.new(1, 0, 0, 0);
  892.                     BackgroundColor3 = library.options.bgcolor;
  893.                     BorderColor3 = library.options.bordercolor;
  894.                     Position = UDim2.new(0, 0, 1, 0);
  895.                     ScrollBarThickness = scrollSize;
  896.                     CanvasSize = UDim2.new(0, 0, 0, size.Y.Offset);
  897.                     ZIndex = 5;
  898.                     ClipsDescendants = true;
  899.                     library:Create('UIListLayout', {
  900.                         Name = 'List';
  901.                         SortOrder = Enum.SortOrder.LayoutOrder
  902.                     })
  903.                 })
  904.  
  905.                 for i, v in next, list do
  906.                     local btn = library:Create('TextButton', {
  907.                         Size = UDim2.new(1, 0, 0, 20);
  908.                         BackgroundColor3 = library.options.btncolor;
  909.                         BorderColor3 = library.options.bordercolor;
  910.                         Text = v;
  911.                         Font = library.options.font;
  912.                         TextSize = library.options.fontsize;
  913.                         LayoutOrder = i;
  914.                         Parent = container;
  915.                         ZIndex = 5;
  916.                         TextColor3 = library.options.textcolor;
  917.                         TextStrokeTransparency = library.options.textstroke;
  918.                         TextStrokeColor3 = library.options.strokecolor;
  919.                     })
  920.                    
  921.                     btn.MouseButton1Click:connect(function()
  922.                         check:FindFirstChild('dropdown_lbl'):WaitForChild('Selection').TextColor3 = library.options.textcolor
  923.                         check:FindFirstChild('dropdown_lbl'):WaitForChild('Selection').Text = btn.Text;
  924.  
  925.                         location[flag] = tostring(btn.Text);
  926.                         callback(location[flag])
  927.  
  928.                         game:GetService('Debris'):AddItem(container, 0)
  929.                         input:disconnect();
  930.                     end)
  931.                 end
  932.                
  933.                 container:TweenSize(goSize, 'Out', 'Quad', 0.15, true)
  934.                
  935.                 local function isInGui(frame)
  936.                     local mloc = game:GetService('UserInputService'):GetMouseLocation();
  937.                     local mouse = Vector2.new(mloc.X, mloc.Y - 36);
  938.                    
  939.                     local x1, x2 = frame.AbsolutePosition.X, frame.AbsolutePosition.X + frame.AbsoluteSize.X;
  940.                     local y1, y2 = frame.AbsolutePosition.Y, frame.AbsolutePosition.Y + frame.AbsoluteSize.Y;
  941.                
  942.                     return (mouse.X >= x1 and mouse.X <= x2) and (mouse.Y >= y1 and mouse.Y <= y2)
  943.                 end
  944.                
  945.                 input = game:GetService('UserInputService').InputBegan:connect(function(a)
  946.                     if a.UserInputType == Enum.UserInputType.MouseButton1 and (not isInGui(container)) then
  947.                         check:FindFirstChild('dropdown_lbl'):WaitForChild('Selection').TextColor3 = library.options.textcolor
  948.                         check:FindFirstChild('dropdown_lbl'):WaitForChild('Selection').Text       = location[flag];
  949.  
  950.                         container:TweenSize(UDim2.new(1, 0, 0, 0), 'In', 'Quad', 0.15, true)
  951.                         wait(0.15)
  952.  
  953.                         game:GetService('Debris'):AddItem(container, 0)
  954.                         input:disconnect();
  955.                     end
  956.                 end)
  957.             end)
  958.            
  959.             self:Resize();
  960.             local function reload(self, array)
  961.                 options = array;
  962.                 location[flag] = array[1];
  963.                 pcall(function()
  964.                     input:disconnect()
  965.                 end)
  966.                 check:WaitForChild('dropdown_lbl').Selection.Text = location[flag]
  967.                 check:FindFirstChild('dropdown_lbl'):WaitForChild('Selection').TextColor3 = library.options.textcolor
  968.                 game:GetService('Debris'):AddItem(container, 0)
  969.             end
  970.  
  971.             return {
  972.                 Refresh = reload;
  973.             }
  974.         end
  975.     end
  976.    
  977.     function library:Create(class, data)
  978.         local obj = Instance.new(class);
  979.         for i, v in next, data do
  980.             if i ~= 'Parent' then
  981.                
  982.                 if typeof(v) == "Instance" then
  983.                     v.Parent = obj;
  984.                 else
  985.                     obj[i] = v
  986.                 end
  987.             end
  988.         end
  989.        
  990.         obj.Parent = data.Parent;
  991.         return obj
  992.     end
  993.    
  994.     function library:CreateWindow(name, options)
  995.         if (not library.container) then
  996.             library.container = self:Create("ScreenGui", {
  997.                 self:Create('Frame', {
  998.                     Name = 'Container';
  999.                     Size = UDim2.new(1, -30, 1, 0);
  1000.                     Position = UDim2.new(0, 20, 0, 20);
  1001.                     BackgroundTransparency = 1;
  1002.                     Active = false;
  1003.                 });
  1004.                 Parent = game:GetService("CoreGui");
  1005.             }):FindFirstChild('Container');
  1006.         end
  1007.        
  1008.         if (not library.options) then
  1009.             library.options = setmetatable(options or {}, {__index = defaults})
  1010.         end
  1011.        
  1012.         local window = types.window(name, library.options);
  1013.         dragger.new(window.object);
  1014.         return window
  1015.     end
  1016.    
  1017.     default = {
  1018.         topcolor       = Color3.fromRGB(30, 30, 30);
  1019.         titlecolor     = Color3.fromRGB(255, 255, 255);
  1020.        
  1021.         underlinecolor = Color3.fromRGB(0, 255, 140);
  1022.         bgcolor        = Color3.fromRGB(35, 35, 35);
  1023.         boxcolor       = Color3.fromRGB(35, 35, 35);
  1024.         btncolor       = Color3.fromRGB(25, 25, 25);
  1025.         dropcolor      = Color3.fromRGB(25, 25, 25);
  1026.         sectncolor     = Color3.fromRGB(25, 25, 25);
  1027.         bordercolor    = Color3.fromRGB(60, 60, 60);
  1028.  
  1029.         font           = Enum.Font.SourceSans;
  1030.         titlefont      = Enum.Font.Code;
  1031.  
  1032.         fontsize       = 17;
  1033.         titlesize      = 18;
  1034.  
  1035.         textstroke     = 1;
  1036.         titlestroke    = 1;
  1037.  
  1038.         strokecolor    = Color3.fromRGB(0, 0, 0);
  1039.  
  1040.         textcolor      = Color3.fromRGB(255, 255, 255);
  1041.         titletextcolor = Color3.fromRGB(255, 255, 255);
  1042.  
  1043.         placeholdercolor = Color3.fromRGB(255, 255, 255);
  1044.         titlestrokecolor = Color3.fromRGB(0, 0, 0);
  1045.     }
  1046.  
  1047.     library.options = setmetatable({}, {__index = default})
  1048.  
  1049.     spawn(function()
  1050.         while true do
  1051.             for i=0, 1, 1 / 300 do              
  1052.                 for _, obj in next, library.rainbowtable do
  1053.                     obj.BackgroundColor3 = Color3.fromHSV(i, 1, 1);
  1054.                 end
  1055.                 wait()
  1056.             end;
  1057.         end
  1058.     end)
  1059.  
  1060.     local function isreallypressed(bind, inp)
  1061.         local key = bind
  1062.         if typeof(key) == "Instance" then
  1063.             if key.UserInputType == Enum.UserInputType.Keyboard and inp.KeyCode == key.KeyCode then
  1064.                 return true;
  1065.             elseif tostring(key.UserInputType):find('MouseButton') and inp.UserInputType == key.UserInputType then
  1066.                 return true
  1067.             end
  1068.         end
  1069.         if tostring(key):find'MouseButton1' then
  1070.             return key == inp.UserInputType
  1071.         else
  1072.             return key == inp.KeyCode
  1073.         end
  1074.     end
  1075.  
  1076.     game:GetService("UserInputService").InputBegan:connect(function(input)
  1077.         if (not library.binding) then
  1078.             for idx, binds in next, library.binds do
  1079.                 local real_binding = binds.location[idx];
  1080.                 if real_binding and isreallypressed(real_binding, input) then
  1081.                     binds.callback()
  1082.                 end
  1083.             end
  1084.         end
  1085.     end)
  1086. end
  1087.  
  1088. return library
Advertisement
Add Comment
Please, Sign In to add comment