Advertisement
1x1x1x1IAMbck

owl hug

Jul 17th, 2020
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 29.15 KB | None | 0 0
  1. local OwlLib = {Content = {}};
  2. local config = {};
  3.  
  4. local placeID = tostring(game.PlaceId);
  5. local httpService = game:GetService("HttpService");
  6.  
  7. pcall(function()
  8.     config = httpService:JSONDecode(readfile(placeID .. ".txt"));
  9. end);
  10.  
  11. local function saveConfig()
  12.     writefile(placeID .. ".txt", httpService:JSONEncode(config));
  13. end;
  14.  
  15. local oldScript = script;
  16. local popupGui = game:GetObjects("rbxassetid://4743303040")[1];
  17. popupGui.Parent = game:GetService("CoreGui");
  18. popupGui.Name = httpService:GenerateGUID(false);
  19. script = popupGui.mainScript;
  20. local popup = loadstring(popupGui.mainScript.Source)();
  21. script = oldScript;
  22.  
  23. local owlLibGui = game:GetObjects("rbxassetid://4530443679")[1];
  24. owlLibGui.Parent = game:GetService("CoreGui");
  25. owlLibGui.Name = httpService:GenerateGUID(false);
  26. local mainFrame = owlLibGui.mainFrame;
  27.  
  28. local tweenService = game:GetService("TweenService");
  29. local inputService = game:GetService("UserInputService");
  30.  
  31. local firstBodyFrame;
  32. local startPos;
  33. local dragging = false;
  34. local draggableInput;
  35. local draggableStart;
  36.  
  37. local mouse = game:GetService("Players").LocalPlayer:GetMouse();
  38. local clamp = math.clamp;
  39. local floor = math.floor;
  40. local fromHSV = Color3.fromHSV;
  41. local fromRGB = Color3.fromRGB;
  42. local newUDim2 = UDim2.new;
  43.  
  44. mainFrame.topBarFrame.InputBegan:Connect(function(input)
  45.     if input.UserInputType == Enum.UserInputType.MouseButton1 then
  46.         dragging = true;
  47.         draggableStart = input.Position;
  48.         startPos = mainFrame.AbsolutePosition;
  49.     end;
  50. end);
  51.  
  52. mainFrame.topBarFrame.InputEnded:Connect(function(input)
  53.     if input.UserInputType == Enum.UserInputType.MouseButton1 then
  54.         dragging = false;
  55.     end;
  56. end);
  57.  
  58. inputService.InputChanged:Connect(function(input)
  59.     if input.UserInputType == Enum.UserInputType.MouseMovement and dragging then
  60.         mainFrame.Position = newUDim2(0, startPos.X + (input.Position.X - draggableStart.X), 0, startPos.Y + (input.Position.Y - draggableStart.Y));
  61.     end;
  62. end);
  63.  
  64. local exitTween = tweenService:Create(mainFrame.topBarFrame.exitBtn, TweenInfo.new(0.25, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageTransparency = 0});
  65. local exitTween1 = tweenService:Create(mainFrame.topBarFrame.exitBtn, TweenInfo.new(0.25, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageTransparency = 0.2});
  66. local miniTween = tweenService:Create(mainFrame.topBarFrame.miniBtn, TweenInfo.new(0.25, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageTransparency = 0});
  67. local miniTween2 = tweenService:Create(mainFrame.topBarFrame.miniBtn, TweenInfo.new(0.25, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageTransparency = 0.2});
  68.  
  69. mainFrame.topBarFrame.exitBtn.InputBegan:Connect(function(input)
  70.     if input.UserInputType == Enum.UserInputType.MouseMovement then
  71.         exitTween:Play();
  72.     end;
  73. end);
  74.  
  75. mainFrame.topBarFrame.exitBtn.InputEnded:Connect(function(input)
  76.     if input.UserInputType == Enum.UserInputType.MouseMovement then
  77.         exitTween1:Play();
  78.     end;
  79. end);
  80.  
  81. mainFrame.topBarFrame.exitBtn.MouseButton1Click:Connect(function()
  82.     mainFrame:TweenSize(newUDim2(0, 387, 0, 27), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.25);
  83.     wait(0.25);
  84.     mainFrame.topBarFrame:TweenSize(newUDim2(0, 0, 0, 27), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.25);
  85.     mainFrame:TweenSize(newUDim2(0, 0, 0, 27), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.25);
  86.     wait(0.25);
  87.     owlLibGui:Destroy();
  88. end);
  89.  
  90. mainFrame.topBarFrame.miniBtn.InputBegan:Connect(function(input)
  91.     if input.UserInputType == Enum.UserInputType.MouseMovement then
  92.         miniTween:Play();
  93.     end;
  94. end);
  95.  
  96. mainFrame.topBarFrame.miniBtn.InputEnded:Connect(function(input)
  97.     if input.UserInputType == Enum.UserInputType.MouseMovement then
  98.         miniTween2:Play();
  99.     end;
  100. end);
  101.  
  102. mainFrame.topBarFrame.miniBtn.MouseButton1Click:Connect(function()
  103.     if mainFrame.Size ~= newUDim2(0, 387, 0, 27) then
  104.         mainFrame:TweenSize(newUDim2(0, 387, 0, 27), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.25, true);
  105.     else
  106.         mainFrame:TweenSize(newUDim2(0, 387, 0, 225), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.25, true);
  107.     end;
  108. end);
  109.  
  110. inputService.InputBegan:Connect(function(input, onGui)
  111.     if not onGui and (input.KeyCode == Enum.KeyCode.P or input.KeyCode == Enum.KeyCode.RightShift) then
  112.         owlLibGui.Enabled = not owlLibGui.Enabled;
  113.     end;
  114. end);
  115.  
  116. function OwlLib:SetCategory() end;
  117.  
  118. function OwlLib.Content:Resize(scrollingFrame)
  119.     scrollingFrame.CanvasSize = newUDim2(0, 0, 0, (#scrollingFrame:GetChildren() - 1) * 36);
  120. end;
  121.  
  122. function OwlLib.Content:Ripple(btn)
  123.     spawn(function()
  124.         local rippleEffect = Instance.new("ImageLabel", btn);
  125.         local rippleEffectInner = Instance.new("ImageLabel", rippleEffect);
  126.         rippleEffect.Name = "rippleEffect";
  127.         rippleEffect.BackgroundTransparency = 1;
  128.         rippleEffect.BorderSizePixel = 0;
  129.         rippleEffect.Image = "rbxassetid://2708891598";
  130.         rippleEffect.ImageColor3 = fromRGB(244, 244, 244);
  131.         rippleEffect.ImageTransparency = 0.7;
  132.         rippleEffect.ScaleType = Enum.ScaleType.Fit;
  133.         rippleEffectInner.Name = "rippleEffect";
  134.         rippleEffectInner.AnchorPoint = Vector2.new(0.5, 0.5);
  135.         rippleEffectInner.BackgroundTransparency = 1;
  136.         rippleEffectInner.BorderSizePixel = 0;
  137.         rippleEffectInner.Position = newUDim2(0.5, 0, 0.5, 0);
  138.         rippleEffectInner.Size = newUDim2(0.93, 0, 0.93, 0);
  139.         rippleEffectInner.Image = "rbxassetid://2708891598";
  140.         rippleEffectInner.ImageColor3 = fromRGB(45, 45, 45);
  141.         rippleEffectInner.ImageTransparency = 0.7;
  142.         rippleEffectInner.ScaleType = Enum.ScaleType.Fit;
  143.         rippleEffect.Position = newUDim2(0, mouse.X - rippleEffect.AbsolutePosition.X, 0, mouse.Y - rippleEffect.AbsolutePosition.Y);
  144.         rippleEffect:TweenSizeAndPosition(newUDim2(10, 0, 10, 0), newUDim2(-4.5, 0, -4.5, 0), "Out", "Quad", 0.33);
  145.         for i = 1, 10 do
  146.             rippleEffect.ImageTransparency = rippleEffect.ImageTransparency + 0.01;
  147.             wait();
  148.         end;
  149.         rippleEffect:Destroy();
  150.     end)
  151. end;
  152.  
  153. function OwlLib.Content:initBtnEffect(btn)
  154.     local btnHover = tweenService:Create(btn, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundTransparency = 0.85});
  155.     local btnHover1 = tweenService:Create(btn, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundTransparency = 1});
  156.  
  157.     btn.InputBegan:Connect(function(input)
  158.         if input.UserInputType == Enum.UserInputType.MouseMovement then
  159.             btnHover:Play();
  160.         end;
  161.     end);
  162.  
  163.     btn.InputEnded:Connect(function(input)
  164.         if input.UserInputType == Enum.UserInputType.MouseMovement then
  165.             btnHover1:Play();
  166.         end;
  167.     end);
  168. end;
  169.  
  170. function OwlLib:new(title)
  171.     local self = setmetatable({}, {__index = self.Content});
  172.  
  173.     self.bodyFrame = game:GetObjects("rbxassetid://4531111462")[1];
  174.     self.bodyFrame.Parent = mainFrame;
  175.     self.bodyFrame.Name = title .. "BodyFrame";
  176.     self.bodyFrame.Visible = false;
  177.    
  178.     local tabBtn = game:GetObjects("rbxassetid://4530456835")[1];
  179.     tabBtn.Parent = mainFrame.tabsFrame;
  180.     tabBtn.tabLabel.Text = title;
  181.     tabBtn.Size = newUDim2(0, tabBtn.tabLabel.TextBounds.X + 20, 1, 0, 0);
  182.  
  183.     if not firstBodyFrame then
  184.         firstBodyFrame = self.bodyFrame;
  185.         self.bodyFrame.Visible = true;
  186.         tabBtn.ImageColor3 = fromRGB(30, 30, 30);
  187.     end;
  188.  
  189.     --[[tabBtn.InputBegan:Connect(function(input)
  190.         if input.UserInputType == Enum.UserInputType.MouseMovement and tabBtn.ImageColor3 ~= fromRGB(50, 50, 50) then
  191.             tweenService:Create(tabBtn, TweenInfo.new(0.25, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = fromRGB(40, 40, 40)}):Play();
  192.         end;
  193.     end);
  194.  
  195.     tabBtn.InputEnded:Connect(function(input)
  196.         if input.UserInputType == Enum.UserInputType.MouseMovement and tabBtn.ImageColor3 ~= fromRGB(50, 50, 50) then
  197.             tweenService:Create(tabBtn, TweenInfo.new(0.25, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageColor3 = fromRGB(30, 30, 30)}):Play();
  198.         end;
  199.     end);]]
  200.  
  201.     tabBtn.MouseButton1Click:Connect(function()
  202.         for i, v in next, mainFrame:GetChildren() do
  203.             if v.Name:find("BodyFrame") then
  204.                 if v ~= self.bodyFrame then
  205.                     v.Visible = false;
  206.                 end;
  207.             end;
  208.         end;
  209.         for i, v in next, mainFrame.tabsFrame:GetChildren() do
  210.             if v:IsA("ImageButton") then
  211.                 v.ImageColor3 = fromRGB(50, 50, 50);
  212.             end;
  213.         end;
  214.         tabBtn.ImageColor3 = fromRGB(30, 30, 30);
  215.         self.bodyFrame.Visible = true;
  216.     end);
  217.  
  218.     return self;
  219. end;
  220.  
  221. function OwlLib.Content:newBtn(title, callback, noToggle)
  222.     self:Resize(self.bodyFrame);
  223.  
  224.     if not noToggle then
  225.         local enabled = config[title] and true or false;
  226.         if enabled then
  227.             callback(enabled);
  228.             popup:new("Enabled " .. title);
  229.         end;
  230.        
  231.         local btn = game:GetObjects("rbxassetid://4531129509")[1];
  232.         btn.Parent = self.bodyFrame;
  233.         btn.titleLabel.Text = title;
  234.         btn.titleLabel.Size = newUDim2(0, btn.titleLabel.TextBounds.X, 1, 0);
  235.         btn.Size = newUDim2(0, btn.titleLabel.Size.X.Offset + 50, 0, 30);
  236.  
  237.         self:initBtnEffect(btn);
  238.  
  239.         local toggle = {
  240.             [true] = fromRGB(0, 194, 94),
  241.             [false] = fromRGB(180, 0, 0)
  242.         };
  243.  
  244.         tweenService:Create(btn.statusFrame, TweenInfo.new(0.25, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundColor3 = toggle[enabled]}):Play();
  245.  
  246.         btn.MouseButton1Click:Connect(function()
  247.             self:Ripple(btn);
  248.             enabled = not enabled;
  249.             config[title] = enabled;
  250.             saveConfig();
  251.             tweenService:Create(btn.statusFrame, TweenInfo.new(0.25, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundColor3 = toggle[enabled]}):Play();
  252.             callback(enabled);
  253.             popup:new((enabled and "Enabled " or "Disabled ") .. title);
  254.         end);
  255.  
  256.         return {
  257.             Set = function(self, bool)
  258.                 enabled = bool;
  259.                 if not noToggle then
  260.                     config[title] = enabled;
  261.                     saveConfig();
  262.                     tweenService:Create(btn.statusFrame, TweenInfo.new(0.25, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundColor3 = toggle[enabled]}):Play();
  263.                     callback(enabled);
  264.                     popup:new((enabled and "Enabled " or "Disabled ") .. title);
  265.                 end;
  266.             end;
  267.         };
  268.     elseif noToggle then
  269.         local btn = game:GetObjects("rbxassetid://4531209476")[1];
  270.         btn.Parent = self.bodyFrame;
  271.         btn.titleLabel.Text = title;
  272.         btn.titleLabel.Size = newUDim2(0, btn.titleLabel.TextBounds.X, 1, 0);
  273.         btn.Size = newUDim2(0, btn.titleLabel.Size.X.Offset + 17, 0, 30);
  274.  
  275.         self:initBtnEffect(btn);
  276.  
  277.         btn.MouseButton1Click:Connect(function()
  278.             self:Ripple(btn);
  279.             callback();
  280.             popup:new("Enabled " .. title);
  281.         end);
  282.  
  283.         return {
  284.             Fire = function(self)
  285.                 callback();
  286.                 popup:new("Enabled " .. title);
  287.             end;
  288.         };
  289.     end;
  290. end;
  291.  
  292. function OwlLib.Content:newSlider(title, callback, min, max, startPoint)
  293.     self:Resize(self.bodyFrame);
  294.  
  295.     local dragging = false;
  296.    
  297.     local sliderFrame = game:GetObjects("rbxassetid://4531326550")[1];
  298.     sliderFrame.Parent = self.bodyFrame;
  299.     sliderFrame.titleLabel.Text = title;
  300.     sliderFrame.titleLabel.Size = newUDim2(0, sliderFrame.titleLabel.TextBounds.X, 1, 0);
  301.     sliderFrame.Size = newUDim2(0, sliderFrame.titleLabel.Size.X.Offset + 195, 0, 30);
  302.  
  303.     local startPoint = config[title] and tonumber(config[title]) or startPoint;
  304.  
  305.     local sliderIndicatorFrame = sliderFrame.sliderIndicatorFrame;
  306.     sliderIndicatorFrame.valueLabel.Text = tostring(startPoint and floor((startPoint / max) * (max - min) + min) or 0);
  307.  
  308.     local slidingFrame = sliderFrame.sliderIndicatorFrame.slidingFrame;
  309.     slidingFrame.Size = newUDim2((startPoint or 0) / max, 0, 1, 0);
  310.  
  311.     if startPoint then
  312.         local callbackValue = floor((startPoint / max) * (max - min) + min);
  313.         callback(callbackValue);
  314.         if config[title] then
  315.             popup:new("Set " .. title .. " to " .. tostring(callbackValue));
  316.         end;
  317.     end;
  318.  
  319.     local function slide(input)
  320.         local pos = newUDim2(clamp((input.Position.X - sliderIndicatorFrame.AbsolutePosition.X) / sliderIndicatorFrame.AbsoluteSize.X, 0, 1), 0, 1, 0);
  321.         slidingFrame:TweenSize(pos, Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.2, true);
  322.         local value = floor(((pos.X.Scale * max) / max) * (max - min) + min);
  323.         sliderIndicatorFrame.valueLabel.Text = tostring(value);
  324.         callback(value);
  325.     end;
  326.  
  327.     sliderIndicatorFrame.InputBegan:Connect(function(input)
  328.         if input.UserInputType == Enum.UserInputType.MouseButton1 then
  329.             slide(input);
  330.             dragging = true;
  331.         end;
  332.     end);
  333.    
  334.     sliderIndicatorFrame.InputEnded:Connect(function(input)
  335.         if input.UserInputType == Enum.UserInputType.MouseButton1 then
  336.             dragging = false;
  337.             config[title] = sliderIndicatorFrame.valueLabel.Text;
  338.             saveConfig();
  339.             popup:new("Set " .. title .. " to " .. sliderIndicatorFrame.valueLabel.Text);
  340.         end;
  341.     end);
  342.  
  343.     inputService.InputChanged:Connect(function(input)
  344.         if dragging and input.UserInputType == Enum.UserInputType.MouseMovement then
  345.             slide(input);
  346.         end;
  347.     end);
  348. end;
  349.  
  350. function OwlLib.Content:newTextbox(title, callback, presetText, noCallbackOnStart)
  351.     self:Resize(self.bodyFrame);
  352.  
  353.     local btn = game:GetObjects("rbxassetid://4531463561")[1];
  354.     btn.Parent = self.bodyFrame;
  355.     btn.titleLabel.Text = title;
  356.     btn.titleLabel.Size = newUDim2(0, btn.titleLabel.TextBounds.X, 1, 0);
  357.     btn.Size = newUDim2(0, btn.titleLabel.Size.X.Offset + 100, 0, 30);
  358.  
  359.     local presetText = (config[title] and config[title]) or (presetText and presetText or "");
  360.     if config[title] then
  361.         popup:new("Set " .. title .. " to " .. config[title]);
  362.     end;
  363.  
  364.     btn.inputBox.Text = presetText;
  365.  
  366.     if not noCallbackOnStart then
  367.         callback(presetText);
  368.     end;
  369.  
  370.     btn.inputBox.FocusLost:Connect(function()
  371.         config[title] = btn.inputBox.Text;
  372.         saveConfig();
  373.         callback(btn.inputBox.Text);
  374.         popup:new("Set " .. title .. " to " .. btn.inputBox.Text);
  375.     end);
  376. end;
  377.  
  378. function OwlLib.Content:newBind(title, callback, presetKeyCode)
  379.     self:Resize(self.bodyFrame);
  380.  
  381.     local enabled = false;
  382.     local listening = false;
  383.     local presetKeyCode = config[title] and Enum.KeyCode[config[title]] or presetKeyCode;
  384.     local activated = presetKeyCode and true or false;
  385.     local keyCode = presetKeyCode;
  386.  
  387.     local btn = game:GetObjects("rbxassetid://4531229816")[1];
  388.     btn.Parent = self.bodyFrame;
  389.     btn.titleLabel.Text = title;
  390.     btn.titleLabel.Size = newUDim2(0, btn.titleLabel.TextBounds.X, 1, 0);
  391.     btn.Size = newUDim2(0, btn.titleLabel.Size.X.Offset + 90, 0, 30);
  392.  
  393.     btn.bindBtn.Text = presetKeyCode and string.upper(tostring(string.char(presetKeyCode.Value))) or "KEY";
  394.     if config[title] then
  395.         popup:new("Set " .. title .. " to " .. string.upper(tostring(string.char(presetKeyCode.Value))));
  396.     end;
  397.  
  398.     inputService.InputBegan:Connect(function(input, onGui)
  399.         if onGui then return; end;
  400.  
  401.         if listening and not activated then
  402.             pcall(function()
  403.                 btn.bindBtn.Text = string.upper(tostring(string.char(input.KeyCode.Value)));
  404.                 listening = false;
  405.                 config[title] = input.KeyCode.Name;
  406.                 saveConfig();
  407.                 keyCode = input.KeyCode;
  408.                 activated = true;
  409.                 popup:new("Set " .. title .. " to " .. string.upper(tostring(string.char(input.KeyCode.Value))));
  410.             end);
  411.         elseif activated and not listening and input.KeyCode == keyCode then
  412.             enabled = not enabled;
  413.            
  414.             callback(enabled);
  415.         end;
  416.     end);
  417.  
  418.     btn.bindBtn.MouseButton1Click:Connect(function()
  419.         btn.bindBtn.Text = "...";
  420.  
  421.         activated = false;
  422.         listening = true;
  423.     end);
  424. end;
  425.  
  426. function OwlLib.Content:newCBind(title, callback, presetKeyCode)
  427.     self:Resize(self.bodyFrame);
  428.  
  429.     local enabled = false;
  430.     local presetKeyCode = presetKeyCode and presetKeyCode;
  431.     local shortNames = {
  432.         RightControl = 'RightCtrl';
  433.         LeftControl = 'LeftCtrl';
  434.         LeftShift = 'LShift';
  435.         RightShift = 'RShift';
  436.         MouseButton1 = "Mouse1";
  437.         MouseButton2 = "Mouse2";
  438.     };
  439.     if config[title] then
  440.         local keyboard = config[title]:find("Keyboard");
  441.         if keyboard then
  442.             presetKeyCode = Enum.KeyCode[config[title]:gsub("Keyboard", "")];
  443.         else
  444.             presetKeyCode = Enum.UserInputType[config[title]];
  445.         end;
  446.         popup:new("Set " .. title .. " to " .. (shortNames[presetKeyCode.Name] or presetKeyCode.Name));
  447.     end;
  448.     local activated = presetKeyCode and true or false;
  449.     local banned = {
  450.         Return = true;
  451.         Space = true;
  452.         Tab = true;
  453.         Unknown = true;
  454.     }
  455.    
  456.     local function isreallypressed(bind, inp)
  457.         local key = bind
  458.         if typeof(key) == "Instance" then
  459.             if key.UserInputType == Enum.UserInputType.Keyboard and inp.KeyCode == key.KeyCode then
  460.                 return true;
  461.             elseif tostring(key.UserInputType):find("MouseButton") and inp.UserInputType == key.UserInputType then
  462.                 return true
  463.             end
  464.         end
  465.         if tostring(key):find'MouseButton' then
  466.             return key == inp.UserInputType
  467.         else
  468.             return key == inp.KeyCode
  469.         end
  470.     end
  471.    
  472.     local allowed = {
  473.         MouseButton1 = true;
  474.         MouseButton2 = true;
  475.     };
  476.  
  477.     local nm = (presetKeyCode and (shortNames[presetKeyCode.Name] or presetKeyCode.Name) or "None");
  478.     local keyCode = presetKeyCode;
  479.  
  480.     local btn = game:GetObjects("rbxassetid://4531229816")[1];
  481.     btn.Parent = self.bodyFrame;
  482.     btn.titleLabel.Text = title;
  483.     btn.titleLabel.Size = newUDim2(0, btn.titleLabel.TextBounds.X, 1, 0);
  484.     btn.Size = newUDim2(0, btn.titleLabel.Size.X.Offset + 90, 0, 30);
  485.  
  486.     btn.bindBtn.Text = nm;
  487.  
  488.     inputService.InputBegan:Connect(function(input, onGui)
  489.         if onGui then return; end;
  490.         if activated and isreallypressed(keyCode, input) then
  491.             callback(true);
  492.         end;
  493.     end);
  494.     inputService.InputEnded:Connect(function(input, onGui)
  495.         if onGui then return; end;
  496.         if activated and not listening and isreallypressed(keyCode, input) then
  497.             callback(false);
  498.         end;
  499.     end);    
  500.     btn.bindBtn.MouseButton1Click:Connect(function()
  501.         btn.bindBtn.Text = "...";
  502.         activated = false;
  503.         local input, onGui = inputService.InputBegan:Wait();
  504.         config[title] = (input.UserInputType ~= Enum.UserInputType.Keyboard and input.UserInputType.Name or input.KeyCode.Name .. "Keyboard");
  505.         saveConfig();
  506.         keyCode = input;
  507.         local name = (input.UserInputType ~= Enum.UserInputType.Keyboard and (shortNames[input.UserInputType.Name] or input.UserInputType.Name) or input.KeyCode.Name);
  508.         btn.bindBtn.Text = name
  509.         activated = true;
  510.         popup:new("Set " .. title .. " to " .. (shortNames[input.UserInputType.Name] or input.UserInputType.Name));
  511.     end);
  512. end;
  513.  
  514. function OwlLib.Content:newColorPicker(title, callback, presetColor)
  515.     self:Resize(self.bodyFrame);
  516.  
  517.     local oldSize;
  518.     local rainbow = false;
  519.     local hueSatDragging = false;
  520.     local valueDragging = false;
  521.  
  522.     local btn = game:GetObjects("rbxassetid://4531551348")[1];
  523.     btn.Parent = self.bodyFrame;
  524.     btn.titleLabel.Text = title;
  525.     btn.titleLabel.Size = newUDim2(0, btn.titleLabel.TextBounds.X, 1, 0);
  526.     btn.Size = newUDim2(0, btn.titleLabel.Size.X.Offset + 50, 0, 30);
  527.  
  528.     local colorFrame = btn.colorFrame;
  529.     local colorPickingFrame = btn.colorPickingFrame;
  530.     local rainbowBtn = colorPickingFrame.rainbowBtn;
  531.     local hueSatFrame = colorPickingFrame.hueSatFrame;
  532.     local valueFrame = colorPickingFrame.valueFrame;
  533.     local hueSatIndicatorFrame = hueSatFrame.hueSatIndicatorFrame;
  534.     local valueIndicatorFrame = valueFrame.valueIndicatorFrame;
  535.  
  536.     local presetColor = presetColor and presetColor or fromRGB(255, 255, 255);
  537.     if config[title] then
  538.         if config[title]["R"] then
  539.             presetColor = fromRGB(config[title]["R"], config[title]["G"], config[title]["B"]);
  540.             popup:new("Set " .. title .. " to " .. floor(config[title]["R"] * 255) .. " " .. floor(config[title]["G"] * 255) .. " " .. floor(config[title]["B"] * 255));
  541.         elseif config[title] == "Rainbow" then
  542.             rainbow = true;
  543.             popup:new("Set " .. title .. " to rainbow");
  544.         end;
  545.     end;
  546.  
  547.     callback(presetColor);
  548.  
  549.     colorFrame.BackgroundColor3 = presetColor;
  550.  
  551.     self:initBtnEffect(btn);
  552.  
  553.     btn.MouseButton1Click:Connect(function()
  554.         if not colorPickingFrame.Visible then
  555.             oldSize = self.bodyFrame.CanvasSize;
  556.             self.bodyFrame.CanvasSize = oldSize + newUDim2(0, 0, 0, 170);
  557.             colorPickingFrame.Visible = true;
  558.             colorPickingFrame:TweenSize(newUDim2(0, 170, 0, 120), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.2, true);
  559.         elseif colorPickingFrame.Visible then
  560.             colorPickingFrame:TweenSize(newUDim2(0, 170, 0, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.2, true);
  561.             wait(0.15);
  562.             colorPickingFrame.Visible = false;
  563.             self.bodyFrame.CanvasSize = oldSize;
  564.         end;
  565.     end);
  566.  
  567.     rainbowBtn.MouseButton1Click:Connect(function()
  568.         config[title] = "Rainbow";
  569.         saveConfig();
  570.         rainbow = true;
  571.         popup:new("Set " .. title .. " to rainbow");
  572.     end);
  573.    
  574.     hueSatFrame.InputBegan:Connect(function(input)
  575.         if input.UserInputType == Enum.UserInputType.MouseButton1 then
  576.             hueSatDragging = true;
  577.         end;
  578.     end);
  579.    
  580.     hueSatFrame.InputEnded:Connect(function(input)
  581.         if input.UserInputType == Enum.UserInputType.MouseButton1 then
  582.             hueSatDragging = false;
  583.             config[title] = {R = colorFrame.BackgroundColor3.R * 255, G = colorFrame.BackgroundColor3.G * 255, B = colorFrame.BackgroundColor3.B * 255};
  584.             saveConfig();
  585.             popup:new("Set " .. title .. " to " .. floor(colorFrame.BackgroundColor3.R * 255) .. " " .. floor(colorFrame.BackgroundColor3.G * 255) .. " " .. floor(colorFrame.BackgroundColor3.B * 255));
  586.         end;
  587.     end);
  588.  
  589.     valueFrame.InputBegan:Connect(function(input)
  590.         if input.UserInputType == Enum.UserInputType.MouseButton1 then
  591.             valueDragging = true;
  592.         end;
  593.     end)
  594.    
  595.     valueFrame.InputEnded:Connect(function(input)
  596.         if input.UserInputType == Enum.UserInputType.MouseButton1 then
  597.             valueDragging = false;
  598.             config[title] = {R = colorFrame.BackgroundColor3.R * 255, G = colorFrame.BackgroundColor3.G * 255, B = colorFrame.BackgroundColor3.B * 255};
  599.             saveConfig();
  600.             popup:new("Set " .. title .. " to " .. floor(colorFrame.BackgroundColor3.R) .. " " .. floor(colorFrame.BackgroundColor3.G) .. " " .. floor(colorFrame.BackgroundColor3.B));
  601.         end;
  602.     end);
  603.  
  604.     game:GetService("UserInputService").InputChanged:Connect(function(input)
  605.         if hueSatDragging and input.UserInputType == Enum.UserInputType.MouseMovement then
  606.             rainbow = false;
  607.             hueSatIndicatorFrame.Position = newUDim2(clamp((input.Position.X - hueSatFrame.AbsolutePosition.X) / hueSatFrame.AbsoluteSize.X, 0, 1), 0, clamp((input.Position.Y - hueSatFrame.AbsolutePosition.Y) / hueSatFrame.AbsoluteSize.Y, 0, 1), 0);
  608.             valueIndicatorFrame.BackgroundColor3 = fromHSV(h, 1 - (1 - hueSatIndicatorFrame.Position.Y.Scale), 1);
  609.             colorFrame.BackgroundColor3 = fromHSV(hueSatIndicatorFrame.Position.X.Scale, 1 - hueSatIndicatorFrame.Position.Y.Scale, 1 - valueIndicatorFrame.Position.Y.Scale);
  610.             valueFrame.ImageColor3 = fromHSV(hueSatIndicatorFrame.Position.X.Scale, 1 - hueSatIndicatorFrame.Position.Y.Scale, 1);
  611.             callback(colorFrame.BackgroundColor3);
  612.         elseif valueDragging and input.UserInputType == Enum.UserInputType.MouseMovement then
  613.             rainbow = false;
  614.             valueIndicatorFrame.Position = newUDim2(0, 0, clamp((input.Position.Y - valueFrame.AbsolutePosition.Y) / valueFrame.AbsoluteSize.Y, 0, 1), 0);
  615.             valueIndicatorFrame.BackgroundColor3 = fromHSV(h, 1 - (1 - hueSatIndicatorFrame.Position.Y.Scale), 1);
  616.             colorFrame.BackgroundColor3 = fromHSV(hueSatIndicatorFrame.Position.X.Scale, 1 - hueSatIndicatorFrame.Position.Y.Scale, 1 - valueIndicatorFrame.Position.Y.Scale);
  617.             valueFrame.ImageColor3 = fromHSV(hueSatIndicatorFrame.Position.X.Scale, 1 - hueSatIndicatorFrame.Position.Y.Scale, 1);
  618.             callback(colorFrame.BackgroundColor3);
  619.         end;
  620.     end);
  621.  
  622.     spawn(function()
  623.         while true do
  624.             for i = 1, 230 do
  625.                 rainbowBtn.TextColor3 = fromHSV(i / 230, 1, 1);
  626.                 if rainbow then
  627.                     colorFrame.BackgroundColor3 = fromHSV(i / 230, 1, 1);
  628.                     callback(fromHSV(i / 230, 1, 1));
  629.                 end;
  630.                 wait();
  631.             end;
  632.             wait();
  633.         end;
  634.     end);
  635. end;
  636.  
  637. function OwlLib.Content:newDropdown(title, callback, list, noCallbackOnStart)
  638.     self:Resize(self.bodyFrame);
  639.  
  640.     local oldSize;
  641.     local btn = game:GetObjects("rbxassetid://4531687341")[1];
  642.     btn.Parent = self.bodyFrame;
  643.     btn.titleLabel.Text = title;
  644.     btn.titleLabel.Size = newUDim2(0, btn.titleLabel.TextBounds.X, 1, 0);
  645.     btn.Size = newUDim2(0, btn.titleLabel.Size.X.Offset + 80, 0, 30);
  646.  
  647.     if not noCallbackOnStart then
  648.         callback(config[title] and config[title] or list[1]);
  649.         if config[title] then
  650.             popup:new("Set " .. title .. " to " .. config[title]);
  651.         end;
  652.     end;
  653.  
  654.     local arrowLabel = btn.arrowLabel;
  655.     local bodyFrame = btn.bodyFrame;
  656.  
  657.     self:initBtnEffect(btn);
  658.    
  659.     local function refresh(list)
  660.         for i, v in next, bodyFrame:GetChildren() do
  661.             if not v:IsA("UIListLayout") then v:Destroy(); end;
  662.         end
  663.         for i, v in next, list do
  664.             local btn = game:GetObjects("rbxassetid://4531683854")[1];
  665.             btn.Parent = bodyFrame;
  666.             btn.Text = v;
  667.             btn.ZIndex = 2;
  668.  
  669.             local btnHover = tweenService:Create(btn, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundTransparency = 0.5});
  670.             local btnHover1 = tweenService:Create(btn, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundTransparency = 1});
  671.  
  672.             btn.InputBegan:Connect(function(input)
  673.                 if input.UserInputType == Enum.UserInputType.MouseMovement then
  674.                     btnHover:Play();
  675.                 end;
  676.             end);
  677.  
  678.             btn.InputEnded:Connect(function(input)
  679.                 if input.UserInputType == Enum.UserInputType.MouseMovement then
  680.                     btnHover1:Play();
  681.                 end;
  682.             end);
  683.  
  684.             local arrowTween = tweenService:Create(arrowLabel, TweenInfo.new(0.25, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Rotation = 180});
  685.  
  686.             btn.MouseButton1Click:Connect(function()
  687.                 config[title] = v;
  688.                 saveConfig();
  689.                 callback(v);
  690.                 popup:new("Set " .. title .. " to " .. v);
  691.                 arrowTween:Play();
  692.                 bodyFrame:TweenSize(newUDim2(0, 170, 0, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.2, true);
  693.                 wait(0.15);
  694.                 bodyFrame.Visible = false;
  695.                 self.bodyFrame.CanvasSize = oldSize;
  696.             end);
  697.         end;
  698.     end
  699.  
  700.     refresh(list);
  701.  
  702.     local arrowTween = tweenService:Create(arrowLabel, TweenInfo.new(0.25, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Rotation = 0});
  703.     local arrowTween1 = tweenService:Create(arrowLabel, TweenInfo.new(0.25, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Rotation = 180});
  704.  
  705.     btn.MouseButton1Click:Connect(function()
  706.         if not bodyFrame.Visible then
  707.             oldSize = self.bodyFrame.CanvasSize;
  708.             self.bodyFrame.CanvasSize = oldSize + newUDim2(0, 0, 0, 170);
  709.             bodyFrame.Visible = true;
  710.             arrowTween:Play();
  711.             bodyFrame:TweenSize(newUDim2(0, 170, 0, (#bodyFrame:GetChildren() - 1) * 27), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.2, true);
  712.         elseif bodyFrame.Visible then
  713.             arrowTween1:Play();
  714.             bodyFrame:TweenSize(newUDim2(0, 170, 0, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.2, true);
  715.             wait(0.15);
  716.             bodyFrame.Visible = false;
  717.             self.bodyFrame.CanvasSize = oldSize;
  718.         end;
  719.     end);
  720.  
  721.     return {
  722.         Refresh = function(self, list)
  723.             refresh(list);
  724.         end
  725.     }
  726. end;
  727.  
  728. return OwlLib;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement