Paygammy

wally

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