Guest User

Untitled

a guest
Oct 17th, 2020
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 55.33 KB | None | 0 0
  1. -- Forked From wally.
  2. local vers = "0.45" -- https://api.roblox.com/assets/4133667265/versions
  3. local __instructions = [[
  4. Web/Original:https://pastebin.com/raw/q4cGSQZf
  5. class Window [
  6.     Table flags -> default location for values
  7.  
  8.     Method Section(name)
  9.         @name -> text for the Section
  10.  
  11.     Method Label(name)
  12.         @name -> text for the label
  13.        
  14.         return -> [
  15.             Method Set(string) -> sets the label text
  16.             label object (Instance)
  17.         ]
  18.  
  19.     Method Toggle(name, options, callback)
  20.         @name -> text for toggle
  21.         @options -> array
  22.             location (table) -> alternate table to put value in (default = window.flags)
  23.             flag (string) -> index for value (e.g location.farming)
  24.             autoupdate (boolean) -> will set itself depending on flag (default = false)
  25.             updatedelay (number) -> time to wait before checking if the flag has changed. Only works when autoupdate is true (default = 1)
  26.         @callback -> function to call when toggle is changed
  27.  
  28.         return -> [
  29.             Method Set(number) -> sets toggle value
  30.         ]
  31.  
  32.     Method Slider(name, options, callback)
  33.         @name -> text for slider
  34.         @options -> array
  35.             location (table) -> alternate table to put value in (default = window.flags)
  36.             flag (string) -> index for value (e.g location.farming)
  37.             autoupdate (boolean) -> will set itself depending on flag (default = false)
  38.             updatedelay (number) -> time to wait before checking if the flag has changed. Only works when autoupdate is true (default = 1)
  39.             precise (boolean) -> wether to show full number or not -- e.g 0, 1 vs 0, 0.1, 0.2, ...
  40.             default (number) -> default slider value
  41.             min, max (number) -> self explanatory
  42.         @callback(value) -> function to call when slider is changed
  43.    
  44.         return -> [
  45.             Method Set(number) -> sets slider value
  46.         ]
  47.  
  48.     Method Dropdown(name, options, callback)
  49.         @name -> text for dropdown
  50.         @options -> array
  51.             location (table) -> alternate table to put value in (default = window.flags)
  52.             flag (string) -> index for value (e.g location.farming)
  53.             autoupdate (boolean) -> will set itself depending on flag (default = false)
  54.             updatedelay (number) -> time to wait before checking if the flag has changed. Only works when autoupdate is true (default = 1)
  55.             list -> list of objects to display
  56.         @callback(new) -> function to call when dropdown is changed
  57.  
  58.         return -> [
  59.             Method Refresh(array) -> resets dropdown.list and sets value to first value in array
  60.         ]
  61.  
  62.     Method Button(name, callback)
  63.         @name -> text for button
  64.         @callback -> function to call when button is clicked
  65.  
  66.         return -> [
  67.             Method Fire(<void>) -> calls callback
  68.         ]
  69.  
  70.     Method Bind(name, options, callback)
  71.         @name -> text for keybind
  72.         @options -> array
  73.             location (table)  -> alternate table to put value in (default = window.flags)
  74.             flag (string)     -> index for value (e.g location.farming)
  75.             autoupdate (boolean) -> will set itself depending on flag (default = false)
  76.             updatedelay (number) -> time to wait before checking if the flag has changed. Only works when autoupdate is true (default = 1)
  77.             kbonly (bool)     -> keyboard keys only (no mouse)
  78.             default (EnumItem)    -> default key for bind;
  79.  
  80.         @callback(key) -> function to call when bind is changed
  81.  
  82.     Method Box(name, options, callback)
  83.         @name -> text for box
  84.         @options -> array
  85.             location (table)  -> alternate table to put value in (default = window.flags)
  86.             flag     (string) -> index for value (e.g location.farming)
  87.             autoupdate (boolean) -> will set itself depending on flag (default = false)
  88.             updatedelay (number) -> time to wait before checking if the flag has changed. Only works when autoupdate is true (default = 1)
  89.             type (string) -> if type is "number", box will only accept numbers
  90.             min, max   (number) -> used to define constraints when type is numbers only
  91.            
  92.         @callback(box, new, old, enter) -> function to call when box is changed
  93.             box -> box object;
  94.             new -> new value;
  95.             old -> old value;
  96.             enter -> wether enter was pressed
  97.  
  98.         returns -> box object (Instance)
  99.  
  100.     Method SearchBox(name, options, callback)
  101.         @name -> text for searchbox
  102.         @options -> array
  103.             location (table) -> alternate table to put value in (default = window.flags)
  104.             flag (string) -> index for value (e.g location.farming)
  105.             autoupdate (boolean) -> will set itself depending on flag (default = false)
  106.             updatedelay (number) -> time to wait before checking if the flag has changed. Only works when autoupdate is true (default = 1)
  107.             list -> list of objects to search for
  108.         @callback(new) -> function to call when dropdown is changed
  109.  
  110.         return -> [
  111.             Function (array) -> resets dropdown.list and sets value to first value in array
  112.         ]
  113. ]
  114. ]]
  115.  
  116. local utf8 = utf8
  117. if not utf8 or not utf8.char or utf8.char(10003) == utf8.char(8238) then -- bad exploit
  118.     local utf8 = {
  119.         char = function(id)
  120.             return ({
  121.                 [8238] = "\226\128\174", -- Checkmark
  122.                 [9492] = "\226\148\148", -- Pipe (Right)
  123.                 [10003] = "\226\156\147" -- Right to left (unused)
  124.             })[id] or ""
  125.         end
  126.     }
  127. end
  128.  
  129. local library = {
  130.     count = 0,
  131.     version = vers,
  132.     queue = {},
  133.     callbacks = {},
  134.     rainbowtable = {},
  135.     toggled = true,
  136.     binds = {},
  137.     connections = {},
  138.     default_auto_update = false,
  139.     default_update_delay = 4
  140. }
  141. local randomcolor = Color3.fromRGB(tick() % 256, math.random(100000) % 256, (math.random() * 1280) % 256)
  142. local default = {
  143.     topcolor = Color3.fromRGB(30, 30, 30),
  144.     titlecolor = Color3.fromRGB(255, 255, 255),
  145.     underlinecolor = randomcolor or Color3.fromRGB(0, 255, 140),
  146.     bgcolor = Color3.fromRGB(35, 35, 35),
  147.     boxcolor = Color3.fromRGB(35, 35, 35),
  148.     btncolor = Color3.fromRGB(25, 25, 25),
  149.     dropcolor = Color3.fromRGB(25, 25, 25),
  150.     sectncolor = Color3.fromRGB(25, 25, 25),
  151.     bordercolor = Color3.fromRGB(60, 60, 60),
  152.     font = Enum.Font.SourceSans,
  153.     titlefont = Enum.Font.Code,
  154.     fontsize = 17,
  155.     titlesize = 18,
  156.     textstroke = 1,
  157.     titlestroke = 1,
  158.     strokecolor = Color3.fromRGB(0, 0, 0),
  159.     textcolor = Color3.fromRGB(255, 255, 255),
  160.     titletextcolor = Color3.fromRGB(255, 255, 255),
  161.     placeholdercolor = Color3.fromRGB(255, 255, 255),
  162.     titlestrokecolor = Color3.fromRGB(0, 0, 0)
  163. }
  164. local dragger = {}
  165. local mouse = game:GetService("Players").LocalPlayer:GetMouse()
  166. local inputService = game:GetService("UserInputService")
  167. local heartbeat = game:GetService("RunService").Heartbeat
  168. function dragger.new(frame)
  169.     local s, event = pcall(function()
  170.         return frame.MouseEnter
  171.     end)
  172.     if s then
  173.         frame.Active = true
  174.         table.insert(library.connections, event:Connect(function()
  175.             local input = frame.InputBegan:Connect(function(key)
  176.                 if key.UserInputType == Enum.UserInputType.MouseButton1 then
  177.                     local objectPosition = Vector2.new(mouse.X - frame.AbsolutePosition.X, mouse.Y - frame.AbsolutePosition.Y)
  178.                     while heartbeat:wait() and inputService:IsMouseButtonPressed(Enum.UserInputType.MouseButton1) do
  179.                         pcall(function()
  180.                             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)
  181.                         end)
  182.                     end
  183.                 end
  184.             end)
  185.             table.insert(library.connections, input)
  186.             local leave
  187.             leave = frame.MouseLeave:Connect(function()
  188.                 input:Disconnect()
  189.                 leave:Disconnect()
  190.             end)
  191.             table.insert(library.connections, leave)
  192.         end))
  193.     end
  194. end
  195. library.connections.hide = game:GetService("UserInputService").InputBegan:Connect(function(key, gpe)
  196.     if (not gpe) then
  197.         if key.KeyCode == Enum.KeyCode.RightControl then
  198.             library.toggled = not library.toggled
  199.             for i, data in next, library.queue do
  200.                 pcall(function()
  201.                     local pos = (library.toggled and data.p or UDim2.new(-1, 0, -0.5, 0))
  202.                     data.w:TweenPosition(pos, (library.toggled and "Out" or "In"), "Quad", 0.15, true)
  203.                 end)
  204.                 wait()
  205.             end
  206.         end
  207.     end
  208. end)
  209. local types = {}
  210. types.__index = types
  211. function types.window(name, options)
  212.     options = options or {}
  213.     library.count = library.count + 1
  214.     local newWindow = library:Create("Frame", {
  215.         Name = name,
  216.         Size = UDim2.new(0, 190, 0, 30),
  217.         BackgroundColor3 = options.topcolor,
  218.         BorderSizePixel = 0,
  219.         Parent = library.container,
  220.         Position = UDim2.new(0, (15 + (200 * library.count) - 200), 0, 0),
  221.         ZIndex = 3,
  222.         library:Create("TextLabel", {
  223.             Text = name,
  224.             Size = UDim2.new(1, -10, 1, 0),
  225.             Position = UDim2.new(0, 5, 0, 0),
  226.             BackgroundTransparency = 1,
  227.             Font = Enum.Font.Code,
  228.             TextSize = options.titlesize,
  229.             Font = options.titlefont,
  230.             TextColor3 = options.titletextcolor,
  231.             TextStrokeTransparency = library.options.titlestroke,
  232.             TextStrokeColor3 = library.options.titlestrokecolor,
  233.             ZIndex = 3
  234.         }),
  235.         library:Create("TextButton", {
  236.             Size = UDim2.new(0, 30, 0, 30),
  237.             Position = UDim2.new(1, -35, 0, 0),
  238.             BackgroundTransparency = 1,
  239.             Text = "-",
  240.             TextSize = options.titlesize,
  241.             Font = options.titlefont,
  242.             Name = 'window_toggle',
  243.             TextColor3 = options.titletextcolor,
  244.             TextStrokeTransparency = library.options.titlestroke,
  245.             TextStrokeColor3 = library.options.titlestrokecolor,
  246.             ZIndex = 3
  247.         }),
  248.         library:Create("Frame", {
  249.             Name = "Underline",
  250.             Size = UDim2.new(1, 0, 0, 2),
  251.             Position = UDim2.new(0, 0, 1, -2),
  252.             BackgroundColor3 = (options.underlinecolor ~= "rainbow" and options.underlinecolor) or Color3.new(),
  253.             BorderSizePixel = 0,
  254.             ZIndex = 3
  255.         }),
  256.         library:Create("Frame", {
  257.             Name = 'container',
  258.             Position = UDim2.new(0, 0, 1, 0),
  259.             Size = UDim2.new(1, 0, 0, 0),
  260.             BorderSizePixel = 0,
  261.             BackgroundColor3 = options.bgcolor,
  262.             ClipsDescendants = false,
  263.             library:Create("UIListLayout", {
  264.                 Name = 'List',
  265.                 SortOrder = Enum.SortOrder.LayoutOrder
  266.             })
  267.         })
  268.     })
  269.     if options.underlinecolor == "rainbow" then
  270.         table.insert(library.rainbowtable, newWindow:FindFirstChild("Underline"))
  271.     end
  272.     local window = setmetatable({
  273.         count = 0,
  274.         object = newWindow,
  275.         container = newWindow.container,
  276.         toggled = true,
  277.         flags = {}
  278.     }, types)
  279.     table.insert(library.queue, {
  280.         w = window.object,
  281.         p = window.object.Position
  282.     })
  283.     table.insert(library.connections, newWindow:FindFirstChild("window_toggle").MouseButton1Click:Connect(function()
  284.         window.toggled = not window.toggled
  285.         newWindow:FindFirstChild("window_toggle").Text = (window.toggled and "-" or "+")
  286.         if (not window.toggled) then
  287.             window.container.ClipsDescendants = true
  288.         end
  289.         wait()
  290.         local y = 0
  291.         for i, v in next, window.container:GetChildren() do
  292.             if (not v:IsA("UIListLayout")) then
  293.                 y = y + v.AbsoluteSize.Y
  294.             end
  295.         end
  296.         local targetSize = window.toggled and UDim2.new(1, 0, 0, y + 5) or UDim2.new(1, 0, 0, 0)
  297.         local targetDirection = window.toggled and "In" or "Out"
  298.         window.container:TweenSize(targetSize, targetDirection, "Quad", 0.15, true)
  299.         wait(.15)
  300.         if window.toggled then
  301.             window.container.ClipsDescendants = false
  302.         end
  303.     end))
  304.     return window
  305. end
  306. function types:Resize()
  307.     local y = 0
  308.     for i, v in next, self.container:GetChildren() do
  309.         if (not v:IsA("UIListLayout")) then
  310.             y = y + v.AbsoluteSize.Y
  311.         end
  312.     end
  313.     self.container.Size = UDim2.new(1, 0, 0, y + 5)
  314. end
  315. function types:GetOrder()
  316.     local c = 0
  317.     for i, v in next, self.container:GetChildren() do
  318.         if (not v:IsA("UIListLayout")) then
  319.             c = c + 1
  320.         end
  321.     end
  322.     return c
  323. end
  324. function types:Label(name)
  325.     local order = self:GetOrder()
  326.     local determinedSize = UDim2.new(1, 0, 0, 25)
  327.     local determinedPos = UDim2.new(0, 0, 0, 4)
  328.     local secondarySize = UDim2.new(1, 0, 0, 20)
  329.     if order == 0 then
  330.         determinedSize = UDim2.new(1, 0, 0, 21)
  331.         determinedPos = UDim2.new(0, 0, 0, -1)
  332.         secondarySize = nil
  333.     end
  334.     local check = library:Create("Frame", {
  335.         Name = 'Label',
  336.         BackgroundTransparency = 1,
  337.         Size = determinedSize,
  338.         BackgroundColor3 = library.options.sectncolor,
  339.         BorderSizePixel = 0,
  340.         LayoutOrder = order,
  341.         library:Create("TextLabel", {
  342.             Name = "label_lbl",
  343.             Text = name,
  344.             BackgroundTransparency = 0,
  345.             BorderSizePixel = 0,
  346.             BackgroundColor3 = library.options.sectncolor,
  347.             TextColor3 = library.options.textcolor,
  348.             Position = determinedPos,
  349.             Size = (secondarySize or UDim2.new(1, 0, 1, 0)),
  350.             Font = library.options.font,
  351.             TextSize = library.options.fontsize,
  352.             TextStrokeTransparency = library.options.textstroke,
  353.             TextStrokeColor3 = library.options.strokecolor
  354.         }),
  355.         Parent = self.container
  356.     })
  357.     self:Resize()
  358.     local label = check:FindFirstChild("label_lbl")
  359.     return {
  360.         Set = function(str)
  361.             label.Text = str
  362.             return label
  363.         end,
  364.         label
  365.     }
  366. end
  367. function types:Toggle(name, options, callback)
  368.     local _default = options.default or false
  369.     local location = options.location or self.flags
  370.     local flag = options.flag or tostring(name)
  371.     local callback = callback or function()
  372.     end
  373.     location[flag] = location[flag] or _default
  374.     local check = library:Create("Frame", {
  375.         BackgroundTransparency = 1,
  376.         Size = UDim2.new(1, 0, 0, 25),
  377.         LayoutOrder = self:GetOrder(),
  378.         library:Create("TextLabel", {
  379.             Name = name,
  380.             Text = "\r" .. name,
  381.             BackgroundTransparency = 1,
  382.             TextColor3 = library.options.textcolor,
  383.             Position = UDim2.new(0, 5, 0, 0),
  384.             Size = UDim2.new(1, -5, 1, 0),
  385.             TextXAlignment = Enum.TextXAlignment.Left,
  386.             Font = library.options.font,
  387.             TextSize = library.options.fontsize,
  388.             TextStrokeTransparency = library.options.textstroke,
  389.             TextStrokeColor3 = library.options.strokecolor,
  390.             library:Create("TextButton", {
  391.                 Text = (location[flag] and utf8.char(10003) or ""),
  392.                 Font = library.options.font,
  393.                 TextSize = library.options.fontsize,
  394.                 Name = 'Checkmark',
  395.                 Size = UDim2.new(0, 20, 0, 20),
  396.                 Position = UDim2.new(1, -25, 0, 4),
  397.                 TextColor3 = library.options.textcolor,
  398.                 BackgroundColor3 = library.options.bgcolor,
  399.                 BorderColor3 = library.options.bordercolor,
  400.                 TextStrokeTransparency = library.options.textstroke,
  401.                 TextStrokeColor3 = library.options.strokecolor
  402.             })
  403.         }),
  404.         Parent = self.container
  405.     })
  406.     local function click(t)
  407.         if type(location[flag]) ~= "boolean" then
  408.             location[flag] = (type(location[flag]) ~= "nil")
  409.         end
  410.         location[flag] = check:FindFirstChild(name).Checkmark.Text ~= utf8.char(10003)
  411.         check:FindFirstChild(name).Checkmark.Text = location[flag] and utf8.char(10003) or ""
  412.         callback(location[flag])
  413.     end
  414.     table.insert(library.connections, check:FindFirstChild(name).Checkmark.MouseButton1Click:Connect(click))
  415.     library.callbacks[flag] = click
  416.     if location[flag] == true then
  417.         callback(true)
  418.     end
  419.     self:Resize()
  420.     return {
  421.         Set = function(self, b)
  422.             location[flag] = b
  423.             callback(location[flag])
  424.             check:FindFirstChild(name).Checkmark.Text = location[flag] and utf8.char(10003) or ""
  425.         end,
  426.         spawn(function()
  427.             if nil == options.autoupdate then
  428.                 options.autoupdate = library.default_auto_update
  429.             end
  430.             if nil == options.updatedelay then
  431.                 options.updatedelay = library.default_update_delay
  432.             end
  433.             if type(options.autoupdate) == "number" then
  434.                 options.autoupdate, options.updatedelay = true, options.autoupdate
  435.             end
  436.             local last = location[flag]
  437.             while (options.autoupdate and not library.toggled and wait()) or wait(0.2) do
  438.                 if options.autoupdate and library.toggled then
  439.                     if last ~= location[flag] then
  440.                         callback(location[flag])
  441.                     end
  442.                     if not xpcall(function()
  443.                         check:FindFirstChild(name).Checkmark.Text = location[flag] and utf8.char(10003) or ""
  444.                     end, warn) then
  445.                         return
  446.                     end
  447.                     last = location[flag]
  448.                     wait(tonumber(tonumber(options.updatedelay or 1) or 1))
  449.                 end
  450.             end
  451.         end)
  452.     }
  453. end
  454. function types:Button(name, callback)
  455.     callback = callback or function()
  456.     end
  457.     local check = library:Create("Frame", {
  458.         BackgroundTransparency = 1,
  459.         Size = UDim2.new(1, 0, 0, 25),
  460.         LayoutOrder = self:GetOrder(),
  461.         library:Create("TextButton", {
  462.             Name = name,
  463.             Text = name,
  464.             BackgroundColor3 = library.options.btncolor,
  465.             BorderColor3 = library.options.bordercolor,
  466.             TextStrokeTransparency = library.options.textstroke,
  467.             TextStrokeColor3 = library.options.strokecolor,
  468.             TextColor3 = library.options.textcolor,
  469.             Position = UDim2.new(0, 5, 0, 5),
  470.             Size = UDim2.new(1, -10, 0, 20),
  471.             Font = library.options.font,
  472.             TextSize = library.options.fontsize
  473.         }),
  474.         Parent = self.container
  475.     })
  476.     table.insert(library.connections, check:FindFirstChild(name).MouseButton1Click:Connect(callback))
  477.     self:Resize()
  478.     return {
  479.         Fire = function()
  480.             callback()
  481.         end
  482.     }
  483. end
  484. function types:Box(name, options, callback, altreturn)
  485.     local types = options.type or ""
  486.     local _default = options.default or ""
  487.     local data = options.data
  488.     local location = options.location or self.flags
  489.     local flag = options.flag or ""
  490.     altreturn = altreturn or callback == true
  491.     local callback = (callback and type(callback) == "function" and callback) or function()
  492.     end
  493.     local min = options.min or 0
  494.     local max = options.max or 9e9
  495.     if (types == 'number' and not tonumber(_default)) or not options.type then
  496.         location[flag] = _default
  497.     elseif not options.autoupdate then
  498.         location[flag] = ""
  499.         _default = ""
  500.     end
  501.     _default = tostring(options.default or "") or ""
  502.     if tostring(_default) == "TextBox" then
  503.         _default = ""
  504.     end
  505.     local check = library:Create("Frame", {
  506.         BackgroundTransparency = 1,
  507.         Size = UDim2.new(1, 0, 0, 25),
  508.         LayoutOrder = self:GetOrder(),
  509.         library:Create("TextLabel", {
  510.             Name = name,
  511.             Text = "\r" .. name,
  512.             BackgroundTransparency = 1,
  513.             TextColor3 = library.options.textcolor,
  514.             TextStrokeTransparency = library.options.textstroke,
  515.             TextStrokeColor3 = library.options.strokecolor,
  516.             Position = UDim2.new(0, 5, 0, 0),
  517.             Size = UDim2.new(1, -5, 1, 0),
  518.             TextXAlignment = Enum.TextXAlignment.Left,
  519.             Font = library.options.font,
  520.             TextSize = library.options.fontsize,
  521.             library:Create("TextBox", {
  522.                 TextStrokeTransparency = library.options.textstroke,
  523.                 TextStrokeColor3 = library.options.strokecolor,
  524.                 Text = tostring(_default),
  525.                 Font = library.options.font,
  526.                 TextSize = library.options.fontsize,
  527.                 Name = 'Box',
  528.                 Size = UDim2.new(0, 60, 0, 20),
  529.                 Position = UDim2.new(1, -65, 0, 3),
  530.                 TextColor3 = library.options.textcolor,
  531.                 BackgroundColor3 = library.options.boxcolor,
  532.                 BorderColor3 = library.options.bordercolor,
  533.                 PlaceholderColor3 = library.options.placeholdercolor
  534.             })
  535.         }),
  536.         Parent = self.container
  537.     })
  538.     local box = check:FindFirstChild(name):FindFirstChild("Box")
  539.     table.insert(library.connections, box.FocusLost:Connect(function(e)
  540.         local old = location[flag]
  541.         if types == "number" then
  542.             local num = tonumber(box.Text)
  543.             if not num then
  544.                 box.Text = tonumber(location[flag])
  545.             else
  546.                 location[flag] = (min and max and math.clamp(num, min, max)) or num
  547.                 box.Text = tostring(tonumber(location[flag]) or "nan")
  548.             end
  549.         else
  550.             location[flag] = tostring(box.Text)
  551.         end
  552.         callback(box, location[flag], old, e)
  553.     end))
  554.     if types == 'number' then
  555.         table.insert(library.connections, box:GetPropertyChangedSignal("Text"):Connect(function()
  556.             box.Text = string.gsub(box.Text, "[%a+]", "")
  557.         end))
  558.     end
  559.     spawn(function()
  560.         if nil == options.autoupdate then
  561.             options.autoupdate = library.default_auto_update
  562.         end
  563.         if nil == options.updatedelay then
  564.             options.updatedelay = library.default_update_delay
  565.         end
  566.         if type(options.autoupdate) == "number" then
  567.             options.autoupdate, options.updatedelay = true, options.autoupdate
  568.         end
  569.         local last = location[flag]
  570.         while (options.autoupdate and not library.toggled and wait()) or wait(0.2) do
  571.             if options.autoupdate and library.toggled then
  572.                 if last ~= location[flag] then
  573.                     callback(box, location[flag], last)
  574.                 end
  575.                 if not pcall(function()
  576.                     box.Text = tostring(location[flag])
  577.                 end, warn) then
  578.                     return
  579.                 end
  580.                 last = location[flag]
  581.                 wait(tonumber(tonumber(options.updatedelay or 1) or 1))
  582.             end
  583.         end
  584.     end)
  585.     self:Resize()
  586.     if altreturn then
  587.         return {
  588.             Box = box,
  589.             Set = function(box, txt)
  590.                 local last = location[flag]
  591.                 if types == "number" then
  592.                     local num = tonumber(txt)
  593.                     if num then
  594.                         location[flag] = (min and max and math.clamp(num, min, max)) or num
  595.                     else
  596.                         return warn("number expected. got", typeof(txt))
  597.                     end
  598.                 else
  599.                     location[flag] = tostring(txt)
  600.                 end
  601.                 box.Text = tostring(location[flag])
  602.                 callback(box, location[flag], last)
  603.             end
  604.         }
  605.     end
  606.     return box
  607. end
  608. function types:Bind(name, options, callback)
  609.     local location = options.location or self.flags
  610.     local keyboardOnly = options.kbonly or false
  611.     local flag = options.flag or ""
  612.     local callback = callback or function()
  613.     end
  614.     local _default = options.default
  615.     if keyboardOnly and (not tostring(_default):find("MouseButton")) then
  616.         location[flag] = _default
  617.     end
  618.     local banned = {
  619.         Return = true,
  620.         Space = true,
  621.         Tab = true,
  622.         Unknown = true
  623.     }
  624.     local shortNames = {
  625.         RightControl = 'RightCtrl',
  626.         LeftControl = 'LeftCtrl',
  627.         LeftShift = 'LShift',
  628.         RightShift = 'RShift',
  629.         MouseButton1 = "Mouse1",
  630.         MouseButton2 = "Mouse2"
  631.     }
  632.     local allowed = {
  633.         MouseButton1 = true,
  634.         MouseButton2 = true
  635.     }
  636.     local nm = (_default and (shortNames[_default.Name] or _default.Name) or "None")
  637.     local check = library:Create("Frame", {
  638.         BackgroundTransparency = 1,
  639.         Size = UDim2.new(1, 0, 0, 30),
  640.         LayoutOrder = self:GetOrder(),
  641.         library:Create("TextLabel", {
  642.             Name = name,
  643.             Text = "\r" .. name,
  644.             BackgroundTransparency = 1,
  645.             TextColor3 = library.options.textcolor,
  646.             Position = UDim2.new(0, 5, 0, 0),
  647.             Size = UDim2.new(1, -5, 1, 0),
  648.             TextXAlignment = Enum.TextXAlignment.Left,
  649.             Font = library.options.font,
  650.             TextSize = library.options.fontsize,
  651.             TextStrokeTransparency = library.options.textstroke,
  652.             TextStrokeColor3 = library.options.strokecolor,
  653.             BorderColor3 = library.options.bordercolor,
  654.             BorderSizePixel = 1,
  655.             library:Create("TextButton", {
  656.                 Name = 'Keybind',
  657.                 Text = nm,
  658.                 TextStrokeTransparency = library.options.textstroke,
  659.                 TextStrokeColor3 = library.options.strokecolor,
  660.                 Font = library.options.font,
  661.                 TextSize = library.options.fontsize,
  662.                 Size = UDim2.new(0, 60, 0, 20),
  663.                 Position = UDim2.new(1, -65, 0, 5),
  664.                 TextColor3 = library.options.textcolor,
  665.                 BackgroundColor3 = library.options.bgcolor,
  666.                 BorderColor3 = library.options.bordercolor,
  667.                 BorderSizePixel = 1
  668.             })
  669.         }),
  670.         Parent = self.container
  671.     })
  672.     local button = check:FindFirstChild(name).Keybind
  673.     table.insert(library.connections, button.MouseButton1Click:Connect(function()
  674.         library.binding = true
  675.         button.Text = "..."
  676.         local a, b = game:GetService("UserInputService").InputBegan:Wait()
  677.         local name = tostring(a.KeyCode.Name)
  678.         local typeName = tostring(a.UserInputType.Name)
  679.         if (a.UserInputType ~= Enum.UserInputType.Keyboard and (allowed[a.UserInputType.Name]) and (not keyboardOnly)) or (a.KeyCode and (not banned[a.KeyCode.Name])) then
  680.             local name = (a.UserInputType ~= Enum.UserInputType.Keyboard and a.UserInputType.Name or a.KeyCode.Name)
  681.             location[flag] = a
  682.             button.Text = shortNames[name] or name
  683.             callback(a)
  684.         else
  685.             if (location[flag]) then
  686.                 if (not pcall(function()
  687.                     return location[flag].UserInputType
  688.                 end)) then
  689.                     local name = tostring(location[flag])
  690.                     button.Text = shortNames[name] or name
  691.                 else
  692.                     local name = (location[flag].UserInputType ~= Enum.UserInputType.Keyboard and location[flag].UserInputType.Name or location[flag].KeyCode.Name)
  693.                     button.Text = shortNames[name] or name
  694.                 end
  695.             end
  696.         end
  697.         wait(0.1)
  698.         library.binding = false
  699.     end))
  700.     if location[flag] then
  701.         button.Text = shortNames[tostring(location[flag].Name)] or tostring(location[flag].Name)
  702.     end
  703.     library.binds[flag] = {
  704.         location = location,
  705.         callback = callback
  706.     }
  707.     spawn(function()
  708.         if nil == options.autoupdate then
  709.             options.autoupdate = library.default_auto_update
  710.         end
  711.         if nil == options.updatedelay then
  712.             options.updatedelay = library.default_update_delay
  713.         end
  714.         if type(options.autoupdate) == "number" then
  715.             options.autoupdate, options.updatedelay = true, options.autoupdate
  716.         end
  717.         local last = location[flag]
  718.         while (options.autoupdate and not library.toggled and wait()) or wait(0.2) do
  719.             if options.autoupdate and library.toggled then
  720.                 if last ~= location[flag] then
  721.                     callback(location[flag])
  722.                 end
  723.                 if not pcall(function()
  724.                     button.Text = shortNames[tostring(location[flag].Name)] or tostring(location[flag].Name)
  725.                 end, warn) then
  726.                     return
  727.                 end
  728.                 last = location[flag]
  729.                 wait(tonumber(tonumber(options.updatedelay or 1) or 1))
  730.             end
  731.         end
  732.     end)
  733.     self:Resize()
  734. end
  735. function types:Section(name)
  736.     local order = self:GetOrder()
  737.     local determinedSize = UDim2.new(1, 0, 0, 25)
  738.     local determinedPos = UDim2.new(0, 0, 0, 4)
  739.     local secondarySize = UDim2.new(1, 0, 0, 20)
  740.     if order == 0 then
  741.         determinedSize = UDim2.new(1, 0, 0, 21)
  742.         determinedPos = UDim2.new(0, 0, 0, -1)
  743.         secondarySize = nil
  744.     end
  745.     local check = library:Create("Frame", {
  746.         Name = 'Section',
  747.         BackgroundTransparency = 1,
  748.         Size = determinedSize,
  749.         BackgroundColor3 = library.options.sectncolor,
  750.         BorderSizePixel = 0,
  751.         LayoutOrder = order,
  752.         library:Create("TextLabel", {
  753.             Name = 'section_lbl',
  754.             Text = name,
  755.             BackgroundTransparency = 0,
  756.             BorderSizePixel = 0,
  757.             BackgroundColor3 = library.options.sectncolor,
  758.             TextColor3 = library.options.textcolor,
  759.             Position = determinedPos,
  760.             Size = (secondarySize or UDim2.new(1, 0, 1, 0)),
  761.             Font = library.options.font,
  762.             TextSize = library.options.fontsize,
  763.             TextStrokeTransparency = library.options.textstroke,
  764.             TextStrokeColor3 = library.options.strokecolor
  765.         }),
  766.         Parent = self.container
  767.     })
  768.     self:Resize()
  769. end
  770. function types:Slider(name, options, callback)
  771.     local _default = options.default or options.min
  772.     local min = options.min or 0
  773.     local max = options.max or 1
  774.     local location = options.location or self.flags
  775.     local precise = options.precise or false
  776.     local flag = options.flag or ""
  777.     local callback = callback or function()
  778.     end
  779.     location[flag] = _default
  780.     local check = library:Create("Frame", {
  781.         BackgroundTransparency = 1,
  782.         Size = UDim2.new(1, 0, 0, 25),
  783.         LayoutOrder = self:GetOrder(),
  784.         library:Create("TextLabel", {
  785.             Name = name,
  786.             TextStrokeTransparency = library.options.textstroke,
  787.             TextStrokeColor3 = library.options.strokecolor,
  788.             Text = "\r" .. name,
  789.             BackgroundTransparency = 1,
  790.             TextColor3 = library.options.textcolor,
  791.             Position = UDim2.new(0, 5, 0, 2),
  792.             Size = UDim2.new(1, -5, 1, 0),
  793.             TextXAlignment = Enum.TextXAlignment.Left,
  794.             Font = library.options.font,
  795.             TextSize = library.options.fontsize,
  796.             library:Create("Frame", {
  797.                 Name = 'Container',
  798.                 Size = UDim2.new(0, 60, 0, 20),
  799.                 Position = UDim2.new(1, -65, 0, 3),
  800.                 BackgroundTransparency = 1,
  801.                 BorderSizePixel = 0,
  802.                 library:Create("TextLabel", {
  803.                     Name = 'ValueLabel',
  804.                     Text = _default,
  805.                     BackgroundTransparency = 1,
  806.                     TextColor3 = library.options.textcolor,
  807.                     Position = UDim2.new(0, -10, 0, 0),
  808.                     Size = UDim2.new(0, 1, 1, 0),
  809.                     TextXAlignment = Enum.TextXAlignment.Right,
  810.                     Font = library.options.font,
  811.                     TextSize = library.options.fontsize,
  812.                     TextStrokeTransparency = library.options.textstroke,
  813.                     TextStrokeColor3 = library.options.strokecolor
  814.                 }),
  815.                 library:Create("TextButton", {
  816.                     Name = 'Button',
  817.                     Size = UDim2.new(0, 5, 1, -2),
  818.                     Position = UDim2.new(0, 0, 0, 1),
  819.                     AutoButtonColor = false,
  820.                     Text = "",
  821.                     BackgroundColor3 = Color3.fromRGB(20, 20, 20),
  822.                     BorderSizePixel = 0,
  823.                     ZIndex = 2,
  824.                     TextStrokeTransparency = library.options.textstroke,
  825.                     TextStrokeColor3 = library.options.strokecolor
  826.                 }),
  827.                 library:Create("Frame", {
  828.                     Name = 'Line',
  829.                     BackgroundTransparency = 0,
  830.                     Position = UDim2.new(0, 0, 0.5, 0),
  831.                     Size = UDim2.new(1, 0, 0, 1),
  832.                     BackgroundColor3 = Color3.fromRGB(255, 255, 255),
  833.                     BorderSizePixel = 0
  834.                 })
  835.             })
  836.         }),
  837.         Parent = self.container
  838.     })
  839.     local overlay = check:FindFirstChild(name)
  840.     local renderSteppedConnection
  841.     local inputBeganConnection
  842.     local inputEndedConnection
  843.     local mouseLeaveConnection
  844.     local mouseDownConnection
  845.     local mouseUpConnection
  846.     table.insert(library.connections, check:FindFirstChild(name).Container.MouseEnter:Connect(function()
  847.         local function update()
  848.             if renderSteppedConnection then
  849.                 renderSteppedConnection:Disconnect()
  850.             end
  851.             renderSteppedConnection = game:GetService("RunService").RenderStepped:Connect(function()
  852.                 local mouse = game:GetService("UserInputService"):GetMouseLocation()
  853.                 local percent = (mouse.X - overlay.Container.AbsolutePosition.X) / (overlay.Container.AbsoluteSize.X)
  854.                 percent = math.clamp(percent, 0, 1)
  855.                 percent = tonumber(string.format("%.2f", percent))
  856.                 overlay.Container.Button.Position = UDim2.new(math.clamp(percent, 0, 0.99), 0, 0, 1)
  857.                 local num = min + (max - min) * percent
  858.                 local value = (precise and num or math.floor(num))
  859.                 overlay.Container.ValueLabel.Text = value
  860.                 callback(tonumber(value))
  861.                 location[flag] = tonumber(value)
  862.             end)
  863.             table.insert(library.connections, renderSteppedConnection)
  864.         end
  865.         local function disconnect()
  866.             if renderSteppedConnection then
  867.                 renderSteppedConnection:Disconnect()
  868.             end
  869.             if inputBeganConnection then
  870.                 inputBeganConnection:Disconnect()
  871.             end
  872.             if inputEndedConnection then
  873.                 inputEndedConnection:Disconnect()
  874.             end
  875.             if mouseLeaveConnection then
  876.                 mouseLeaveConnection:Disconnect()
  877.             end
  878.             if mouseUpConnection then
  879.                 mouseUpConnection:Disconnect()
  880.             end
  881.         end
  882.         inputBeganConnection = check:FindFirstChild(name).Container.InputBegan:Connect(function(input)
  883.             if input.UserInputType == Enum.UserInputType.MouseButton1 then
  884.                 update()
  885.             end
  886.         end)
  887.         table.insert(library.connections, inputBeganConnection)
  888.         inputEndedConnection = check:FindFirstChild(name).Container.InputEnded:Connect(function(input)
  889.             if input.UserInputType == Enum.UserInputType.MouseButton1 then
  890.                 disconnect()
  891.             end
  892.         end)
  893.         table.insert(library.connections, inputEndedConnection)
  894.         mouseDownConnection = check:FindFirstChild(name).Container.Button.MouseButton1Down:Connect(update)
  895.         table.insert(library.connections, mouseDownConnection)
  896.         mouseUpConnection = game:GetService("UserInputService").InputEnded:Connect(function(a, b)
  897.             if a.UserInputType == Enum.UserInputType.MouseButton1 and (mouseDownConnection.Connected) then
  898.                 disconnect()
  899.             end
  900.         end)
  901.         table.insert(library.connections, mouseUpConnection)
  902.     end))
  903.     if _default ~= min then
  904.         local percent = 1 - ((max - _default) / (max - min))
  905.         local number = _default
  906.         number = tonumber(string.format("%.2f", number))
  907.         if (not precise) then
  908.             number = math.floor(number)
  909.         end
  910.         overlay.Container.Button.Position = UDim2.new(math.clamp(percent, 0, 0.99), 0, 0, 1)
  911.         overlay.Container.ValueLabel.Text = number
  912.     end
  913.     self:Resize()
  914.     return {
  915.         Set = function(self, value)
  916.             local percent = 1 - ((max - value) / (max - min))
  917.             local number = value
  918.             number = tonumber(string.format("%.2f", number))
  919.             if (not precise) then
  920.                 number = math.floor(number)
  921.             end
  922.             overlay.Container.Button.Position = UDim2.new(math.clamp(percent, 0, 0.99), 0, 0, 1)
  923.             overlay.Container.ValueLabel.Text = number
  924.             location[flag] = number
  925.             callback(number)
  926.         end,
  927.         spawn(function()
  928.             if nil == options.autoupdate then
  929.                 options.autoupdate = library.default_auto_update
  930.             end
  931.             if nil == options.updatedelay then
  932.                 options.updatedelay = library.default_update_delay
  933.             end
  934.             if type(options.autoupdate) == "number" then
  935.                 options.autoupdate, options.updatedelay = true, options.autoupdate
  936.             end
  937.             local last = location[flag]
  938.             while (options.autoupdate and not library.toggled and wait()) or wait(0.2) do
  939.                 if options.autoupdate and library.toggled then
  940.                     if last ~= location[flag] then
  941.                         callback(location[flag])
  942.                     end
  943.                     if not xpcall(function()
  944.                         local percent = 1 - ((max - location[flag]) / (max - min))
  945.                         local number = location[flag]
  946.                         number = tonumber(string.format("%.2f", number))
  947.                         if (not precise) then
  948.                             number = math.floor(number)
  949.                         end
  950.                         overlay.Container.Button.Position = UDim2.new(math.clamp(percent, 0, 0.99), 0, 0, 1)
  951.                         overlay.Container.ValueLabel.Text = number
  952.                     end, warn) then
  953.                         return
  954.                     end
  955.                     last = location[flag]
  956.                     wait(tonumber(tonumber(options.updatedelay or 1) or 1))
  957.                 end
  958.             end
  959.         end)
  960.     }
  961. end
  962. function types:SearchBox(text, options, callback)
  963.     local list = options.list or {}
  964.     local flag = options.flag or ""
  965.     local location = options.location or self.flags
  966.     local callback = callback or function()
  967.     end
  968.     local busy = false
  969.     local box = library:Create("Frame", {
  970.         BackgroundTransparency = 1,
  971.         Size = UDim2.new(1, 0, 0, 25),
  972.         LayoutOrder = self:GetOrder(),
  973.         library:Create("TextBox", {
  974.             Text = "",
  975.             PlaceholderText = text,
  976.             PlaceholderColor3 = Color3.fromRGB(60, 60, 60),
  977.             Font = library.options.font,
  978.             TextSize = library.options.fontsize,
  979.             Name = 'Box',
  980.             Size = UDim2.new(1, -10, 0, 20),
  981.             Position = UDim2.new(0, 5, 0, 4),
  982.             TextColor3 = library.options.textcolor,
  983.             BackgroundColor3 = library.options.dropcolor,
  984.             BorderColor3 = library.options.bordercolor,
  985.             TextStrokeTransparency = library.options.textstroke,
  986.             TextStrokeColor3 = library.options.strokecolor,
  987.             library:Create("ScrollingFrame", {
  988.                 Position = UDim2.new(0, 0, 1, 1),
  989.                 Name = 'Container',
  990.                 BackgroundColor3 = library.options.btncolor,
  991.                 ScrollBarThickness = 0,
  992.                 BorderSizePixel = 0,
  993.                 BorderColor3 = library.options.bordercolor,
  994.                 Size = UDim2.new(1, 0, 0, 0),
  995.                 library:Create("UIListLayout", {
  996.                     Name = 'ListLayout',
  997.                     SortOrder = Enum.SortOrder.LayoutOrder
  998.                 }),
  999.                 ZIndex = 2
  1000.             })
  1001.         }),
  1002.         Parent = self.container
  1003.     })
  1004.     local tbox = box:FindFirstChild("Box")
  1005.     local function rebuild(text)
  1006.         text = tostring(text)
  1007.         box:FindFirstChild("Box").Container.ScrollBarThickness = 0
  1008.         for i, child in next, box:FindFirstChild("Box").Container:GetChildren() do
  1009.             if (not child:IsA("UIListLayout")) then
  1010.                 child:Destroy()
  1011.             end
  1012.         end
  1013.         if #text > 0 then
  1014.             for i, v in next, list do
  1015.                 v = tostring(v)
  1016.                 if string.sub(string.lower(v), 1, string.len(text)) == string.lower(text) or string.find(string.lower(v), string.lower(text), 1, true) then
  1017.                     local button = library:Create("TextButton", {
  1018.                         Text = v,
  1019.                         Font = library.options.font,
  1020.                         TextSize = library.options.fontsize,
  1021.                         TextColor3 = library.options.textcolor,
  1022.                         BorderColor3 = library.options.bordercolor,
  1023.                         TextStrokeTransparency = library.options.textstroke,
  1024.                         TextStrokeColor3 = library.options.strokecolor,
  1025.                         Parent = box:FindFirstChild("Box").Container,
  1026.                         Size = UDim2.new(1, 0, 0, 20),
  1027.                         LayoutOrder = i,
  1028.                         BackgroundColor3 = library.options.btncolor,
  1029.                         ZIndex = 2
  1030.                     })
  1031.                     table.insert(library.connections, button.MouseButton1Click:Connect(function()
  1032.                         busy = true
  1033.                         box:FindFirstChild("Box").Text = button.Text
  1034.                         wait()
  1035.                         busy = false
  1036.                         location[flag] = button.Text
  1037.                         callback(location[flag])
  1038.                         box:FindFirstChild("Box").Container.ScrollBarThickness = 0
  1039.                         for _, child in pairs(box:FindFirstChild("Box").Container:GetChildren()) do
  1040.                             if not child:IsA("UIListLayout") then
  1041.                                 child:Destroy()
  1042.                             end
  1043.                         end
  1044.                         box:FindFirstChild("Box").Container:TweenSize(UDim2.new(1, 0, 0, 0), "Out", "Quad", 0.25, true)
  1045.                     end))
  1046.                 end
  1047.             end
  1048.         end
  1049.         local c = box:FindFirstChild("Box").Container:GetChildren()
  1050.         local ry = (20 * (#c)) - 20
  1051.         local y = math.clamp((20 * (#c)) - 20, 0, 100)
  1052.         if ry > 100 then
  1053.             box:FindFirstChild("Box").Container.ScrollBarThickness = 5
  1054.         end
  1055.         box:FindFirstChild("Box").Container:TweenSize(UDim2.new(1, 0, 0, y), "Out", "Quad", 0.25, true)
  1056.         box:FindFirstChild("Box").Container.CanvasSize = UDim2.new(1, 0, 0, (20 * (#c)) - 20)
  1057.     end
  1058.     table.insert(library.connections, box:FindFirstChild("Box"):GetPropertyChangedSignal("Text"):Connect(function()
  1059.         if not busy then
  1060.             rebuild(box:FindFirstChild("Box").Text)
  1061.         end
  1062.     end))
  1063.     table.insert(library.connections, box:FindFirstChild("Box").FocusLost:Connect(function(enter)
  1064.         if enter and box:FindFirstChild("Box").Text:len() > 0 then
  1065.             return callback(nil, box:FindFirstChild("Box").Text)
  1066.         end
  1067.     end))
  1068.     local function reload(new_list)
  1069.         list = new_list
  1070.         rebuild("")
  1071.     end
  1072.     spawn(function()
  1073.         if nil == options.autoupdate then
  1074.             options.autoupdate = library.default_auto_update
  1075.         end
  1076.         if nil == options.updatedelay then
  1077.             options.updatedelay = library.default_update_delay
  1078.         end
  1079.         if type(options.autoupdate) == "number" then
  1080.             options.autoupdate, options.updatedelay = true, options.autoupdate
  1081.         end
  1082.         local last = location[flag]
  1083.         while (options.autoupdate and not library.toggled and wait()) or wait(0.2) do
  1084.             if options.autoupdate and library.toggled then
  1085.                 if last ~= location[flag] then
  1086.                     callback(location[flag])
  1087.                 end
  1088.                 if not pcall(function()
  1089.                     tbox.Text = tostring(location[flag])
  1090.                     if game:GetService("UserInputService"):GetFocusedTextBox() ~= tbox then
  1091.                         box:FindFirstChild("Box").Container.ScrollBarThickness = 0
  1092.                         for _, child in pairs(box:FindFirstChild("Box").Container:GetChildren()) do
  1093.                             if not child:IsA("UIListLayout") then
  1094.                                 child:Destroy()
  1095.                             end
  1096.                         end
  1097.                         box:FindFirstChild("Box").Container:TweenSize(UDim2.new(1, 0, 0, 0), "Out", "Quad", 0.25, true)
  1098.                     end
  1099.                 end, warn) then
  1100.                     return
  1101.                 end
  1102.                 last = location[flag]
  1103.                 wait(tonumber(tonumber(options.updatedelay or 1) or 1))
  1104.             end
  1105.         end
  1106.     end)
  1107.     self:Resize()
  1108.     return reload, box:FindFirstChild("Box")
  1109. end
  1110. function types:Dropdown(name, options, callback)
  1111.     local location = options.location or self.flags
  1112.     local flag = options.flag or ""
  1113.     local callback = callback or function()
  1114.     end
  1115.     local list = options.list or {}
  1116.     location[flag] = list[1]
  1117.     local check = library:Create("Frame", {
  1118.         BackgroundTransparency = 1,
  1119.         Size = UDim2.new(1, 0, 0, 25),
  1120.         BackgroundColor3 = Color3.fromRGB(25, 25, 25),
  1121.         BorderSizePixel = 0,
  1122.         LayoutOrder = self:GetOrder(),
  1123.         library:Create("Frame", {
  1124.             Name = 'dropdown_lbl',
  1125.             BackgroundTransparency = 0,
  1126.             BackgroundColor3 = library.options.dropcolor,
  1127.             Position = UDim2.new(0, 5, 0, 4),
  1128.             BorderColor3 = library.options.bordercolor,
  1129.             Size = UDim2.new(1, -10, 0, 20),
  1130.             library:Create("TextLabel", {
  1131.                 Name = 'Selection',
  1132.                 Size = UDim2.new(1, 0, 1, 0),
  1133.                 Text = list[1],
  1134.                 TextColor3 = library.options.textcolor,
  1135.                 BackgroundTransparency = 1,
  1136.                 Font = library.options.font,
  1137.                 TextSize = library.options.fontsize,
  1138.                 TextStrokeTransparency = library.options.textstroke,
  1139.                 TextStrokeColor3 = library.options.strokecolor
  1140.             }),
  1141.             library:Create("TextButton", {
  1142.                 Name = 'drop',
  1143.                 BackgroundTransparency = 1,
  1144.                 Size = UDim2.new(0, 20, 1, 0),
  1145.                 Position = UDim2.new(1, -25, 0, 0),
  1146.                 Text = 'v',
  1147.                 TextColor3 = library.options.textcolor,
  1148.                 Font = library.options.font,
  1149.                 TextSize = library.options.fontsize,
  1150.                 TextStrokeTransparency = library.options.textstroke,
  1151.                 TextStrokeColor3 = library.options.strokecolor
  1152.             })
  1153.         }),
  1154.         Parent = self.container
  1155.     })
  1156.     local button = check:FindFirstChild("dropdown_lbl").drop
  1157.     local input, container
  1158.     table.insert(library.connections, button.MouseButton1Click:Connect(function()
  1159.         if (input and input.Connected) then
  1160.             return
  1161.         end
  1162.         check:FindFirstChild("dropdown_lbl"):WaitForChild("Selection").TextColor3 = Color3.fromRGB(60, 60, 60)
  1163.         check:FindFirstChild("dropdown_lbl"):WaitForChild("Selection").Text = name
  1164.         local c = 0
  1165.         for i, v in next, list do
  1166.             c = c + 20
  1167.         end
  1168.         local size = UDim2.new(1, 0, 0, c)
  1169.         local clampedSize
  1170.         local scrollSize = 0
  1171.         if size.Y.Offset > 100 then
  1172.             clampedSize = UDim2.new(1, 0, 0, 100)
  1173.             scrollSize = 5
  1174.         end
  1175.         local goSize = (clampedSize ~= nil and clampedSize) or size
  1176.         local container = library:Create("ScrollingFrame", {
  1177.             TopImage = 'rbxasset://textures/ui/Scroll/scroll-middle.png',
  1178.             BottomImage = 'rbxasset://textures/ui/Scroll/scroll-middle.png',
  1179.             Name = 'DropContainer',
  1180.             Parent = check:FindFirstChild("dropdown_lbl"),
  1181.             Size = UDim2.new(1, 0, 0, 0),
  1182.             BackgroundColor3 = library.options.bgcolor,
  1183.             BorderColor3 = library.options.bordercolor,
  1184.             Position = UDim2.new(0, 0, 1, 0),
  1185.             ScrollBarThickness = scrollSize,
  1186.             CanvasSize = UDim2.new(0, 0, 0, size.Y.Offset),
  1187.             ZIndex = 5,
  1188.             ClipsDescendants = true,
  1189.             library:Create("UIListLayout", {
  1190.                 Name = 'List',
  1191.                 SortOrder = Enum.SortOrder.LayoutOrder
  1192.             })
  1193.         })
  1194.         for i, v in next, list do
  1195.             local btn = library:Create("TextButton", {
  1196.                 Size = UDim2.new(1, 0, 0, 20),
  1197.                 BackgroundColor3 = library.options.btncolor,
  1198.                 BorderColor3 = library.options.bordercolor,
  1199.                 Text = v,
  1200.                 Font = library.options.font,
  1201.                 TextSize = library.options.fontsize,
  1202.                 LayoutOrder = i,
  1203.                 Parent = container,
  1204.                 ZIndex = 5,
  1205.                 TextColor3 = library.options.textcolor,
  1206.                 TextStrokeTransparency = library.options.textstroke,
  1207.                 TextStrokeColor3 = library.options.strokecolor
  1208.             })
  1209.             table.insert(library.connections, btn.MouseButton1Click:Connect(function()
  1210.                 check:FindFirstChild("dropdown_lbl"):WaitForChild("Selection").TextColor3 = library.options.textcolor
  1211.                 check:FindFirstChild("dropdown_lbl"):WaitForChild("Selection").Text = btn.Text
  1212.                 location[flag] = tostring(btn.Text)
  1213.                 callback(location[flag])
  1214.                 game:GetService("Debris"):AddItem(container, 0)
  1215.                 input:Disconnect()
  1216.             end))
  1217.         end
  1218.         container:TweenSize(goSize, "Out", "Quad", 0.15, true)
  1219.         local function isInGui(frame)
  1220.             local mloc = game:GetService("UserInputService"):GetMouseLocation()
  1221.             local mouse = Vector2.new(mloc.X, mloc.Y - 36)
  1222.             local x1, x2 = frame.AbsolutePosition.X, frame.AbsolutePosition.X + frame.AbsoluteSize.X
  1223.             local y1, y2 = frame.AbsolutePosition.Y, frame.AbsolutePosition.Y + frame.AbsoluteSize.Y
  1224.             return (mouse.X >= x1 and mouse.X <= x2) and (mouse.Y >= y1 and mouse.Y <= y2)
  1225.         end
  1226.         input = game:GetService("UserInputService").InputBegan:Connect(function(a)
  1227.             if a.UserInputType == Enum.UserInputType.MouseButton1 and (not isInGui(container)) then
  1228.                 check:FindFirstChild("dropdown_lbl"):WaitForChild("Selection").TextColor3 = library.options.textcolor
  1229.                 check:FindFirstChild("dropdown_lbl"):WaitForChild("Selection").Text = tostring(location[flag] or "")
  1230.                 container:TweenSize(UDim2.new(1, 0, 0, 0), "In", "Quad", 0.15, true)
  1231.                 wait(0.15)
  1232.                 game:GetService("Debris"):AddItem(container, 0)
  1233.                 input:Disconnect()
  1234.             end
  1235.         end)
  1236.         table.insert(library.connections, input)
  1237.     end))
  1238.     self:Resize()
  1239.     local function reload(self, array)
  1240.         options = array
  1241.         location[flag] = array[1]
  1242.         pcall(function()
  1243.             input:Disconnect()
  1244.         end)
  1245.         check:WaitForChild("dropdown_lbl").Selection.Text = tostring(location[flag] or "")
  1246.         check:FindFirstChild("dropdown_lbl"):WaitForChild("Selection").TextColor3 = library.options.textcolor
  1247.         game:GetService("Debris"):AddItem(container, 0)
  1248.         options = array
  1249.     end
  1250.     return {
  1251.         Refresh = reload,
  1252.         Gui = check,
  1253.         spawn(function()
  1254.             options = type(options) == "table" and options or {}
  1255.             if nil == options.autoupdate then
  1256.                 options.autoupdate = library.default_auto_update
  1257.             end
  1258.             if nil == options.updatedelay then
  1259.                 options.updatedelay = library.default_update_delay
  1260.             end
  1261.             if type(options.autoupdate) == "number" then
  1262.                 options.autoupdate, options.updatedelay = true, options.autoupdate
  1263.             end
  1264.             local last = location[flag]
  1265.             wait(4)
  1266.             options = type(options) == "table" and options or {}
  1267.             while (options.autoupdate and not library.toggled and wait()) or wait(0.2) do
  1268.                 if options.autoupdate and library.toggled then
  1269.                     if last ~= location[flag] then
  1270.                         callback(location[flag])
  1271.                     end
  1272.                     if not pcall(function()
  1273.                         check:FindFirstChild(name).Checkmark.Text = location[flag] and utf8.char(10003) or ""
  1274.                     end, warn) then
  1275.                         return
  1276.                     end
  1277.                     last = location[flag]
  1278.                     wait(tonumber(tonumber(options.updatedelay or 1) or 1))
  1279.                 end
  1280.             end
  1281.         end)
  1282.     }
  1283. end
  1284. function library:Create(class, data)
  1285.     local obj = Instance.new(class)
  1286.     for i, v in next, data do
  1287.         if i ~= 'Parent' then
  1288.             if typeof(v) == "Instance" then
  1289.                 v.Parent = obj
  1290.             else
  1291.                 obj[i] = v
  1292.             end
  1293.         end
  1294.     end
  1295.     obj.Parent = data.Parent
  1296.     return obj
  1297. end
  1298. function library:CreateWindow(name, options)
  1299.     local autodel = options and type(options) == "table" and options.autodelete
  1300.     if options then
  1301.         pcall(function()
  1302.             options.autodelete = nil
  1303.         end)
  1304.     end
  1305.     if not library.container then
  1306.         library.container = self:Create("ScreenGui", {
  1307.             self:Create("Frame", {
  1308.                 Name = "Container",
  1309.                 Size = UDim2.new(1, -30, 1, 0),
  1310.                 Position = UDim2.new(0, 20, 0, 20),
  1311.                 BackgroundTransparency = 1,
  1312.                 Active = false
  1313.             })
  1314.         })
  1315.         if type(syn) == "table" and type(syn.protect_gui) == "function" then
  1316.             pcall(syn.protect_gui, library.container)
  1317.         end
  1318.         if type(get_hidden_gui) == "function" then
  1319.             library.container.Parent = get_hidden_gui()
  1320.         elseif type(gethui) == "function" then
  1321.             library.container.Parent = gethui()
  1322.         else
  1323.             local x, s = pcall(function()
  1324.                 library.container.Parent = game:GetService("CoreGui")
  1325.                 return true
  1326.             end)
  1327.             if not x or not s then
  1328.                 warn("Please consider buying Synapse")
  1329.                 library.container.Parent = game:GetService("Players").LocalPlayer:WaitForChild("PlayerGui", 20)
  1330.             end
  1331.         end
  1332.         library.mastergui = library.container
  1333.         if autodel then
  1334.             local con = library.mastergui or library.container
  1335.             if con then
  1336.                 delay(autodel, function()
  1337.                     if con then
  1338.                         con:Destroy()
  1339.                     end
  1340.                     if type(library.connections) == "table" then
  1341.                         for _, c in pairs(library.connections) do
  1342.                             if typeof(c) == "RBXScriptConnection" then
  1343.                                 c:Disconnect()
  1344.                                 c = nil
  1345.                             end
  1346.                         end
  1347.                     end
  1348.                 end)
  1349.             end
  1350.         end
  1351.         library.container = library.container:FindFirstChild("Container")
  1352.     end
  1353.     if not library.options then
  1354.         library.options = setmetatable(options or {}, {
  1355.             __index = default
  1356.         })
  1357.     end
  1358.     options = (options and type(options) == "table" and options) or {}
  1359.     local master = {}
  1360.     for k, v in pairs(default) do
  1361.         if nil ~= options[k] then
  1362.             master[k] = options[k]
  1363.         else
  1364.             master[k] = default[k]
  1365.         end
  1366.     end
  1367.     local window = types.window(name, master or library.options or default)
  1368.     dragger.new(window.object)
  1369.     return window
  1370. end
  1371. library.options = setmetatable({}, {
  1372.     __index = default
  1373. })
  1374. spawn(function()
  1375.     while true do
  1376.         for i = 0, 1, 1 / 300 do
  1377.             for _, obj in next, library.rainbowtable do
  1378.                 obj.BackgroundColor3 = Color3.fromHSV(i, 1, 1)
  1379.             end
  1380.             wait()
  1381.         end
  1382.     end
  1383. end)
  1384. local function isreallypressed(bind, inp)
  1385.     local key = bind
  1386.     if typeof(key) == "Instance" then
  1387.         if key.UserInputType == Enum.UserInputType.Keyboard and inp.KeyCode == key.KeyCode then
  1388.             return true
  1389.         elseif tostring(key.UserInputType):find("MouseButton") and inp.UserInputType == key.UserInputType then
  1390.             return true
  1391.         end
  1392.     end
  1393.     if tostring(key):find 'MouseButton1' then
  1394.         return key == inp.UserInputType
  1395.     else
  1396.         return key == inp.KeyCode
  1397.     end
  1398. end
  1399. library.connections.bindstuff = game:GetService("UserInputService").InputBegan:Connect(function(input)
  1400.     if not library.binding then
  1401.         for idx, binds in next, library.binds do
  1402.             local real_binding = binds.location[idx]
  1403.             if real_binding and isreallypressed(real_binding, input) then
  1404.                 binds.callback()
  1405.             end
  1406.         end
  1407.     end
  1408. end)
  1409. game:GetService("TestService"):Message("UI-Lib Loaded! Version:" .. tostring(vers))
  1410. do
  1411.     return library, __instructions
  1412. end
  1413.  
  1414.  
  1415. -- Example usage
  1416. local library = loadstring(rawget(game:GetObjects("rbxassetid://4133667265"), 1).Source)("Wallys Forked UI")
  1417. local gui = {}
  1418. local mods = {
  1419.     ["toggle_1"] = true
  1420. }
  1421.  
  1422. gui.main = library:CreateWindow("Main", {underlinecolor = Color3.fromRGB(0, 255, 140)})
  1423.  
  1424. gui.main:Toggle("Toggle 1", {
  1425.     location = mods, -- The table holding the data
  1426.     flag = "toggle_1", -- The index at which to store the data
  1427.     default = true -- Set start value to enabled
  1428. }, function(bool)
  1429.     if bool == true then
  1430.         print("Checked!")
  1431.     end
  1432.     if bool == false then
  1433.         print("Unchecked!")
  1434.     end
  1435. end)
Add Comment
Please, Sign In to add comment