Advertisement
Guest User

Fishing Simulator Script

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