Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if Library then
- Library.Count = 0;
- Library.Queue = {};
- Library.Callbacks = {};
- Library.RainbowTable = {};
- Library.Toggled = true;
- Library.Binds = {};
- else
- Library = {};
- Library.Count = 0;
- Library.Queue = {};
- Library.Callbacks = {};
- Library.RainbowTable = {};
- Library.Toggled = true;
- Library.Binds = {};
- end
- local Players = game:GetService("Players")
- local UserInputService = game:GetService("UserInputService")
- local ContextActionService = game:GetService("ContextActionService")
- local RunService = game:GetService("RunService")
- local LocalPlayer = Players.LocalPlayer
- local function swait()
- return RunService.RenderStepped:Wait();
- end
- local Defaults; do
- local Dragger = {}; do
- local Mouse = LocalPlayer:GetMouse();
- function Dragger.new(Frame)
- local dragging
- local dragInput
- local dragStart
- local startPos
- local function update(input)
- local delta = input.Position - dragStart
- Frame.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
- end
- Frame.InputBegan:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
- dragging = true
- dragStart = input.Position
- startPos = Frame.Position
- input.Changed:Connect(function()
- if input.UserInputState == Enum.UserInputState.End then
- dragging = false
- end
- end)
- end
- end)
- Frame.InputChanged:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
- dragInput = input
- end
- end)
- UserInputService.InputChanged:Connect(function(input)
- if input == dragInput and dragging then
- update(input)
- end
- end)
- end
- end
- local types = {}; do
- types.__index = types;
- function types.window(name,Options)
- Library.Count = Library.Count + 1
- local newWindow = Library:Create('Frame',{
- Name = name;
- Size = UDim2.new(0,190,0,30);
- BackgroundColor3 = Options.TopColor;
- BorderSizePixel = 0;
- Parent = Library.Container;
- Position = UDim2.new(0,(15 + (200 * Library.Count) - 200),0,0);
- ZIndex = 3;
- Library:Create('TextLabel',{
- Name = ("NameLabel");
- Text = name;
- Size = UDim2.new(1, - 10,1,0);
- Position = UDim2.new(0,5,0,0);
- BackgroundTransparency = 1;
- Font = Enum.Font.Code;
- TextSize = Options.TitleSize;
- Font = Options.TitleFont;
- TextColor3 = Options.TitleTextColor;
- TextStrokeTransparency = Library.Options.TitleStroke;
- TextStrokeColor3 = Library.Options.TitleStrokeColor;
- ZIndex = 3;
- });
- Library:Create("TextButton",{
- Size = UDim2.new(0,30,0,30);
- Position = UDim2.new(1, - 35,0,0);
- BackgroundTransparency = 1;
- Text = " - ";
- TextSize = Options.TitleSize;
- Font = Options.TitleFont; -- Enum.Font.Code;
- Name = 'window_toggle';
- TextColor3 = Options.TitleTextColor;
- TextStrokeTransparency = Library.Options.TitleStroke;
- TextStrokeColor3 = Library.Options.TitleStrokeColor;
- ZIndex = 3;
- });
- Library:Create("Frame",{
- Name = 'Underline';
- Size = UDim2.new(1,0,0,2);
- Position = UDim2.new(0,0,1, - 2);
- BackgroundColor3 = (Options.UnderlineColor ~= "rainbow" and Options.UnderlineColor or Color3.new());
- BorderSizePixel = 0;
- ZIndex = 3;
- });
- Library:Create('Frame',{
- Name = 'Container';
- Position = UDim2.new(0,0,1,0);
- Size = UDim2.new(1,0,0,0);
- BorderSizePixel = 0;
- BackgroundColor3 = Options.BGColor;
- ClipsDescendants = false;
- Library:Create('UIListLayout',{
- Name = 'List';
- SortOrder = Enum.SortOrder.LayoutOrder;
- })
- });
- })
- if Options.UnderlineColor == "rainbow" then
- table.insert(Library.RainbowTable,newWindow:FindFirstChild('Underline'))
- end
- local window = setmetatable({
- Count = 0;
- Object = newWindow;
- Container = newWindow.Container;
- Toggled = true;
- Flags = {};
- },types)
- table.insert(Library.Queue,{
- w = window.Object;
- p = window.Object.Position;
- })
- newWindow:FindFirstChild("window_toggle").MouseButton1Click:connect(function()
- window.Toggled = not window.Toggled;
- newWindow:FindFirstChild("window_toggle").Text = (window.Toggled and " + " or " - ")
- if (not window.Toggled) then
- window.Container.ClipsDescendants = true;
- end
- wait();
- local y = 0;
- for i,v in next,window.Container:GetChildren() do
- if (not v:IsA('UIListLayout')) then
- y = y + v.AbsoluteSize.Y;
- end
- end
- local targetSize = window.Toggled and UDim2.new(1,0,0,y + 5) or UDim2.new(1,0,0,0);
- local targetDirection = window.Toggled and "In" or "Out"
- window.Container:TweenSize(targetSize,targetDirection,"Quint",.3,true)
- wait(.3)
- if window.Toggled then
- window.Container.ClipsDescendants = false;
- end
- end)
- return window;
- end
- function types:Resize()
- local y = 0;
- for i,v in next,self.Container:GetChildren() do
- if (not v:IsA('UIListLayout')) then
- y = y + v.AbsoluteSize.Y;
- end
- end
- self.Container.Size = UDim2.new(1,0,0,y + 5)
- end
- function types:GetOrder()
- local c = 0;
- for i,v in next,self.Container:GetChildren() do
- if (not v:IsA('UIListLayout')) then
- c = c + 1
- end
- end
- return c
- end
- function types:Toggle(name,Options,callback)
- local Default = Options.Default or false;
- local location = Options.location or self.Flags;
- local flag = Options.flag or "";
- local callback = callback or function() end;
- location[flag] = Default;
- local check = Library:Create('Frame',{
- BackgroundTransparency = 1;
- Size = UDim2.new(1,0,0,25);
- LayoutOrder = self:GetOrder();
- Library:Create('TextLabel',{
- Name = name;
- Text = "\r" .. name;
- BackgroundTransparency = 1;
- TextColor3 = Library.Options.TextColor;
- Position = UDim2.new(0,5,0,0);
- Size = UDim2.new(1, - 5,1,0);
- TextXAlignment = Enum.TextXAlignment.Left;
- Font = Library.Options.Font;
- TextSize = Library.Options.FontSize;
- TextStrokeTransparency = Library.Options.TextStroke;
- TextStrokeColor3 = Library.Options.StrokeColor;
- Library:Create('TextButton',{
- Text = (location[flag] and utf8.char(10003) or "");
- Font = Library.Options.Font;
- TextSize = Library.Options.FontSize;
- Name = 'Checkmark';
- Size = UDim2.new(0,20,0,20);
- Position = UDim2.new(1, - 25,0,4);
- TextColor3 = Library.Options.TextColor;
- BackgroundColor3 = Library.Options.BGColor;
- BorderColor3 = Library.Options.BorderColor;
- TextStrokeTransparency = Library.Options.TextStroke;
- TextStrokeColor3 = Library.Options.StrokeColor;
- })
- });
- Parent = self.Container;
- });
- local function click(t)
- location[flag] = not location[flag];
- callback(location[flag])
- check:FindFirstChild(name).Checkmark.Text = location[flag] and utf8.char(10003) or "";
- end
- check:FindFirstChild(name).Checkmark.MouseButton1Click:connect(click)
- Library.Callbacks[flag] = click;
- if location[flag] == true then
- callback(location[flag])
- end
- self:Resize();
- return {
- Set = function(self,b)
- location[flag] = b;
- callback(location[flag])
- check:FindFirstChild(name).Checkmark.Text = location[flag] and utf8.char(10003) or "";
- end
- }
- end
- types.Button = function(self,Name)
- local Check = Library:Create(("Frame"),{
- BackgroundTransparency = 1;
- Size = UDim2.new(1,0,0,25);
- LayoutOrder = self:GetOrder();
- Library:Create(("TextButton"),{
- ["Name"] = Name;
- Text = Name;
- BackgroundColor3 = Library.Options.BTNColor;
- BorderColor3 = Library.Options.BorderColor;
- TextStrokeTransparency = Library.Options.TextStroke;
- TextStrokeColor3 = Library.Options.StrokeColor;
- TextColor3 = Library.Options.TextColor;
- Position = UDim2.new(0,5,0,5);
- Size = UDim2.new(1, - 10,0,20);
- Font = Library.Options.Font;
- TextSize = Library.Options.FontSize;
- });
- Parent = self.Container;
- });
- local Button = Check:FindFirstChild(Name);
- self:Resize();
- return Button;
- end
- function types:Box(name,Options,callback) -- Type,Default,data,location,flag)
- local Type = Options.Type or "";
- local Default = Options.Default or "";
- local data = Options.data
- local location = Options.location or self.Flags;
- local flag = Options.flag or "";
- local callback = callback or function() end;
- local min = Options.min or 0;
- local max = Options.max or 9e9;
- if Type == 'number' and (not tonumber(Default)) then
- location[flag] = Default;
- else
- location[flag] = "";
- Default = "";
- end
- local check = Library:Create('Frame',{
- BackgroundTransparency = 1;
- Size = UDim2.new(1,0,0,25);
- LayoutOrder = self:GetOrder();
- Library:Create('TextLabel',{
- Name = name;
- Text = "\r" .. name;
- BackgroundTransparency = 1;
- TextColor3 = Library.Options.TextColor;
- TextStrokeTransparency = Library.Options.TextStroke;
- TextStrokeColor3 = Library.Options.StrokeColor;
- Position = UDim2.new(0,5,0,0);
- Size = UDim2.new(1, - 5,1,0);
- TextXAlignment = Enum.TextXAlignment.Left;
- Font = Library.Options.Font;
- TextSize = Library.Options.FontSize;
- Library:Create('TextBox',{
- TextStrokeTransparency = Library.Options.TextStroke;
- TextStrokeColor3 = Library.Options.StrokeColor;
- Text = tostring(Default);
- Font = Library.Options.Font;
- TextSize = Library.Options.FontSize;
- Name = 'Box';
- Size = UDim2.new(0,60,0,20);
- Position = UDim2.new(1, - 65,0,3);
- TextColor3 = Library.Options.TextColor;
- BackgroundColor3 = Library.Options.BoxColor;
- BorderColor3 = Library.Options.BorderColor;
- PlaceholderColor3 = Library.Options.PlaceholderColor;
- })
- });
- Parent = self.Container;
- });
- local box = check:FindFirstChild(name):FindFirstChild('Box');
- box.FocusLost:connect(function(e)
- local old = location[flag];
- if Type == "number" then
- local num = tonumber(box.Text)
- if (not num) then
- box.Text = tonumber(location[flag])
- else
- location[flag] = math.clamp(num,min,max)
- box.Text = tonumber(location[flag])
- end
- else
- location[flag] = tostring(box.Text)
- end
- callback(location[flag],old,e)
- end)
- if Type == 'number' then
- box:GetPropertyChangedSignal('Text'):connect(function()
- box.Text = string.gsub(box.Text,"[%a + ]","");
- end)
- end
- self:Resize();
- return box
- end
- function types:Bind(name,Options,callback)
- local location = Options.location or self.Flags;
- local keyboardOnly = Options.kbonly or false
- local flag = Options.flag or "";
- local callback = callback or function() end;
- local Default = Options.Default;
- if keyboardOnly and (not tostring(Default):find('MouseButton')) then
- location[flag] = Default
- end
- local banned = {
- Return = true;
- Space = true;
- Tab = true;
- Unknown = true;
- }
- local shortNames = {
- RightControl = 'RightCtrl';
- LeftControl = 'LeftCtrl';
- LeftShift = 'LShift';
- RightShift = 'RShift';
- MouseButton1 = "Mouse1";
- MouseButton2 = "Mouse2";
- }
- local allowed = {
- MouseButton1 = true;
- MouseButton2 = true;
- }
- local nm = (Default and (shortNames[Default.Name] or Default.Name) or "None");
- local check = Library:Create('Frame',{
- BackgroundTransparency = 1;
- Size = UDim2.new(1,0,0,30);
- LayoutOrder = self:GetOrder();
- Library:Create('TextLabel',{
- Name = name;
- Text = "\r" .. name;
- BackgroundTransparency = 1;
- TextColor3 = Library.Options.TextColor;
- Position = UDim2.new(0,5,0,0);
- Size = UDim2.new(1, - 5,1,0);
- TextXAlignment = Enum.TextXAlignment.Left;
- Font = Library.Options.Font;
- TextSize = Library.Options.FontSize;
- TextStrokeTransparency = Library.Options.TextStroke;
- TextStrokeColor3 = Library.Options.StrokeColor;
- BorderColor3 = Library.Options.BorderColor;
- BorderSizePixel = 1;
- Library:Create('TextButton',{
- Name = 'Keybind';
- Text = nm;
- TextStrokeTransparency = Library.Options.TextStroke;
- TextStrokeColor3 = Library.Options.StrokeColor;
- Font = Library.Options.Font;
- TextSize = Library.Options.FontSize;
- Size = UDim2.new(0,60,0,20);
- Position = UDim2.new(1, - 65,0,5);
- TextColor3 = Library.Options.TextColor;
- BackgroundColor3 = Library.Options.BGColor;
- BorderColor3 = Library.Options.BorderColor;
- BorderSizePixel = 1;
- })
- });
- Parent = self.Container;
- });
- local button = check:FindFirstChild(name).Keybind;
- button.MouseButton1Click:connect(function()
- Library.binding = true
- button.Text = "..."
- local a,b = game:GetService('UserInputService').InputBegan:wait();
- local name = tostring(a.KeyCode.Name);
- local typeName = tostring(a.UserInputType.Name);
- if (a.UserInputType ~= Enum.UserInputType.Keyboard and (allowed[a.UserInputType.Name]) and (not keyboardOnly)) or (a.KeyCode and (not banned[a.KeyCode.Name])) then
- local name = (a.UserInputType ~= Enum.UserInputType.Keyboard and a.UserInputType.Name or a.KeyCode.Name);
- location[flag] = (a);
- button.Text = shortNames[name] or name;
- else
- if (location[flag]) then
- if (not pcall(function()
- return location[flag].UserInputType
- end)) then
- local name = tostring(location[flag])
- button.Text = shortNames[name] or name
- else
- local name = (location[flag].UserInputType ~= Enum.UserInputType.Keyboard and location[flag].UserInputType.Name or location[flag].KeyCode.Name);
- button.Text = shortNames[name] or name;
- end
- end
- end
- wait(0.1)
- Library.binding = false;
- end)
- if location[flag] then
- button.Text = shortNames[tostring(location[flag].Name)] or tostring(location[flag].Name)
- end
- Library.Binds[flag] = {
- location = location;
- callback = callback;
- };
- self:Resize();
- end
- function types:Section(name)
- local order = self:GetOrder();
- local determinedSize = UDim2.new(1,0,0,25)
- local determinedPos = UDim2.new(0,0,0,4);
- local secondarySize = UDim2.new(1,0,0,20);
- if order == 0 then
- determinedSize = UDim2.new(1,0,0,21)
- determinedPos = UDim2.new(0,0,0, - 1);
- secondarySize = nil
- end
- local check = Library:Create('Frame',{
- Name = 'Section';
- BackgroundTransparency = 1;
- Size = determinedSize;
- BackgroundColor3 = Library.Options.SectionColor;
- BorderSizePixel = 0;
- LayoutOrder = order;
- Library:Create('TextLabel',{
- Name = 'section_lbl';
- Text = name;
- BackgroundTransparency = 0;
- BorderSizePixel = 0;
- BackgroundColor3 = Library.Options.SectionColor;
- TextColor3 = Library.Options.TextColor;
- Position = determinedPos;
- Size = (secondarySize or UDim2.new(1,0,1,0));
- Font = Library.Options.Font;
- TextSize = Library.Options.FontSize;
- TextStrokeTransparency = Library.Options.TextStroke;
- TextStrokeColor3 = Library.Options.StrokeColor;
- });
- Parent = self.Container;
- });
- self:Resize();
- end
- function types:Slider(name,Options,callback)
- local Default = Options.Default or Options.min;
- local min = Options.min or 0;
- local max = Options.max or 1;
- local location = Options.location or self.Flags;
- local precise = Options.precise or false -- e.g 0,1 vs 0,0.1,0.2,...
- local flag = Options.flag or "";
- local callback = callback or function() end
- location[flag] = Default;
- local check = Library:Create('Frame',{
- BackgroundTransparency = 1;
- Size = UDim2.new(1,0,0,25);
- LayoutOrder = self:GetOrder();
- Library:Create('TextLabel',{
- Name = name;
- TextStrokeTransparency = Library.Options.TextStroke;
- TextStrokeColor3 = Library.Options.StrokeColor;
- Text = "\r" .. name;
- BackgroundTransparency = 1;
- TextColor3 = Library.Options.TextColor;
- Position = UDim2.new(0,5,0,2);
- Size = UDim2.new(1, - 5,1,0);
- TextXAlignment = Enum.TextXAlignment.Left;
- Font = Library.Options.Font;
- TextSize = Library.Options.FontSize;
- Library:Create('Frame',{
- Name = 'Container';
- Size = UDim2.new(0,60,0,20);
- Position = UDim2.new(1, - 65,0,3);
- BackgroundTransparency = 1;
- -- BorderColor3 = Library.Options.BorderColor;
- BorderSizePixel = 0;
- Library:Create('TextLabel',{
- Name = 'ValueLabel';
- Text = Default;
- BackgroundTransparency = 1;
- TextColor3 = Library.Options.TextColor;
- Position = UDim2.new(0, - 10,0,0);
- Size = UDim2.new(0,1,1,0);
- TextXAlignment = Enum.TextXAlignment.Right;
- Font = Library.Options.Font;
- TextSize = Library.Options.FontSize;
- TextStrokeTransparency = Library.Options.TextStroke;
- TextStrokeColor3 = Library.Options.StrokeColor;
- });
- Library:Create('TextButton',{
- Name = 'Button';
- Size = UDim2.new(0,5,1, - 2);
- Position = UDim2.new(0,0,0,1);
- AutoButtonColor = false;
- Text = "";
- BackgroundColor3 = Color3.fromRGB(20,20,20);
- BorderSizePixel = 0;
- ZIndex = 2;
- TextStrokeTransparency = Library.Options.TextStroke;
- TextStrokeColor3 = Library.Options.StrokeColor;
- });
- Library:Create('Frame',{
- Name = 'Line';
- BackgroundTransparency = 0;
- Position = UDim2.new(0,0,0.5,0);
- Size = UDim2.new(1,0,0,1);
- BackgroundColor3 = Library.Options.TextColor;
- BorderSizePixel = 0;
- });
- })
- });
- Parent = self.Container;
- });
- local overlay = check:FindFirstChild(name);
- local renderSteppedConnection;
- local inputBeganConnection;
- local inputEndedConnection;
- local mouseLeaveConnection;
- local mouseDownConnection;
- local mouseUpConnection;
- check:FindFirstChild(name).Container.MouseEnter:connect(function()
- local function update()
- if renderSteppedConnection then renderSteppedConnection:disconnect() end
- renderSteppedConnection = game:GetService('RunService').RenderStepped:connect(function()
- local mouse = game:GetService("UserInputService"):GetMouseLocation()
- local percent = (mouse.X - overlay.Container.AbsolutePosition.X) / (overlay.Container.AbsoluteSize.X)
- percent = math.clamp(percent,0,1)
- percent = tonumber(string.format("%.2f",percent))
- overlay.Container.Button.Position = UDim2.new(math.clamp(percent,0,0.99),0,0,1)
- local num = min + (max - min) * percent
- local value = (precise and num or math.floor(num))
- overlay.Container.ValueLabel.Text = value;
- callback(tonumber(value))
- location[flag] = tonumber(value)
- end)
- end
- local function disconnect()
- if renderSteppedConnection then renderSteppedConnection:disconnect() end
- if inputBeganConnection then inputBeganConnection:disconnect() end
- if inputEndedConnection then inputEndedConnection:disconnect() end
- if mouseLeaveConnection then mouseLeaveConnection:disconnect() end
- if mouseUpConnection then mouseUpConnection:disconnect() end
- end
- inputBeganConnection = check:FindFirstChild(name).Container.InputBegan:connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 then
- update()
- end
- end)
- inputEndedConnection = check:FindFirstChild(name).Container.InputEnded:connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 then
- disconnect()
- end
- end)
- mouseDownConnection = check:FindFirstChild(name).Container.Button.MouseButton1Down:connect(update)
- mouseUpConnection = game:GetService("UserInputService").InputEnded:connect(function(a,b)
- if a.UserInputType == Enum.UserInputType.MouseButton1 and (mouseDownConnection.Connected) then
- disconnect()
- end
- end)
- end)
- if Default ~= min then
- local percent = 1 - ((max - Default) / (max - min))
- local number = Default
- number = tonumber(string.format("%.2f",number))
- if (not precise) then
- number = math.floor(number)
- end
- overlay.Container.Button.Position = UDim2.new(math.clamp(percent,0,0.99),0, 0,1)
- overlay.Container.ValueLabel.Text = number
- end
- self:Resize();
- return {
- Set = function(self,value)
- local percent = 1 - ((max - value) / (max - min))
- local number = value
- number = tonumber(string.format("%.2f",number))
- if (not precise) then
- number = math.floor(number)
- end
- overlay.Container.Button.Position = UDim2.new(math.clamp(percent,0,0.99),0, 0,1)
- overlay.Container.ValueLabel.Text = number
- location[flag] = number
- callback(number)
- end
- }
- end
- function types:SearchBox(text,Options,callback)
- local list = Options.list or {};
- local flag = Options.flag or "";
- local location = Options.location or self.Flags;
- local callback = callback or function() end;
- local busy = false;
- local box = Library:Create('Frame',{
- BackgroundTransparency = 1;
- Size = UDim2.new(1,0,0,25);
- LayoutOrder = self:GetOrder();
- Library:Create('TextBox',{
- Text = "";
- PlaceholderText = text;
- PlaceholderColor3 = Color3.fromRGB(60,60,60);
- Font = Library.Options.Font;
- TextSize = Library.Options.FontSize;
- Name = 'Box';
- Size = UDim2.new(1, - 10,0,20);
- Position = UDim2.new(0,5,0,4);
- TextColor3 = Library.Options.TextColor;
- BackgroundColor3 = Library.Options.DropColor;
- BofrderColor3 = Library.Options.BorderColor;
- TextStrokeTransparency = Library.Options.TextStroke;
- TextStrokeColor3 = Library.Options.StrokeColor;
- Library:Create('ScrollingFrame',{
- Position = UDim2.new(0,0,1,1);
- Name = 'Container';
- BackgroundColor3 = Library.Options.BTNColor;
- ScrollBarThickness = 0;
- BorderSizePixel = 0;
- BorderColor3 = Library.Options.BorderColor;
- Size = UDim2.new(1,0,0,0);
- Library:Create('UIListLayout',{
- Name = 'ListLayout';
- SortOrder = Enum.SortOrder.LayoutOrder;
- });
- ZIndex = 2;
- });
- });
- Parent = self.Container;
- })
- local function rebuild(text)
- box:FindFirstChild('Box').Container.ScrollBarThickness = 0
- for i,child in next,box:FindFirstChild('Box').Container:GetChildren() do
- if (not child:IsA('UIListLayout')) then
- child:Destroy();
- end
- end
- if #text > 0 then
- for i,v in next,list do
- if string.sub(string.lower(v),1,string.len(text)) == string.lower(text) then
- local button = Library:Create('TextButton',{
- Text = v;
- Font = Library.Options.Font;
- TextSize = Library.Options.FontSize;
- TextColor3 = Library.Options.TextColor;
- BorderColor3 = Library.Options.BorderColor;
- TextStrokeTransparency = Library.Options.TextStroke;
- TextStrokeColor3 = Library.Options.StrokeColor;
- Parent = box:FindFirstChild('Box').Container;
- Size = UDim2.new(1,0,0,20);
- LayoutOrder = i;
- BackgroundColor3 = Library.Options.BTNColor;
- ZIndex = 2;
- })
- button.MouseButton1Click:connect(function()
- busy = true;
- box:FindFirstChild('Box').Text = button.Text;
- wait();
- busy = false;
- location[flag] = button.Text;
- callback(location[flag])
- box:FindFirstChild('Box').Container.ScrollBarThickness = 0
- for i,child in next,box:FindFirstChild('Box').Container:GetChildren() do
- if (not child:IsA('UIListLayout')) then
- child:Destroy();
- end
- end
- box:FindFirstChild('Box').Container:TweenSize(UDim2.new(1,0,0,0),'Out','Quint',.3,true)
- end)
- end
- end
- end
- local c = box:FindFirstChild('Box').Container:GetChildren()
- local ry = (20 * (#c)) - 20
- local y = math.clamp((20 * (#c)) - 20,0,100)
- if ry > 100 then
- box:FindFirstChild('Box').Container.ScrollBarThickness = 5;
- end
- box:FindFirstChild('Box').Container:TweenSize(UDim2.new(1,0,0,y),'Out','Quint',.3,true)
- box:FindFirstChild('Box').Container.CanvasSize = UDim2.new(1,0,0,(20 * (#c)) - 20)
- end
- box:FindFirstChild('Box'):GetPropertyChangedSignal('Text'):connect(function()
- if (not busy) then
- rebuild(box:FindFirstChild('Box').Text)
- end
- end);
- local function reload(new_list)
- list = new_list;
- rebuild("")
- end
- self:Resize();
- return reload,box:FindFirstChild('Box');
- end
- function types:Dropdown(name,Options,callback)
- local location = Options.location or self.Flags;
- local flag = Options.flag or "";
- local callback = callback or function() end;
- local list = Options.list or {};
- location[flag] = list[1]
- local check = Library:Create('Frame',{
- BackgroundTransparency = 1;
- Size = UDim2.new(1,0,0,25);
- BackgroundColor3 = Color3.fromRGB(25,25,25);
- BorderSizePixel = 0;
- LayoutOrder = self:GetOrder();
- Library:Create('Frame',{
- Name = 'dropdown_lbl';
- BackgroundTransparency = 0;
- BackgroundColor3 = Library.Options.DropColor;
- Position = UDim2.new(0,5,0,4);
- BorderColor3 = Library.Options.BorderColor;
- Size = UDim2.new(1, - 10,0,20);
- Library:Create('TextLabel',{
- Name = 'Selection';
- Size = UDim2.new(1,0,1,0);
- Text = list[1];
- TextColor3 = Library.Options.TextColor;
- BackgroundTransparency = 1;
- Font = Library.Options.Font;
- TextSize = Library.Options.FontSize;
- TextStrokeTransparency = Library.Options.TextStroke;
- TextStrokeColor3 = Library.Options.StrokeColor;
- });
- Library:Create("TextButton",{
- Name = 'drop';
- BackgroundTransparency = 1;
- Size = UDim2.new(0,20,1,0);
- Position = UDim2.new(1, - 25,0,0);
- Text = 'v';
- TextColor3 = Library.Options.TextColor;
- Font = Library.Options.Font;
- TextSize = Library.Options.FontSize;
- TextStrokeTransparency = Library.Options.TextStroke;
- TextStrokeColor3 = Library.Options.StrokeColor;
- })
- });
- Parent = self.Container;
- });
- local button = check:FindFirstChild('dropdown_lbl').drop;
- local input;
- button.MouseButton1Click:connect(function()
- if (input and input.Connected) then
- return
- end
- check:FindFirstChild('dropdown_lbl'):WaitForChild('Selection').TextColor3 = Color3.fromRGB(60,60,60);
- check:FindFirstChild('dropdown_lbl'):WaitForChild('Selection').Text = name;
- local c = 0;
- for i,v in next,list do
- c = c + 20;
- end
- local size = UDim2.new(1,0,0,c)
- local clampedSize;
- local scrollSize = 0;
- if size.Y.Offset > 100 then
- clampedSize = UDim2.new(1,0,0,100)
- scrollSize = 5;
- end
- local goSize = (clampedSize ~= nil and clampedSize) or size;
- local Container = Library:Create('ScrollingFrame',{
- TopImage = 'rbxasset: / / textures / ui / Scroll / scroll - middle.png';
- BottomImage = 'rbxasset: / / textures / ui / Scroll / scroll - middle.png';
- Name = 'DropContainer';
- Parent = check:FindFirstChild('dropdown_lbl');
- Size = UDim2.new(1,0,0,0);
- BackgroundColor3 = Library.Options.BGColor;
- BorderColor3 = Library.Options.BorderColor;
- Position = UDim2.new(0,0,1,0);
- ScrollBarThickness = scrollSize;
- CanvasSize = UDim2.new(0,0,0,size.Y.Offset);
- ZIndex = 5;
- ClipsDescendants = true;
- Library:Create('UIListLayout',{
- Name = 'List';
- SortOrder = Enum.SortOrder.LayoutOrder
- })
- })
- for i,v in next,list do
- local btn = Library:Create('TextButton',{
- Size = UDim2.new(1,0,0,20);
- BackgroundColor3 = Library.Options.BTNColor;
- BorderColor3 = Library.Options.BorderColor;
- Text = v;
- Font = Library.Options.Font;
- TextSize = Library.Options.FontSize;
- LayoutOrder = i;
- Parent = Container;
- ZIndex = 5;
- TextColor3 = Library.Options.TextColor;
- TextStrokeTransparency = Library.Options.TextStroke;
- TextStrokeColor3 = Library.Options.StrokeColor;
- })
- btn.MouseButton1Click:connect(function()
- check:FindFirstChild('dropdown_lbl'):WaitForChild('Selection').TextColor3 = Library.Options.TextColor
- check:FindFirstChild('dropdown_lbl'):WaitForChild('Selection').Text = btn.Text;
- location[flag] = tostring(btn.Text);
- callback(location[flag])
- game:GetService('Debris'):AddItem(Container,0)
- input:disconnect();
- end)
- end
- Container:TweenSize(goSize,'Out','Quint',.3,true)
- local function isInGui(frame)
- local mloc = game:GetService('UserInputService'):GetMouseLocation();
- local mouse = Vector2.new(mloc.X,mloc.Y - 36);
- local x1,x2 = frame.AbsolutePosition.X,frame.AbsolutePosition.X + frame.AbsoluteSize.X;
- local y1,y2 = frame.AbsolutePosition.Y,frame.AbsolutePosition.Y + frame.AbsoluteSize.Y;
- return (mouse.X >= x1 and mouse.X <= x2) and (mouse.Y >= y1 and mouse.Y <= y2)
- end
- input = game:GetService('UserInputService').InputBegan:connect(function(a)
- if a.UserInputType == Enum.UserInputType.MouseButton1 and (not isInGui(Container)) then
- check:FindFirstChild('dropdown_lbl'):WaitForChild('Selection').TextColor3 = Library.Options.TextColor
- check:FindFirstChild('dropdown_lbl'):WaitForChild('Selection').Text = location[flag];
- Container:TweenSize(UDim2.new(1,0,0,0),'In','Quint',.3,true)
- wait(0.15)
- game:GetService('Debris'):AddItem(Container,0)
- input:disconnect();
- end
- end)
- end)
- self:Resize();
- local function reload(self,array)
- Options = array;
- location[flag] = array[1];
- pcall(function()
- input:disconnect()
- end)
- check:WaitForChild('dropdown_lbl').Selection.Text = location[flag]
- check:FindFirstChild('dropdown_lbl'):WaitForChild('Selection').TextColor3 = Library.Options.TextColor
- pcall(function() game:GetService('Debris'):AddItem(Container,0) end);
- end
- return {
- Refresh = reload;
- }
- end
- end
- function Library:Create(class,data)
- local obj = Instance.new(class);
- for i,v in next,data do
- if i ~= 'Parent' then
- if typeof(v) == "Instance" then
- v.Parent = obj;
- else
- obj[i] = v
- end
- end
- end
- obj.Parent = data.Parent;
- return obj
- end
- Default = {
- TopColor = Color3.fromRGB(30,30,30);
- TitleColor = Color3.fromRGB(255,255,255);
- UnderlineColor = Color3.fromRGB(0,255,140);
- BGColor = Color3.fromRGB(35,35,35);
- BoxColor = Color3.fromRGB(35,35,35);
- BTNColor = Color3.fromRGB(25,25,25);
- DropColor = Color3.fromRGB(25,25,25);
- SectionColor = Color3.fromRGB(25,25,25);
- BorderColor = Color3.fromRGB(60,60,60);
- Font = Enum.Font.SourceSans;
- TitleFont = Enum.Font.Code;
- FontSize = 17;
- TitleSize = 18;
- TextStroke = 1;
- TitleStroke = 1;
- StrokeColor = Color3.fromRGB(0,0,0);
- TextColor = Color3.fromRGB(255,255,255);
- TitleTextColor = Color3.fromRGB(255,255,255);
- PlaceholderColor = Color3.fromRGB(255,255,255);
- TitleStrokeColor = Color3.fromRGB(0,0,0);
- }
- function Library:CreateWindow(name,Options)
- if (not Library.Container) then
- Library.Container = self:Create("ScreenGui",{
- self:Create('Frame',{
- Name = 'Container';
- Size = UDim2.new(1, - 30,1,0);
- Position = UDim2.new(0,20,0,20);
- BackgroundTransparency = 1;
- Active = false;
- });
- Parent = game:GetService("CoreGui");
- }):FindFirstChild('Container');
- end
- if (not Library.Options) then
- Library.Options = setmetatable(Options or {},{__index = Defaults})
- end
- if (Options) then
- Library.Options = setmetatable(Options,{__index = Default})
- end
- local window = types.window(name,Library.Options);
- Dragger.new(window.Object);
- return window
- end
- Library.Options = setmetatable({},{__index = Default})
- spawn(function()
- while true do
- for i = 0,1,1 / 300 do
- for _,obj in next,Library.RainbowTable do
- obj.BackgroundColor3 = Color3.fromHSV(i,1,1);
- end
- wait()
- end;
- end
- end)
- local function isreallypressed(bind,inp)
- local key = bind
- if typeof(key) == "Instance" then
- if key.UserInputType == Enum.UserInputType.Keyboard and inp.KeyCode == key.KeyCode then
- return true;
- elseif tostring(key.UserInputType):find('MouseButton') and inp.UserInputType == key.UserInputType then
- return true
- end
- end
- if tostring(key):find'MouseButton1' then
- return key == inp.UserInputType
- else
- return key == inp.KeyCode
- end
- end
- game:GetService("UserInputService").InputBegan:connect(function(input)
- if (not Library.binding) then
- for idx,Binds in next,Library.Binds do
- local real_binding = Binds.location[idx];
- if real_binding and isreallypressed(real_binding,input) then
- Binds.callback()
- end
- end
- end
- end)
- end
- return Library
Advertisement
Add Comment
Please, Sign In to add comment