Advertisement
NickCoder

Coleenfinity v1

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