Synthionized

Uidasdwasdf

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