Advertisement
Vzurxy

shouxlib v2

Nov 12th, 2019
355
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 33.57 KB | None | 0 0
  1. --[[
  2.     local mainMenu = ShouxLib:new([string] title, [color3] backgroundColor, [color3] textColor)
  3.         This function returns a table with other methods.
  4.             title is the title of the category
  5.             backgroundColor is the background color of the category when you click the category menu
  6.             textColor is the text color of the category when you click the category menu
  7.  
  8.     mainMenu:newBtn([string] title, [function] callback, [boolean] noToggle)
  9.         This function creates a button that will call the function you give it in the second argument. If noToggle is nil then your button will be a toggle. If noToggle is true then your button will not be a toggle.
  10.             title is the title of the button
  11.             callback is the callback function of the button
  12.             (optional) noToggle is if the button will be togglable or not
  13.    
  14.     mainMenu:newSlider([string] title, [function] callback, [number] min, [number] max, [number] startPoint)
  15.         This function creates a slider that will call the function you give it in the second argument when the slider is slid.
  16.             title is the title of the slider
  17.             min is the minimum number the slider can move to
  18.             max is the maximum number the slider can move to
  19.             (optional) startPoint is the starting point of where the slider is. This number goes from 0 to max. Keep in mind thatit uses mapping formula and it's not precise. If startPoint is nil then it will use 0.
  20.    
  21.     mainMenu:newBind([string] title, [function] callback, [keycode] presetKeyCode)
  22.         This function creates a keybind button that will call the function you give it in the second argument when the chosen key is pressed.
  23.             title is the title of the button
  24.             callback is the callback function of the button
  25.             (optional) presetKeyCode is the preset key of the keybind
  26.  
  27.     mainMenu:newDropdown([string] title, [function] callback, [table] list)
  28.         This function creates a dropdown that will call the function you give it in the second argument when an item from the list is chosen.
  29.             title is the title of the button
  30.             callback is the callback function of the dropdown
  31.             list is the items in the dropdown
  32.  
  33.     mainMenu:newColorPicker([string] title, [function] callback, [color3] presetColor)
  34.         This function creates a color picker button that will call the function you give it in the second argument when a new color is chosen.
  35.             title is the title of the button
  36.             callback is the callback function of the color picker
  37.             (optional) presetColor is the preset color of the color picker
  38.  
  39.     functon ShouxLib:SetCategory([table] category)
  40.         This function will set the current viewing category to "[table] category"
  41.        
  42.        
  43.     This is a gui using every function:
  44.  
  45.         local ShouxLib = loadstring(game:HttpGetAsync("https://pastebin.com/raw/aWJeXMN3"))()
  46.         local main = ShouxLib:new("test", Color3.fromRGB(25, 25, 25), Color3.fromRGB(192, 0, 199));
  47.         main:newBtn("hi", function(enabled) print("enabled: " .. tostring(enabled)); end);
  48.         main:newSlider("bye", function(value) print("value: " .. tostring(value)); end, 70, 120, 0);
  49.         main:newBind("test", function(enabled) print("enabled: " .. tostring(enabled)); end);
  50.         main:newColorPicker("tesaaat", function(color)
  51.             print(color); -- Color3.new()
  52.             local r, g, b = color.r * 255, color.g * 255, color.b * 255;
  53.             warn(r, g, b);
  54.             local rgbColor = Color3.fromRGB(r, g, b) -- Color3.fromRGB()
  55.         end, Color3.fromRGB(52, 235, 177));
  56.         local main2 = ShouxLib:new("test2", Color3.fromRGB(25, 25, 25), Color3.fromRGB(80, 199, 0));
  57.         main2:newBtn("hi", function() print("hi"); end, true);
  58.         main2:newSlider("bye", function(value) print("value: " .. tostring(value)); end, 70, 120, 80);
  59.         main2:newSlider("bye", function(value) print("value: " .. tostring(value)); end, 70, 120);
  60.         main2:newDropdown("hi", function(choice) print("choice: " .. choice); end, {"hi", "bye"});
  61.         main2:newColorPicker("tesaaat", function(color)
  62.             print(color); -- Color3.new()
  63.             local r, g, b = color.r * 255, color.g * 255, color.b * 255;
  64.             warn(r, g, b);
  65.             local rgbColor = Color3.fromRGB(r, g, b) -- Color3.fromRGB()
  66.         end);
  67.         main2:newBind("hide gui", function() ShouxLibGui.Enabled = not ShouxLibGui.Enabled; end, Enum.KeyCode.P);
  68.  
  69.         ShouxLib:SetCategory(main);
  70. ]]
  71.  
  72. local dragging = false;
  73. local draggableStart;
  74. local startPos;
  75.  
  76. local ShouxLibGui = Instance.new("ScreenGui", game:GetService("CoreGui"));
  77. local mainFrame = Instance.new("Frame", ShouxLibGui);
  78. local UIAspectRatioConstraint = Instance.new("UIAspectRatioConstraint", mainFrame);
  79. local titleLabel = Instance.new("TextLabel", mainFrame);
  80. local categoryFrame = Instance.new("Frame", mainFrame);
  81. local categoryBodyFrame = Instance.new("Frame", mainFrame);
  82. local categoryListLayout = Instance.new("UIListLayout", categoryBodyFrame);
  83. local topPaddingFrame = Instance.new("Frame", mainFrame);
  84. local backgroundFrame = Instance.new("Frame", mainFrame);
  85. local bodyFrames = {};
  86.  
  87. ShouxLibGui.Name = "ShouxLibGui";
  88.  
  89. mainFrame.Name = "mainFrame";
  90. mainFrame.BackgroundColor3 = Color3.fromRGB(30, 30, 30);
  91. mainFrame.BorderSizePixel = 0;
  92. mainFrame.Position = UDim2.new(0.018, 0, 0.02, 0);
  93. mainFrame.Size = UDim2.new(0.257, 0, 0.042, 0);
  94.  
  95. UIAspectRatioConstraint.AspectRatio = 7.514;
  96.  
  97. titleLabel.Name = "titleLabel";
  98. titleLabel.AnchorPoint = Vector2.new(0, 0.5);
  99. titleLabel.BackgroundTransparency = 1;
  100. titleLabel.BorderSizePixel = 0;
  101. titleLabel.Position = UDim2.new(0, 0, 0.5, 0);
  102. titleLabel.Size = UDim2.new(1, 0, 0.8, 0);
  103. titleLabel.Font = Enum.Font.GothamBold;
  104. titleLabel.Text = "N/A";
  105. titleLabel.TextColor3 = Color3.fromRGB(255, 255, 255);
  106. titleLabel.TextScaled = true;
  107. titleLabel.TextWrapped = true;
  108.  
  109. categoryFrame.Name = "categoryFrame";
  110. categoryFrame.BackgroundColor3 = Color3.fromRGB(50, 50, 50);
  111. categoryFrame.BorderSizePixel = 0;
  112. categoryFrame.Position = UDim2.new(0, 0, 1, 0);
  113. categoryFrame.Size = UDim2.new(1, 0, 0, 0);
  114. categoryFrame.Visible = false;
  115. categoryFrame.ZIndex = 3;
  116.  
  117. categoryBodyFrame.Name = "categoryBodyFrame";
  118. categoryBodyFrame.BackgroundTransparency = 1;
  119. categoryBodyFrame.BorderSizePixel = 0;
  120. categoryBodyFrame.Position = UDim2.new(0, 0, 1, 0);
  121. categoryBodyFrame.Size = UDim2.new(1, 0, 0, 0);
  122. categoryBodyFrame.Visible = false;
  123. categoryBodyFrame.ZIndex = 3;
  124.  
  125. categoryListLayout.SortOrder = Enum.SortOrder.LayoutOrder;
  126. categoryListLayout.Padding = UDim.new(0, 0);
  127.  
  128. topPaddingFrame.Name = "topPaddingFrame";
  129. topPaddingFrame.BackgroundColor3 = Color3.fromRGB(38, 38, 38);
  130. topPaddingFrame.BorderSizePixel = 0;
  131. topPaddingFrame.Position = UDim2.new(0, 0, 1, 0);
  132. topPaddingFrame.Size = UDim2.new(1, 0, 0.08, 0);
  133.  
  134. backgroundFrame.Name = "backgroundFrame";
  135. backgroundFrame.BackgroundColor3 = Color3.fromRGB(38, 38, 38);
  136. backgroundFrame.BorderSizePixel = 0;
  137. backgroundFrame.Position = UDim2.new(0, 0, 1.08, 0);
  138. backgroundFrame.Size = UDim2.new(1, 0, 0, 0);
  139.  
  140. mainFrame.InputBegan:Connect(function(input)
  141.     if input.UserInputType == Enum.UserInputType.MouseButton2 then
  142.         if not categoryFrame.Visible then
  143.             categoryFrame.Visible = true;
  144.             categoryBodyFrame.Visible = true;
  145.  
  146.             categoryFrame:TweenSize(UDim2.new(1, 0, (#categoryBodyFrame:GetChildren() - 1), 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.2, true);
  147.             categoryBodyFrame:TweenSize(UDim2.new(1, 0, 1.3, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.2, true);
  148.         elseif categoryFrame.Visible then
  149.             categoryFrame:TweenSize(UDim2.new(1, 0, 0, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.2, true);
  150.             categoryBodyFrame:TweenSize(UDim2.new(1, 0, 0, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.2, true);
  151.             wait(0.15);
  152.             categoryFrame.Visible = false;
  153.             categoryBodyFrame.Visible = false;
  154.         end;
  155.     elseif input.UserInputType == Enum.UserInputType.MouseButton1 then
  156.         dragging = true;
  157.         draggableStart = input.Position;
  158.         startPos = mainFrame.AbsolutePosition;
  159.     elseif input.UserInputType == Enum.UserInputType.MouseMovement then
  160.         game:GetService("TweenService"):Create(mainFrame, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundColor3 = Color3.fromRGB(25, 25, 25)}):Play();
  161.     end;
  162. end);
  163.  
  164. mainFrame.InputEnded:Connect(function(input)
  165.     if input.UserInputType == Enum.UserInputType.MouseButton1 then
  166.         dragging = false;
  167.     elseif input.UserInputType == Enum.UserInputType.MouseMovement then
  168.         game:GetService("TweenService"):Create(mainFrame, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundColor3 = Color3.fromRGB(30, 30, 30)}):Play();
  169.     end;
  170. end);
  171.  
  172. game:GetService("UserInputService").InputChanged:Connect(function(input)
  173.     if input.UserInputType == Enum.UserInputType.MouseMovement and dragging then
  174.         local res = ShouxLibGui.AbsoluteSize;
  175.         mainFrame.Position = UDim2.new((startPos.X / res.X) + ((input.Position.X / res.X) - (draggableStart.X / res.X)), 0, (startPos.Y / res.Y) + ((input.Position.Y / res.Y) - (draggableStart.Y / res.Y)), 0);
  176.     end;
  177. end);
  178.  
  179. local ShouxLib = {Content = {}};
  180.  
  181. function ShouxLib:SetCategory(category)
  182.     titleLabel.Text = category.title;
  183.     for i, v in pairs(bodyFrames) do
  184.         v.Visible = false;
  185.     end;
  186.     local category = bodyFrames[category.title .. "BodyFrame"];
  187.     category.Visible = true;
  188.     backgroundFrame.Size = UDim2.new(1, 0, (#category:GetChildren() - 1) * 1.06, 0);
  189.  
  190.     categoryFrame:TweenSize(UDim2.new(1, 0, 0, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.2, true);
  191.     categoryBodyFrame:TweenSize(UDim2.new(1, 0, 0, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.2, true);
  192.     wait(0.15);
  193.     categoryFrame.Visible = false;
  194.     categoryBodyFrame.Visible = false;
  195. end;
  196.  
  197. function ShouxLib.Content:initBtnEffect(btn)
  198.     btn.InputBegan:Connect(function(input)
  199.         if input.UserInputType == Enum.UserInputType.MouseMovement then
  200.             game:GetService("TweenService"):Create(btn, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundColor3 = Color3.fromRGB(67, 67, 67)}):Play();
  201.         end;
  202.     end);
  203.  
  204.     btn.InputEnded:Connect(function(input)
  205.         if input.UserInputType == Enum.UserInputType.MouseMovement then
  206.             game:GetService("TweenService"):Create(btn, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundColor3 = Color3.fromRGB(50, 50, 50)}):Play();
  207.         end;
  208.     end);
  209. end;
  210.  
  211. function ShouxLib.Content:Ripple(btn)
  212.     spawn(function()
  213.         local mouse = game:GetService("Players").LocalPlayer:GetMouse();
  214.         local rippleEffect = Instance.new("ImageLabel", btn);
  215.         local rippleEffectInner = Instance.new("ImageLabel", rippleEffect);
  216.         rippleEffect.Name = "rippleEffect";
  217.         rippleEffect.BackgroundTransparency = 1;
  218.         rippleEffect.BorderSizePixel = 0;
  219.         rippleEffect.Image = "rbxassetid://2708891598";
  220.         rippleEffect.ImageColor3 = Color3.fromRGB(244, 244, 244);
  221.         rippleEffect.ImageTransparency = 0.7;
  222.         rippleEffect.ScaleType = Enum.ScaleType.Fit;
  223.         rippleEffectInner.Name = "rippleEffect";
  224.         rippleEffectInner.AnchorPoint = Vector2.new(0.5, 0.5);
  225.         rippleEffectInner.BackgroundTransparency = 1;
  226.         rippleEffectInner.BorderSizePixel = 0;
  227.         rippleEffectInner.Position = UDim2.new(0.5, 0, 0.5, 0);
  228.         rippleEffectInner.Size = UDim2.new(0.93, 0, 0.93, 0);
  229.         rippleEffectInner.Image = "rbxassetid://2708891598";
  230.         rippleEffectInner.ImageColor3 = Color3.fromRGB(45, 45, 45);
  231.         rippleEffectInner.ImageTransparency = 0.7;
  232.         rippleEffectInner.ScaleType = Enum.ScaleType.Fit;
  233.         rippleEffect.Position = UDim2.new((mouse.X - rippleEffect.AbsolutePosition.X) / btn.AbsoluteSize.X, 0, (mouse.Y - rippleEffect.AbsolutePosition.Y) / btn.AbsoluteSize.Y, 0);
  234.         rippleEffect:TweenSizeAndPosition(UDim2.new(10, 0, 10, 0), UDim2.new(-4.5, 0, -4.5, 0), "Out", "Quad", 0.33);
  235.         for i = 1, 10 do
  236.             rippleEffect.ImageTransparency = rippleEffect.ImageTransparency + 0.01;
  237.             wait();
  238.         end;
  239.         rippleEffect:Destroy();
  240.     end)
  241. end;
  242.  
  243. function ShouxLib:new(title, backgroundColor, textColor)
  244.     local self = setmetatable({}, {__index = self.Content});
  245.  
  246.     self.title = title;
  247.     self.bodyFrame = Instance.new("Frame", mainFrame);
  248.     local bodyListLayout = Instance.new("UIListLayout", self.bodyFrame);
  249.     local categoryBtn = Instance.new("TextButton", categoryBodyFrame);
  250.  
  251.     bodyFrames[title .. "BodyFrame"] = self.bodyFrame;
  252.  
  253.     self.bodyFrame.Name = title .. "BodyFrame";
  254.     self.bodyFrame.BackgroundTransparency = 1;
  255.     self.bodyFrame.BorderSizePixel = 0;
  256.     self.bodyFrame.Position = UDim2.new(0, 0, 1.08, 0);
  257.     self.bodyFrame.Size = UDim2.new(1, 0, 1, 0);
  258.     self.bodyFrame.Visible = false;
  259.  
  260.     bodyListLayout.SortOrder = Enum.SortOrder.LayoutOrder;
  261.     bodyListLayout.Padding = UDim.new(0.16, 0);
  262.  
  263.     categoryBtn.Name = "categoryBtn";
  264.     categoryBtn.BackgroundColor3 = backgroundColor or Color3.fromRGB(25, 25, 25);
  265.     categoryBtn.BorderSizePixel = 0;
  266.     categoryBtn.AutoButtonColor = false;
  267.     categoryBtn.Size = UDim2.new(1, 0, 1, 0);
  268.     categoryBtn.Font = Enum.Font.SourceSansLight;
  269.     categoryBtn.Text = string.upper(title);
  270.     categoryBtn.TextColor3 = textColor or Color3.fromRGB(255, 255, 255);
  271.     categoryBtn.TextScaled = true;
  272.     categoryBtn.TextWrapped = true;
  273.     categoryBtn.ZIndex = 3;
  274.     categoryBtn.MouseButton1Click:Connect(function()
  275.         ShouxLib:SetCategory(self);
  276.     end);
  277.  
  278.     return self;
  279. end;
  280.  
  281. function ShouxLib.Content:newBtn(title, callback, noToggle)
  282.     local enabled = false;
  283.     local btn = Instance.new("TextButton", self.bodyFrame);
  284.     local titleLabel = Instance.new("TextLabel", btn);
  285.     local sideFrame = Instance.new("Frame", btn);
  286.     local statusFrame = Instance.new("Frame", sideFrame);
  287.  
  288.     btn.Name = "btn";
  289.     btn.BackgroundColor3 = Color3.fromRGB(50, 50, 50);
  290.     btn.BorderSizePixel = 0;
  291.     btn.Size = UDim2.new(1, 0, 0.9, 0);
  292.     btn.AutoButtonColor = false;
  293.     btn.Font = Enum.Font.SourceSansLight;
  294.     btn.Text = "";
  295.     btn.TextScaled = true;
  296.     btn.TextWrapped = true;
  297.     btn.ClipsDescendants = true;
  298.  
  299.     titleLabel.Name = "titleLabel";
  300.     titleLabel.AnchorPoint = Vector2.new(0, 0.5);
  301.     titleLabel.BackgroundTransparency = 1;
  302.     titleLabel.BorderSizePixel = 0;
  303.     titleLabel.Position = UDim2.new(0.02, 0, 0.5, 0);
  304.     titleLabel.Size = UDim2.new(0.98, 0, 1, 0);
  305.     titleLabel.Font = Enum.Font.SourceSansLight;
  306.     titleLabel.Text = title;
  307.     titleLabel.TextColor3 = Color3.fromRGB(255, 255, 255);
  308.     titleLabel.TextScaled = true;
  309.     titleLabel.TextWrapped = true;
  310.     titleLabel.TextXAlignment = Enum.TextXAlignment.Left;
  311.  
  312.     if not noToggle then
  313.         sideFrame.Name = "sideFrame";
  314.         sideFrame.AnchorPoint = Vector2.new(1, 0);
  315.         sideFrame.BackgroundColor3 = Color3.fromRGB(63, 63, 63);
  316.         sideFrame.BorderSizePixel = 0;
  317.         sideFrame.Position = UDim2.new(1, 0, 0, 0);
  318.         sideFrame.Size = UDim2.new(0.223, 0, 1, 0);
  319.  
  320.         statusFrame.Name = "statusFrame";
  321.         statusFrame.AnchorPoint = Vector2.new(0.5, 0.5);
  322.         statusFrame.BackgroundColor3 = Color3.fromRGB(180, 0, 0);
  323.         statusFrame.BorderSizePixel = 0;
  324.         statusFrame.Position = UDim2.new(0.5, 0, 0.5, 0);
  325.         statusFrame.Size = UDim2.new(0.85, 0, 0.79, 0);
  326.     end;
  327.  
  328.     self:initBtnEffect(btn);
  329.  
  330.     btn.MouseButton1Click:Connect(function()
  331.         self:Ripple(btn);
  332.         enabled = not enabled;
  333.         if not noToggle then
  334.             if enabled then
  335.                 game:GetService("TweenService"):Create(statusFrame, TweenInfo.new(0.33, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundColor3 = Color3.fromRGB(0, 194, 94)}):Play();
  336.             elseif not enabled then
  337.                 game:GetService("TweenService"):Create(statusFrame, TweenInfo.new(0.33, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundColor3 = Color3.fromRGB(180, 0, 0)}):Play();
  338.             end;
  339.         end;
  340.         callback(enabled);
  341.     end);
  342. end;
  343.  
  344. function ShouxLib.Content:newSlider(title, callback, min, max, startPoint)
  345.     local dragging = false;
  346.     local sliderFrame = Instance.new("Frame", self.bodyFrame);
  347.     local slidingFrame = Instance.new("Frame", sliderFrame);
  348.     local titleLabel = Instance.new("TextLabel", sliderFrame);
  349.  
  350.     sliderFrame.Name = "sliderFrame";
  351.     sliderFrame.BackgroundColor3 = Color3.fromRGB(50, 50, 50);
  352.     sliderFrame.BorderSizePixel = 0;
  353.     sliderFrame.Size = UDim2.new(1, 0, 0.9, 0);
  354.  
  355.     slidingFrame.Name = "slidingFrame";
  356.     slidingFrame.BackgroundColor3 = Color3.fromRGB(68, 68, 68);
  357.     slidingFrame.BorderSizePixel = 0;
  358.     slidingFrame.Size = UDim2.new((startPoint or 0) / max, 0, 1, 0);
  359.  
  360.     titleLabel.Name = "titleLabel";
  361.     titleLabel.AnchorPoint = Vector2.new(0, 0.5);
  362.     titleLabel.BackgroundTransparency = 1;
  363.     titleLabel.BorderSizePixel = 0;
  364.     titleLabel.Position = UDim2.new(0.02, 0, 0.5, 0);
  365.     titleLabel.Size = UDim2.new(0.98, 0, 1, 0);
  366.     titleLabel.Font = Enum.Font.SourceSansLight;
  367.     titleLabel.Text = title .. " | " .. tostring(startPoint and math.floor((startPoint / max) * (max - min) + min) or 0);
  368.     titleLabel.TextColor3 = Color3.fromRGB(255, 255, 255);
  369.     titleLabel.TextScaled = true;
  370.     titleLabel.TextWrapped = true;
  371.     titleLabel.TextXAlignment = Enum.TextXAlignment.Left;
  372.  
  373.     local function slide(input)
  374.         local pos = UDim2.new(math.clamp((input.Position.X - sliderFrame.AbsolutePosition.X) / sliderFrame.AbsoluteSize.X, 0, 1), 0, 1, 0);
  375.         slidingFrame:TweenSize(pos, Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.2, true);
  376.         local value = math.floor(((pos.X.Scale * max) / max) * (max - min) + min);
  377.         titleLabel.Text = title .. " | " .. tostring(value);
  378.         callback(value);
  379.     end;
  380.  
  381.     sliderFrame.InputBegan:Connect(function(input)
  382.         if input.UserInputType == Enum.UserInputType.MouseButton1 then
  383.             dragging = true;
  384.         end;
  385.     end);
  386.    
  387.     sliderFrame.InputEnded:Connect(function(input)
  388.         if input.UserInputType == Enum.UserInputType.MouseButton1 then
  389.             dragging = false;
  390.         end;
  391.     end);
  392.    
  393.     sliderFrame.InputBegan:Connect(function(input)
  394.         if input.UserInputType == Enum.UserInputType.MouseButton1 then
  395.             slide(input);
  396.         end;
  397.     end);
  398.  
  399.     game:GetService("UserInputService").InputChanged:Connect(function(input)
  400.         if dragging and input.UserInputType == Enum.UserInputType.MouseMovement then
  401.             slide(input);
  402.         end;
  403.     end);
  404. end;
  405.  
  406. function ShouxLib.Content:newBind(title, callback, presetKeyCode)
  407.     local enabled = false;
  408.     local listening = false;
  409.     local activated = presetKeyCode and true or false;
  410.     local keyCode = presetKeyCode;
  411.     local bindFrame = Instance.new("Frame", self.bodyFrame);
  412.     local bindBtn = Instance.new("TextButton", bindFrame);
  413.     local titleLabel = Instance.new("TextLabel", bindFrame);
  414.  
  415.     bindFrame.Name = "bindFrame";
  416.     bindFrame.BackgroundColor3 = Color3.fromRGB(50, 50, 50);
  417.     bindFrame.BorderSizePixel = 0;
  418.     bindFrame.Size = UDim2.new(1, 0, 0.9, 0);
  419.  
  420.     bindBtn.Name = "bindBtn";
  421.     bindBtn.AnchorPoint = Vector2.new(1, 0);
  422.     bindBtn.BackgroundColor3 = Color3.fromRGB(63, 63, 63);
  423.     bindBtn.BorderSizePixel = 0;
  424.     bindBtn.Position = UDim2.new(1, 0, 0, 0);
  425.     bindBtn.Size = UDim2.new(0.206, 0, 1, 0);
  426.     bindBtn.AutoButtonColor = false;
  427.     bindBtn.Font = Enum.Font.SourceSansItalic;
  428.     bindBtn.Text = presetKeyCode and tostring(string.char(presetKeyCode.Value)) or "KEY";
  429.     bindBtn.TextColor3 = Color3.fromRGB(255, 255, 255);
  430.     bindBtn.TextScaled = true;
  431.     bindBtn.TextWrapped = true;
  432.  
  433.     titleLabel.Name = "titleLabel";
  434.     titleLabel.AnchorPoint = Vector2.new(0, 0.5);
  435.     titleLabel.BackgroundTransparency = 1
  436.     titleLabel.BorderSizePixel = 0
  437.     titleLabel.Position = UDim2.new(0.02, 0, 0.5, 0);
  438.     titleLabel.Size = UDim2.new(0.98, 0, 1, 0);
  439.     titleLabel.Font = Enum.Font.SourceSansLight;
  440.     titleLabel.Text = title;
  441.     titleLabel.TextColor3 = Color3.fromRGB(255, 255, 255);
  442.     titleLabel.TextScaled = true;
  443.     titleLabel.TextWrapped = true;
  444.     titleLabel.TextXAlignment = Enum.TextXAlignment.Left;
  445.  
  446.     game:GetService("UserInputService").InputBegan:Connect(function(input, onGui)
  447.         if onGui then return; end;
  448.  
  449.         if listening and not activated then
  450.             pcall(function()
  451.                 bindBtn.Text = tostring(string.char(input.KeyCode.Value));
  452.                 listening = false;
  453.                 keyCode = input.KeyCode;
  454.                 activated = true;
  455.             end);
  456.         elseif activated and not listening and input.KeyCode == keyCode then
  457.             enabled = not enabled;
  458.            
  459.             callback(enabled);
  460.         end;
  461.     end);
  462.  
  463.     bindBtn.MouseButton1Click:Connect(function()
  464.         bindBtn.Text = "...";
  465.  
  466.         activated = false;
  467.         listening = true;
  468.     end);
  469. end;
  470.  
  471. function ShouxLib.Content:newDropdown(title, callback, list)
  472.     local dropdownBtn = Instance.new("TextButton", self.bodyFrame);
  473.     local titleLabel = Instance.new("TextLabel", dropdownBtn);
  474.     local dropdownImage = Instance.new("ImageLabel", dropdownBtn);
  475.     local topPaddingFrame = Instance.new("Frame", dropdownBtn);
  476.     local dropdownFrame = Instance.new("Frame", dropdownBtn);
  477.     local bodyFrame = Instance.new("Frame", dropdownBtn);
  478.     local UIListLayout = Instance.new("UIListLayout", bodyFrame);
  479.  
  480.     dropdownBtn.Name = "dropdownBtn";
  481.     dropdownBtn.BackgroundColor3 = Color3.fromRGB(50, 50, 50);
  482.     dropdownBtn.BorderSizePixel = 0;
  483.     dropdownBtn.Size = UDim2.new(1, 0, 0.9, 0);
  484.     dropdownBtn.AutoButtonColor = false;
  485.     dropdownBtn.Font = Enum.Font.SourceSansLight;
  486.     dropdownBtn.Text = "";
  487.     dropdownBtn.TextScaled = true;
  488.     dropdownBtn.TextWrapped = true;
  489.  
  490.     titleLabel.Name = "titleLabel";
  491.     titleLabel.AnchorPoint = Vector2.new(0.5, 0.5);
  492.     titleLabel.BackgroundTransparency = 1;
  493.     titleLabel.BorderSizePixel = 0;
  494.     titleLabel.Position = UDim2.new(0.5, 0, 0.5, 0);
  495.     titleLabel.Size = UDim2.new(0.98, 0, 1, 0);
  496.     titleLabel.Font = Enum.Font.SourceSansLight;
  497.     titleLabel.Text = title;
  498.     titleLabel.TextColor3 = Color3.fromRGB(255, 255, 255);
  499.     titleLabel.TextScaled = true;
  500.     titleLabel.TextWrapped = true;
  501.  
  502.     dropdownImage.Name = "dropdownImage";
  503.     dropdownImage.AnchorPoint = Vector2.new(1, 0.5);
  504.     dropdownImage.BackgroundTransparency = 1;
  505.     dropdownImage.BorderSizePixel = 0;
  506.     dropdownImage.Position = UDim2.new(1., 0, 0.5, 0);
  507.     dropdownImage.Rotation = 180;
  508.     dropdownImage.Size = UDim2.new(0.138, 0, 0.5, 0);
  509.     dropdownImage.Image = "rbxassetid://3905579436";
  510.     dropdownImage.ScaleType = Enum.ScaleType.Fit;
  511.  
  512.     topPaddingFrame.Name = "topPaddingFrame";
  513.     topPaddingFrame.BackgroundColor3 = Color3.fromRGB(63, 63, 63);
  514.     topPaddingFrame.BorderSizePixel = 0;
  515.     topPaddingFrame.Position = UDim2.new(0, 0, 1, 0);
  516.     topPaddingFrame.Size = UDim2.new(1, 0, 0, 0);
  517.     topPaddingFrame.ZIndex = 2;
  518.     topPaddingFrame.Visible = false;
  519.  
  520.     dropdownFrame.Name = "dropdownFrame";
  521.     dropdownFrame.BackgroundColor3 = Color3.fromRGB(63, 63, 63);
  522.     dropdownFrame.BorderSizePixel = 0;
  523.     dropdownFrame.Position = UDim2.new(0, 0, 1.08, 0);
  524.     dropdownFrame.Size = UDim2.new(1, 0, 0, 0);
  525.     dropdownFrame.ZIndex = 2;
  526.     dropdownFrame.Visible = false;
  527.  
  528.     bodyFrame.Name = "bodyFrame";
  529.     bodyFrame.BackgroundTransparency = 1;
  530.     bodyFrame.BorderSizePixel = 0;
  531.     bodyFrame.Position = UDim2.new(0, 0, 1.08, 0);
  532.     bodyFrame.Size = UDim2.new(1, 0, 0, 0);
  533.     bodyFrame.ZIndex = 2;
  534.     bodyFrame.Visible = false;
  535.  
  536.     UIListLayout.SortOrder = Enum.SortOrder.LayoutOrder;
  537.     UIListLayout.Padding = UDim.new(0.16, 0);
  538.  
  539.     self:initBtnEffect(dropdownBtn);
  540.  
  541.     for i, v in pairs(list) do
  542.         local btn = Instance.new("TextButton", bodyFrame);
  543.         btn.Name = "btn";
  544.         btn.BackgroundTransparency = 1;
  545.         btn.BorderSizePixel = 0;
  546.         btn.Size = UDim2.new(1, 0, 0.741, 0);
  547.         btn.Font = Enum.Font.SourceSansItalic;
  548.         btn.Text = v;
  549.         btn.TextColor3 = Color3.fromRGB(255, 255, 255);
  550.         btn.TextScaled = true;
  551.         btn.TextWrapped = true;
  552.         btn.ClipsDescendants = true;
  553.         btn.ZIndex = 2;
  554.  
  555.         btn.InputBegan:Connect(function(input)
  556.             if input.UserInputType == Enum.UserInputType.MouseMovement then
  557.                 game:GetService("TweenService"):Create(btn, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundTransparency = 0.5}):Play();
  558.             end;
  559.         end);
  560.  
  561.         btn.InputEnded:Connect(function(input)
  562.             if input.UserInputType == Enum.UserInputType.MouseMovement then
  563.                 game:GetService("TweenService"):Create(btn, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundTransparency = 1}):Play();
  564.             end;
  565.         end);
  566.  
  567.         btn.MouseButton1Click:Connect(function()
  568.             callback(v);
  569.         end);
  570.     end;
  571.  
  572.     dropdownBtn.MouseButton1Click:Connect(function()
  573.         if not dropdownFrame.Visible then
  574.             topPaddingFrame.Visible = true;
  575.             dropdownFrame.Visible = true;
  576.             bodyFrame.Visible = true;
  577.             game:GetService("TweenService"):Create(dropdownImage, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Rotation = 0}):Play();
  578.             topPaddingFrame:TweenSize(UDim2.new(1, 0, 0.08, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.2, true);
  579.             dropdownFrame:TweenSize(UDim2.new(1, 0, (#bodyFrame:GetChildren() - 1) * 1.082, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.2, true);
  580.             bodyFrame:TweenSize(UDim2.new(1, 0, 1.2, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.2, true);
  581.         elseif dropdownFrame.Visible then
  582.             game:GetService("TweenService"):Create(dropdownImage, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Rotation = 180}):Play();
  583.             dropdownFrame:TweenSize(UDim2.new(1, 0, 0, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.2, true);
  584.             bodyFrame:TweenSize(UDim2.new(1, 0, 0, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.2, true);
  585.             wait(0.15);
  586.             bodyFrame.Visible = false;
  587.             dropdownFrame.Visible = false;
  588.             topPaddingFrame.Visible = false;
  589.         end;
  590.     end);
  591. end;
  592.  
  593. function ShouxLib.Content:newColorPicker(title, callback, presetColor)
  594.     local hueSatDragging = false;
  595.     local valueDragging = false;
  596.     local btn = Instance.new("TextButton", self.bodyFrame);
  597.     local titleLabel = Instance.new("TextLabel", btn);
  598.     local statusFrame = Instance.new("Frame", btn);
  599.     local colorPickingFrame = Instance.new("Frame", btn);
  600.     local hueSatFrame = Instance.new("ImageLabel", colorPickingFrame);
  601.     local hueSatIndicatorFrame = Instance.new("ImageLabel", hueSatFrame);
  602.     local valueFrame = Instance.new("ImageLabel", colorPickingFrame);
  603.     local valueIndicatorFrame = Instance.new("Frame", valueFrame);
  604.    
  605.     btn.Name = "btn";
  606.     btn.BackgroundColor3 = Color3.fromRGB(50, 50, 50);
  607.     btn.BorderSizePixel = 0;
  608.     btn.Size = UDim2.new(1, 0, 0.9, 0);
  609.     btn.AutoButtonColor = false;
  610.     btn.Font = Enum.Font.SourceSansLight;
  611.     btn.Text = "";
  612.     btn.TextScaled = true;
  613.     btn.TextWrapped = true;
  614.    
  615.     titleLabel.Name = "titleLabel";
  616.     titleLabel.AnchorPoint = Vector2.new(0, 0.5);
  617.     titleLabel.BackgroundTransparency = 1;
  618.     titleLabel.BorderSizePixel = 0;
  619.     titleLabel.Position = UDim2.new(0.02, 0, 0.5, 0);
  620.     titleLabel.Size = UDim2.new(0.98, 0, 1, 0);
  621.     titleLabel.Font = Enum.Font.SourceSansLight;
  622.     titleLabel.Text = title;
  623.     titleLabel.TextColor3 = Color3.fromRGB(255, 255, 255);
  624.     titleLabel.TextScaled = true;
  625.     titleLabel.TextWrapped = true;
  626.     titleLabel.TextXAlignment = Enum.TextXAlignment.Left;
  627.    
  628.     statusFrame.Name = "statusFrame";
  629.     statusFrame.AnchorPoint = Vector2.new(1, 0);
  630.     statusFrame.BackgroundColor3 = presetColor or Color3.fromRGB(255, 255, 255);
  631.     statusFrame.BorderSizePixel = 0;
  632.     statusFrame.Position = UDim2.new(1, 0, 0, 0);
  633.     statusFrame.Size = UDim2.new(0.223, 0, 1, 0);
  634.    
  635.     colorPickingFrame.Name = "colorPickingFrame";
  636.     colorPickingFrame.BackgroundColor3 = Color3.fromRGB(30, 30, 30);
  637.     colorPickingFrame.BorderSizePixel = 0;
  638.     colorPickingFrame.Position = UDim2.new(0, 0, 1, 0);
  639.     colorPickingFrame.Size = UDim2.new(1, 0, 0, 0);
  640.     colorPickingFrame.Visible = false;
  641.     colorPickingFrame.ZIndex = 2;
  642.    
  643.     hueSatFrame.Name = "hueSatFrame";
  644.     hueSatFrame.BackgroundTransparency = 1;
  645.     hueSatFrame.BorderSizePixel = 0;
  646.     hueSatFrame.ClipsDescendants = true;
  647.     hueSatFrame.Position = UDim2.new(0.03, 0, 0.057, 0);
  648.     hueSatFrame.Size = UDim2.new(0.764, 0, 0.886, 0);
  649.     hueSatFrame.Image = "rbxassetid://4018903152";
  650.     hueSatFrame.ZIndex = 2;
  651.    
  652.     hueSatIndicatorFrame.Name = "indicatorFrame";
  653.     hueSatIndicatorFrame.AnchorPoint = Vector2.new(0.5, 0.5);
  654.     hueSatIndicatorFrame.BackgroundTransparency = 1;
  655.     hueSatIndicatorFrame.BorderSizePixel = 0;
  656.     hueSatIndicatorFrame.Position = UDim2.new(presetColor and select(1, Color3.toHSV(presetColor)) or 0, 0, presetColor and 1 - select(2, Color3.toHSV(presetColor)) or 0, 0);
  657.     hueSatIndicatorFrame.Size = UDim2.new(0.146, 0, 0.2, 0);
  658.     hueSatIndicatorFrame.Image = "rbxassetid://4019495410";
  659.     hueSatIndicatorFrame.ImageColor3 = Color3.fromRGB(0, 0, 0);
  660.     hueSatIndicatorFrame.ScaleType = Enum.ScaleType.Crop;
  661.     hueSatIndicatorFrame.ZIndex = 2;
  662.    
  663.     valueFrame.Name = "valueFrame"
  664.     valueFrame.AnchorPoint = Vector2.new(1, 0)
  665.     valueFrame.BackgroundTransparency = 1
  666.     valueFrame.BorderSizePixel = 0;
  667.     valueFrame.Position = UDim2.new(0.981, 0, 0.057, 0);
  668.     valueFrame.Size = UDim2.new(0.157, 0, 0.886, 0);
  669.     valueFrame.Image = "rbxassetid://4019265005";
  670.     valueFrame.ImageColor3 = presetColor and Color3.fromHSV(Color3.toHSV(presetColor)) or Color3.fromRGB(255, 255, 255);
  671.     valueFrame.ScaleType = Enum.ScaleType.Crop;
  672.     valueFrame.ZIndex = 2;
  673.    
  674.     valueIndicatorFrame.Name = "indicatorFrame";
  675.     valueIndicatorFrame.AnchorPoint = Vector2.new(0, 0.5);
  676.     valueIndicatorFrame.BackgroundColor3 = Color3.fromRGB(255, 255, 255);
  677.     valueIndicatorFrame.BorderColor3 = Color3.fromRGB(0, 0, 0);
  678.     valueIndicatorFrame.BorderSizePixel = 2;
  679.     valueIndicatorFrame.Position = UDim2.new(0, 0, presetColor and 1 - select(3, Color3.toHSV(presetColor)) or 0, 0);
  680.     valueIndicatorFrame.Size = UDim2.new(1, 0, 0.028, 0);
  681.     valueIndicatorFrame.ZIndex = 2;
  682.  
  683.     self:initBtnEffect(btn);
  684.  
  685.     btn.MouseButton1Click:Connect(function()
  686.         if not colorPickingFrame.Visible then
  687.             colorPickingFrame.Visible = true;
  688.             colorPickingFrame:TweenSize(UDim2.new(1, 0, 5, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.2, true);
  689.         elseif colorPickingFrame.Visible then
  690.             colorPickingFrame:TweenSize(UDim2.new(1, 0, 0, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.2, true);
  691.             wait(0.15);
  692.             colorPickingFrame.Visible = false;
  693.         end;
  694.     end);
  695.    
  696.     hueSatFrame.InputBegan:Connect(function(input)
  697.         if input.UserInputType == Enum.UserInputType.MouseButton1 then
  698.             hueSatDragging = true;
  699.         end;
  700.     end);
  701.    
  702.     hueSatFrame.InputEnded:Connect(function(input)
  703.         if input.UserInputType == Enum.UserInputType.MouseButton1 then
  704.             hueSatDragging = false;
  705.         end;
  706.     end);
  707.  
  708.     valueFrame.InputBegan:Connect(function(input)
  709.         if input.UserInputType == Enum.UserInputType.MouseButton1 then
  710.             valueDragging = true;
  711.         end;
  712.     end)
  713.    
  714.     valueFrame.InputEnded:Connect(function(input)
  715.         if input.UserInputType == Enum.UserInputType.MouseButton1 then
  716.             valueDragging = false;
  717.         end;
  718.     end);
  719.    
  720.     game:GetService("UserInputService").InputChanged:Connect(function(input)
  721.         if hueSatDragging and input.UserInputType == Enum.UserInputType.MouseMovement then
  722.             hueSatIndicatorFrame.Position = UDim2.new(math.clamp((input.Position.X - hueSatFrame.AbsolutePosition.X) / hueSatFrame.AbsoluteSize.X, 0, 1), 0, math.clamp((input.Position.Y - hueSatFrame.AbsolutePosition.Y) / hueSatFrame.AbsoluteSize.Y, 0, 1), 0);
  723.             valueIndicatorFrame.BackgroundColor3 = Color3.fromHSV(h, 1 - (1 - hueSatIndicatorFrame.Position.Y.Scale), 1);
  724.             statusFrame.BackgroundColor3 = Color3.fromHSV(hueSatIndicatorFrame.Position.X.Scale, 1 - hueSatIndicatorFrame.Position.Y.Scale, 1 - valueIndicatorFrame.Position.Y.Scale);
  725.             valueFrame.ImageColor3 = Color3.fromHSV(hueSatIndicatorFrame.Position.X.Scale, 1 - hueSatIndicatorFrame.Position.Y.Scale, 1);
  726.             callback(statusFrame.BackgroundColor3);
  727.         elseif valueDragging and input.UserInputType == Enum.UserInputType.MouseMovement then
  728.             valueIndicatorFrame.Position = UDim2.new(0, 0, math.clamp((input.Position.Y - valueFrame.AbsolutePosition.Y) / valueFrame.AbsoluteSize.Y, 0, 1), 0);
  729.             valueIndicatorFrame.BackgroundColor3 = Color3.fromHSV(h, 1 - (1 - hueSatIndicatorFrame.Position.Y.Scale), 1);
  730.             statusFrame.BackgroundColor3 = Color3.fromHSV(hueSatIndicatorFrame.Position.X.Scale, 1 - hueSatIndicatorFrame.Position.Y.Scale, 1 - valueIndicatorFrame.Position.Y.Scale);
  731.             valueFrame.ImageColor3 = Color3.fromHSV(hueSatIndicatorFrame.Position.X.Scale, 1 - hueSatIndicatorFrame.Position.Y.Scale, 1);
  732.             callback(statusFrame.BackgroundColor3);
  733.         end;
  734.     end);
  735. end;
  736.  
  737. return ShouxLib;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement