Advertisement
BEAM21

Ui execute cracked by BEAM21

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