ZynatyGaming

HOT UI Lib

May 11th, 2021 (edited)
21
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.61 KB | None | 0 0
  1. repeat wait() until game:IsLoaded()
  2.  
  3. local LB_MODULE = {}
  4.  
  5. do
  6. local getService = function(name)
  7. repeat wait() until game:GetService(name) ~= nil
  8. return game:GetService(name)
  9. end
  10.  
  11. local sendNotification = function(title, content)
  12. getService('StarterGui'):SetCore('SendNotification', {
  13. Title = title or 'No Title';
  14. Text = content or 'No Content';
  15. })
  16. end
  17.  
  18. local Main = {
  19. Services = {
  20. ['CoreGui'] = getService('CoreGui');
  21. ['Players'] = getService('Players');
  22. ['ReplicatedStorage'] = getService('ReplicatedStorage');
  23. ['RunService'] = getService('RunService');
  24. ['UserInputService'] = getService('UserInputService');
  25. ['Workspace'] = getService('Workspace');
  26. };
  27.  
  28. REQUIRED = {
  29. ['getgenv'] = pcall(function()return getgenv end) and getgenv;
  30. -- ['Drawing'] = pcall(function()return Drawing end) and Drawing;
  31. };
  32.  
  33. MISSING = {};
  34.  
  35. COLOR = {
  36. WINDOW = Color3.fromRGB(40,40,40);
  37. WINDOW_CLOSED = Color3.fromRGB(80, 0, 140);
  38. WINDOW_OPENED = Color3.fromRGB(0, 0, 140);
  39. TEXT = Color3.fromRGB(180,180,180);
  40. BUTTONBG = Color3.fromRGB(60,60,60);
  41. BUTTONTEXT = Color3.fromRGB(180,180,180);
  42. SELECTEDBG = Color3.fromRGB(80,80,80);
  43. SELECTEDTEXT = Color3.fromRGB(200,200,200);
  44. TITLEBAR = Color3.fromRGB(30,30,30);
  45. }
  46. }
  47.  
  48. for a,b in next, Main.REQUIRED do
  49. if not b then
  50. table.insert(Main.MISSING, a)
  51. end
  52. end
  53.  
  54. if #Main.MISSING ~= 0 then
  55. sendNotification('[UI LIB] Missing Feature(s)', table.concat(Main.MISSING, ', '))
  56. script:Destroy()
  57. return nil
  58. end
  59.  
  60. if getgenv().LBConnections and typeof(getgenv().LBConnections) == 'table' then
  61. for a,b in next, getgenv().LBConnections do
  62. b:Disconnect()
  63. end
  64. end
  65.  
  66. for a,b in next, Main.Services.CoreGui:children() do
  67. if string.find(b.Name, 'LB UI Library') then
  68. b:Destroy()
  69. end
  70. end
  71.  
  72. if getgenv().UILibrary_Loading then return nil end
  73. getgenv().UILibrary_Loading = true
  74.  
  75. if Drawing then
  76. local draw = Drawing.new('Square')
  77. draw.Size = Vector2.new(0,0)
  78. draw.Color = Color3.fromRGB(20,20,20)
  79. draw.Transparency = 1
  80. draw.Filled = true
  81. draw.Visible = true
  82. for i=0,100,1 do
  83. Main.Services.RunService.RenderStepped:wait()
  84. draw.Position = Vector2.new(
  85. (workspace.CurrentCamera.ViewportSize.X / 2) - i,
  86. (workspace.CurrentCamera.ViewportSize.Y / 2) - i
  87. )
  88. draw.Size = Vector2.new(draw.Size.X+2,draw.Size.Y+2)
  89. end
  90.  
  91. draw.Transparency = 1
  92. local text = Drawing.new('Text')
  93. text.Text = 'SinHub \n\n\n\nDeveloped By:\nKarumuBlox'
  94. text.Center = true
  95. text.Color = Color3.fromRGB(255,255,255)
  96. text.Size = 30
  97. text.Position = Vector2.new(
  98. (workspace.CurrentCamera.ViewportSize.X / 2),
  99. (workspace.CurrentCamera.ViewportSize.Y / 2)-92
  100. )
  101. text.Transparency = 0
  102. text.Visible = true
  103. for i=0,1,.01 do
  104. Main.Services.RunService.RenderStepped:wait()
  105. text.Transparency = i
  106. end
  107. text.Transparency = 1
  108. wait(1)
  109. for i=1,0,-.01 do
  110. Main.Services.RunService.RenderStepped:wait()
  111. text.Transparency = i
  112. end
  113. for i=100,0,-1 do
  114. Main.Services.RunService.RenderStepped:wait()
  115. draw.Position = Vector2.new(
  116. (workspace.CurrentCamera.ViewportSize.X / 2) - i,
  117. (workspace.CurrentCamera.ViewportSize.Y / 2) - i
  118. )
  119. draw.Size = Vector2.new(draw.Size.X-2,draw.Size.Y-2)
  120. end
  121. draw:Remove()
  122. text:Remove()
  123. end
  124.  
  125. getgenv().UILibrary_Loading = false
  126.  
  127. Main.GUI = Instance.new('ScreenGui', Main.Services.CoreGui)
  128. Main.GUI.Name = 'LB UI Library' .. getService('HttpService'):GenerateGUID()
  129. sendNotification('UI Library Loaded!', 'Press F1 to show/hide windows!\n- KarumuBlox')
  130.  
  131.  
  132. function LB_MODULE:Create(window, instance, props)
  133. local a = Instance.new(instance)
  134. for b,c in next, props do
  135. if b ~= 'Parent' then
  136. pcall(function()a[b]=c;end)
  137. pcall(function()a['BorderSizePixel']=0;end)
  138. pcall(function()a['ZIndex']=0;end)
  139. end
  140. end
  141.  
  142. if window then
  143. a.Parent = window
  144. else
  145. a.Parent = Main.GUI
  146. end
  147.  
  148. return a
  149. end
  150.  
  151. local windowPos = 0
  152. getgenv().LBConnections = {}
  153.  
  154. local windowMoving = false
  155. local currentWindow = nil
  156. local windowFocused = false
  157. local sliderFocused = false
  158. local sliderMoving = false
  159. local selectionOpened = false
  160. local mouseDown = false
  161.  
  162. table.insert(getgenv().LBConnections,
  163. Main.Services.UserInputService.InputEnded:connect(function(key)
  164. if key.UserInputType == Enum.UserInputType.MouseButton1 then
  165. mouseDown = false
  166. end
  167. end)
  168. )
  169.  
  170. function LB_MODULE:AddWindow(title)
  171. local height = 40
  172. local transition = false
  173. local closed = false
  174. local window = self:Create(nil, 'Frame', {
  175. AnchorPoint = Vector2.new(0,0);
  176. BackgroundColor3 = Main.COLOR.WINDOW;
  177. Position = UDim2.new(0,windowPos,0,0);
  178. Size = UDim2.new(0,200,0,height);
  179. ZIndex = 0;
  180. })
  181.  
  182. self:Create(window, 'Frame', {
  183. BackgroundColor3 = Main.COLOR.TITLEBAR;
  184. Position = UDim2.new(0,0,0,0);
  185. Size = UDim2.new(1,0,0,25);
  186. })
  187.  
  188. table.insert(getgenv().LBConnections,
  189. Main.Services.UserInputService.InputBegan:connect(function(key)
  190. if window ~= nil then
  191. if key.KeyCode == Enum.KeyCode.F1 then
  192. window.Visible = not window.Visible
  193. elseif key.UserInputType == Enum.UserInputType.MouseButton1 then
  194. mouseDown = true
  195. end
  196. end
  197. end)
  198. )
  199.  
  200.  
  201. windowPos = windowPos + 250
  202.  
  203. self:Create(window, 'TextLabel', {
  204. BackgroundTransparency = 1;
  205. Position = UDim2.new(.5,0,0,1);
  206. TextColor3 = Main.COLOR.TEXT;
  207. TextSize = 14;
  208. TextXAlignment = 2;
  209. TextYAlignment = 0;
  210. Text = title or 'Untitled';
  211. })
  212.  
  213. ------------------
  214.  
  215. local rBtn = self:Create(window, 'ImageButton', {
  216. BackgroundTransparency = 1;
  217. Image = 'rbxthumb://type=Asset&id=4693046251&w=150&h=150';
  218. ImageTransparency = 0;
  219. Position = UDim2.new(0,29,0,5);
  220. Size = UDim2.new(0,10,0,10);
  221. ScaleType = Enum.ScaleType.Fit;
  222. Text = '';
  223. TextColor3 = Main.COLOR.TEXT
  224. })
  225.  
  226. rBtn.MouseButton1Click:connect(function()
  227. if currentWindow == window then
  228. if #Main.GUI:children() == 1 then
  229. currentWindow = nil
  230. Main.GUI:Destroy()
  231. script:Destroy()
  232. end
  233. pcall(function()
  234. windowPos = windowPos - 250
  235. if connection then
  236. pcall(function()
  237. for a,b in next, getgenv().LBConnections do
  238. if b == connection then
  239. table.remove(getgenv().LBConnections, a)
  240. connection:Disconnect()
  241. end
  242. end
  243. end)
  244. end
  245. currentWindow = nil
  246. window:Destroy()
  247. end)
  248. end
  249. end)
  250.  
  251. ------------------
  252.  
  253. local gBtn = self:Create(window, 'ImageButton', {
  254. BackgroundTransparency = 1;
  255. Image = 'rbxthumb://type=Asset&id=4693044547&w=150&h=150';
  256. ImageTransparency = 0;
  257. Position = UDim2.new(0,5,0,5);
  258. Size = UDim2.new(0,10,0,10);
  259. ScaleType = Enum.ScaleType.Fit;
  260. Text = '';
  261. TextColor3 = Main.COLOR.TEXT
  262. })
  263.  
  264. gBtn.MouseButton1Click:connect(function()
  265. if currentWindow == window then
  266. if not transition then
  267. if closed then
  268. transition = true
  269. closed = false
  270. for i=25,height,4 do
  271. Main.Services.RunService.Heartbeat:wait()
  272. window.Size = UDim2.new(0,200,0,i)
  273. end
  274. window.ClipsDescendants = false
  275. window.Size = UDim2.new(0,200,0,height)
  276. transition = false
  277. end
  278. end
  279. end
  280. end)
  281.  
  282. ------------------
  283.  
  284. local oBtn = self:Create(window, 'ImageButton', {
  285. BackgroundTransparency = 1;
  286. Image = 'rbxthumb://type=Asset&id=4693046726&w=150&h=150';
  287. ImageTransparency = 0;
  288. Position = UDim2.new(0,17.8,0,5);
  289. Size = UDim2.new(0,10,0,10);
  290. ScaleType = Enum.ScaleType.Fit;
  291. Text = '';
  292. TextColor3 = Main.COLOR.TEXT
  293. })
  294.  
  295. oBtn.MouseButton1Click:connect(function()
  296. if currentWindow == window then
  297. if not transition then
  298. if not closed then
  299. transition = true
  300. window.ClipsDescendants = true
  301. closed = true
  302. for i=height,25,-4 do
  303. Main.Services.RunService.Heartbeat:wait()
  304. window.Size = UDim2.new(0,200,0,i)
  305. end
  306. window.Size = UDim2.new(0,200,0,25)
  307. transition = false
  308. end
  309. end
  310. end
  311. end)
  312.  
  313. ------------------
  314.  
  315. window.MouseMoved:connect(function()
  316. if not currentWindow and not selectionOpened then
  317. for a,b in next, window:children() do
  318. if b.ClassName ~= 'ScrollingFrame' then
  319. pcall(function()b.ZIndex = 1;end)
  320. pcall(function()b.Frame.ZIndex = 1;end)
  321. pcall(function()b.TextLabel.ZIndex = 1;end)
  322. pcall(function()b.TextButton.ZIndex = 1;end)
  323. end
  324. end
  325. window.ZIndex = 1
  326. currentWindow = window
  327. windowFocused = true
  328. end
  329. end)
  330.  
  331. ------------------
  332.  
  333. window.MouseLeave:connect(function()
  334. if currentWindow == window then
  335. windowFocused = false
  336. end
  337. if currentWindow == window and not windowMoving and not sliderMoving and not selectionOpened then
  338. for a,b in next, window:children() do
  339. if b.ClassName ~= 'ScrollingFrame' then
  340. pcall(function()b.ZIndex = 0;end)
  341. pcall(function()b.Frame.ZIndex = 0;end)
  342. pcall(function()b.TextLabel.ZIndex = 0;end)
  343. pcall(function()b.TextButton.ZIndex = 0;end)
  344. end
  345. end
  346. window.ZIndex = 0
  347. currentWindow = nil
  348. windowFocused = false
  349. end
  350. end)
  351.  
  352. ------------------
  353.  
  354. window.InputBegan:connect(function(key)
  355. if window == currentWindow then
  356. if not sliderFocused then
  357. local mouse = Main.Services.Players.LocalPlayer:GetMouse()
  358. local mb1 = Enum.UserInputType.MouseButton1
  359. local m = {
  360. x = 0;
  361. y = 0;
  362. }
  363. if key.UserInputType == mb1 then
  364. windowMoving = true
  365. local as = window.AbsolutePosition
  366. local pos = Vector2.new(mouse.X-as.X,mouse.Y-as.Y)
  367. while Main.Services.RunService.Heartbeat:wait() and Main.Services.UserInputService:IsMouseButtonPressed(mb1) and currentWindow == window do
  368. local obj = {
  369. mouse.X-pos.X,
  370. window.Size.X.Offset*window.AnchorPoint.X,
  371. mouse.Y-pos.Y,
  372. window.Size.Y.Offset*window.AnchorPoint.Y
  373. }
  374. if m.X ~= mouse.X or m.Y ~= mouse.Y then
  375. window:TweenPosition(
  376. UDim2.new(
  377. 0,
  378. obj[1]+obj[2],
  379. 0,
  380. obj[3]+obj[4]
  381. ),
  382. 'Out', 'Quad', .2,
  383. true
  384. )
  385. end
  386. m.X = mouse.X
  387. m.Y = mouse.Y
  388. end
  389. windowMoving = false
  390. end
  391. end
  392. end
  393. end)
  394.  
  395. ------------------
  396.  
  397. local windowModule = {}
  398. function windowModule:Label(text)
  399. if not text or typeof(text) ~= 'string' then
  400. return sendNotification('Invalid Text!', 'You must set the text as a string for this button!')
  401. end
  402. LB_MODULE:Create(window, 'TextLabel', {
  403. Position = UDim2.new(.5,0,0,height-10);
  404. TextSize = 10;
  405. TextXAlignment = 2;
  406. TextYAlignment = 0;
  407. Text = text or 'Untitled';
  408. TextColor3 = Main.COLOR.TEXT;
  409. })
  410.  
  411. height = height + 20
  412. window.Size = UDim2.new(0,200,0,height)
  413. return windowModule
  414. end
  415.  
  416. ------------------
  417.  
  418. function windowModule:Button(text, callback)
  419. if not text or typeof(text) ~= 'string' then
  420. return sendNotification('Invalid Text!', 'You must set the text as a string for this button!')
  421. end
  422. if not callback or typeof(callback) ~= 'function' then
  423. return sendNotification('Invalid Callback!', 'You must set the callback as a function for this button: ' .. text)
  424. end
  425. local btn = LB_MODULE:Create(window, 'TextButton', {
  426. BackgroundColor3 = Main.COLOR.BUTTONBG;
  427. Position = UDim2.new(0,10,0,height-10);
  428. Size = UDim2.new(0, 180, 0, 20);
  429. Text = text or 'Untitled';
  430. TextColor3 = Main.COLOR.BUTTONTEXT;
  431. TextXAlignment = 2;
  432. TextYAlignment = 1;
  433. })
  434.  
  435. btn.MouseButton1Click:connect(function()
  436. if window == currentWindow then
  437. callback()
  438. end
  439. end)
  440.  
  441. height = height + 20
  442. window.Size = UDim2.new(0,200,0,height)
  443. return windowModule
  444. end
  445.  
  446. ------------------
  447.  
  448. function windowModule:Toggle(text, callback)
  449. if not text or typeof(text) ~= 'string' then
  450. return sendNotification('Invalid Text!', 'You must set the text as a string for this toggle!')
  451. end
  452. if not callback or typeof(callback) ~= 'function' then
  453. return sendNotification('Invalid Callback!', 'You must set the callback as a function for this toggle: ' .. title)
  454. end
  455.  
  456. local btn = LB_MODULE:Create(window, 'TextButton', {
  457. BackgroundColor3 = Color3.fromRGB(140,0,0);
  458. Position = UDim2.new(0,10,0,height-10);
  459. Size = UDim2.new(0, 180, 0, 20);
  460. Text = text or 'Untitled';
  461. TextColor3 = Main.COLOR.BUTTONTEXT;
  462. TextXAlignment = 2;
  463. TextYAlignment = 1;
  464. })
  465.  
  466. btn.MouseButton1Click:connect(function()
  467. if window == currentWindow then
  468. btn.BackgroundColor3 = btn.BackgroundColor3 == Color3.fromRGB(140,0,0) and Color3.fromRGB(0,140,0) or Color3.fromRGB(140,0,0)
  469. callback()
  470. end
  471. end)
  472.  
  473. height = height + 20
  474. window.Size = UDim2.new(0,200,0,height)
  475. return windowModule
  476. end
  477.  
  478. ------------------
  479.  
  480. function windowModule:Selection(title, options)
  481. if not title or typeof(title) ~= 'string' then
  482. return sendNotification('Invalid Title!', 'You must set the title as a string for this selection!')
  483. end
  484. if not options or typeof(options) ~= 'table' then
  485. return sendNotification('Invalid Options!', 'You must set the options as a table for this selection: ' .. title)
  486. end
  487.  
  488. if #options == 0 then
  489. table.insert(options, '')
  490. end
  491.  
  492. local opts = {selected=tostring(options[1]), index=1}
  493. LB_MODULE:Create(window, 'TextLabel', {
  494. Position = UDim2.new(.5,0,0,height);
  495. Text = tostring(title or '');
  496. TextSize = 8;
  497. TextXAlignment = 2;
  498. TextYAlignment = 1;
  499. TextColor3 = Main.COLOR.TEXT;
  500. })
  501.  
  502. height = height + 20
  503.  
  504. local labelWindow = LB_MODULE:Create(window, 'Frame', {
  505. BackgroundColor3 = Main.COLOR.SELECTEDBG;
  506. Position = UDim2.new(0,10,0,height-10);
  507. Size = UDim2.new(0, 180, 0, 20);
  508. })
  509.  
  510. local label = LB_MODULE:Create(labelWindow, 'TextLabel', {
  511. Position = UDim2.new(.5,0,0,0);
  512. TextSize = 10;
  513. TextXAlignment = 2;
  514. TextYAlignment = 0;
  515. Text = tostring(options[1]);
  516. TextColor3 = Main.COLOR.SELECTEDTEXT;
  517. })
  518.  
  519.  
  520. local selectionHeight = 0
  521. local _transition = false
  522. local closed = true
  523.  
  524. local selectionWindow = LB_MODULE:Create(window, 'ScrollingFrame', {
  525. BackgroundColor3 = Color3.fromRGB(60,60,60);
  526. Position = UDim2.new(0,10,0,height+10);
  527. Size = UDim2.new(0, 180, 0, 0);
  528. Visible = false;
  529. })
  530. selectionWindow.ZIndex = 100
  531.  
  532. selectionWindow.ChildAdded:connect(function()
  533. selectionWindow.CanvasSize = UDim2.new(0,180,0,selectionHeight+20)
  534. end)
  535.  
  536. local sBtn = LB_MODULE:Create(labelWindow, 'TextButton', {
  537. BackgroundTransparency = 1;
  538. Size = UDim2.new(0,20,0,20);
  539. Position = UDim2.new(1,-20,0,0);
  540. Text = 'v';
  541. TextColor3 = Main.COLOR.BUTTONTEXT;
  542. })
  543.  
  544. local lostFocusEvent = nil
  545.  
  546. local closeFunc = function()
  547. if closed then
  548. selectionOpened = true
  549. sBtn.Text = '^'
  550. selectionWindow.Visible = true
  551. for i = 0, selectionHeight >= 140 and 140 or selectionHeight, 5 do
  552. Main.Services.RunService.RenderStepped:wait()
  553. selectionWindow.Size = UDim2.new(0, 180, 0, i)
  554. end
  555. selectionWindow.Size = UDim2.new(0, 180, 0, selectionHeight >= 140 and 140 or selectionHeight)
  556. closed = false
  557. elseif not closed then
  558. selectionOpened = false
  559. sBtn.Text = 'v'
  560. if lostFocusEvent then
  561. lostFocusEvent:Disconnect()
  562. lostFocusEvent = nil
  563. end
  564.  
  565. for i = selectionHeight >= 140 and 140 or selectionHeight,0, -5 do
  566. Main.Services.RunService.RenderStepped:wait()
  567. selectionWindow.Size = UDim2.new(0, 180, 0, i)
  568. end
  569. selectionWindow.Size = UDim2.new(0, 180, 0, 0)
  570. selectionWindow.Visible = false
  571. closed = true
  572. end
  573. return true
  574. end
  575.  
  576. sBtn.MouseButton1Click:connect(function()
  577. if window == currentWindow and not _transition then
  578. _transition = true
  579. if closed then
  580. selectionOpened = true
  581. lostFocusEvent = selectionWindow.MouseLeave:connect(function()
  582. if not _transition then
  583. _transition = true
  584. closeFunc()
  585. selectionOpened = false
  586. _transition = false
  587. if not windowFocused then
  588. for a,b in next, window:children() do
  589. if b.ClassName ~= 'ScrollingFrame' then
  590. pcall(function()b.ZIndex = 0;end)
  591. pcall(function()b.Frame.ZIndex = 0;end)
  592. pcall(function()b.TextLabel.ZIndex = 0;end)
  593. pcall(function()b.TextButton.ZIndex = 0;end)
  594. end
  595. end
  596. window.ZIndex = 0
  597. currentWindow = nil
  598. end
  599. end
  600. end)
  601. else
  602. selectionOpened = false
  603. end
  604.  
  605. closeFunc()
  606. _transition = false
  607. end
  608. end)
  609.  
  610. for a,b in next, options do
  611. local btn = LB_MODULE:Create(selectionWindow, 'TextButton', {
  612. BackgroundColor3 = Main.COLOR.BUTTONBG;
  613. Position = UDim2.new(0,0,0,selectionHeight);
  614. Size = UDim2.new(0, 160, 0, 20);
  615. Text = tostring(b);
  616. TextColor3 = Main.COLOR.TEXT;
  617. TextYAlignment = 1;
  618. TextXAlignment = 2;
  619. })
  620. btn.MouseButton1Click:connect(function()
  621. if not _transition then
  622. label.Text = tostring(b)
  623. opts.index = tonumber(a)
  624. opts.selected = tostring(b)
  625. closeFunc()
  626. end
  627. end)
  628. btn.ZIndex = 100;
  629. selectionHeight = selectionHeight + 20
  630. end
  631.  
  632. height = height + 20
  633. window.Size = UDim2.new(0,200,0,height)
  634. return opts
  635. end
  636.  
  637. ------------------
  638.  
  639. function windowModule:Slider(title, minValue, maxValue, callback)
  640. if not title or typeof(title) ~= 'string' then
  641. return sendNotification('Invalid Title!', 'You must set a title as a string for this slider!')
  642. end
  643. if (callback and typeof(callback) ~= 'function') then
  644. return sendNotification('Invalid Callback!', 'You must set a callback as a function for this slider: ' .. title)
  645. end
  646. if not maxValue then maxValue = 100 end
  647. if not minValue then minValue = 0 end
  648. if maxValue and typeof(maxValue) ~= 'number' then maxValue = 100 end
  649. if maxValue < 0 then maxValue = 100 end
  650. if minValue and typeof(minValue) ~= 'number' then minValue = 0 end
  651. if minValue < 0 then minValue = 0 end
  652. minValue = math.floor(minValue)
  653. maxValue = math.floor(maxValue)
  654. local tbl = {value=minValue;}
  655. local frame = LB_MODULE:Create(window, 'Frame', {
  656. BackgroundColor3 = Color3.fromRGB(75,75,75);
  657. Position = UDim2.new(0,10,0,height+5);
  658. Size = UDim2.new(0,180,0,20);
  659. })
  660.  
  661. local cursor = LB_MODULE:Create(frame, 'Frame', {
  662. BackgroundColor3 = Color3.fromRGB(180,180,180);
  663. Position = UDim2.new(0,0,0,5);
  664. Size = UDim2.new(0,10,0,10);
  665. })
  666.  
  667. local numValue = LB_MODULE:Create(frame, 'TextLabel', {
  668. BackgroundTransparency = 1;
  669. Position = UDim2.new(.5,0,0,5);
  670. Text = tostring(minValue);
  671. TextColor3 = Color3.fromRGB(255,255,255);
  672. TextYAlignment = 0;
  673. })
  674.  
  675. local aaa = LB_MODULE:Create(window, 'TextLabel', {
  676. BackgroundTransparency = 1;
  677. Position = UDim2.new(0,10,0,height-10);
  678. Size = UDim2.new(0,180,0,20);
  679. Text = title;
  680. TextColor3 = Color3.fromRGB(255,255,255);
  681. TextXAlignment = 0;
  682. TextYAlignment = 0;
  683. })
  684.  
  685. frame.InputBegan:connect(function()
  686. if not windowMoving and not sliderMoving and currentWindow == window and not mouseDown then
  687. local mouse = Main.Services.Players.LocalPlayer:GetMouse()
  688. local mouseAxis = {['x']=0;['y']=0;}
  689. local AbsolutePos = Vector2.new(
  690. frame.AbsolutePosition.X,
  691. frame.AbsolutePosition.Y
  692. )
  693. if not sliderMoving then
  694. while Main.Services.RunService.Heartbeat:wait() and Main.Services.UserInputService:IsMouseButtonPressed(Enum.UserInputType.MouseButton1) do
  695. sliderMoving = true
  696. if mouseAxis.x ~= mouse.X then
  697. local pos = nil;
  698. if mouse.X >= (AbsolutePos.X + 170) then
  699. pos=UDim2.new(0,170,0,5)
  700. elseif mouse.X <= AbsolutePos.X then
  701. pos=UDim2.new(0,0,0,5)
  702. else
  703. pos=UDim2.new(0,mouse.X-AbsolutePos.X,0,5)
  704. end
  705. cursor:TweenPosition(pos, 'Out', 'Quad', .2, true)
  706. end
  707. mouseAxis.x = mouse.X
  708. end
  709. sliderMoving = false
  710. end
  711. end
  712. end)
  713.  
  714. ------------------
  715.  
  716. cursor:GetPropertyChangedSignal('Position'):connect(function()
  717. numValue.Text = tostring(
  718. math.clamp(
  719. math.floor(
  720. (
  721. (cursor.Position.X.Offset)
  722. /
  723. ((frame.AbsoluteSize.X)-10)
  724. ) * maxValue
  725. ),
  726. minValue,
  727. maxValue
  728. )
  729. )
  730. end)
  731.  
  732. numValue:GetPropertyChangedSignal('Text'):connect(function(property)
  733. tbl.value = tonumber(numValue.Text)
  734. if callback then
  735. callback(tonumber(numValue.Text))
  736. end
  737. end)
  738.  
  739. frame.MouseEnter:connect(function()
  740. sliderFocused = true
  741. end)
  742.  
  743. frame.MouseLeave:connect(function()
  744. sliderFocused = false
  745. end)
  746.  
  747. height = height + 35
  748. window.Size = UDim2.new(0,200,0,height)
  749.  
  750. return tbl
  751. end
  752.  
  753. ------------------
  754.  
  755. function windowModule:Text(placeholderText)
  756. local tbl = {Text = ''}
  757. local txtBox = LB_MODULE:Create(window, 'TextBox', {
  758. BackgroundColor3 = Color3.fromRGB(150,150,150);
  759. ClearTextOnFocus = false;
  760. PlaceholderColor3 = Color3.fromRGB(255,255,255);
  761. PlaceholderText = placeholderText or '';
  762. Position = UDim2.new(0,10,0,height-10);
  763. Size = UDim2.new(0, 180, 0, 20);
  764. Text = '';
  765. TextColor3 = Color3.fromRGB(40,40,40);
  766. })
  767.  
  768. txtBox.Changed:connect(function()
  769. tbl.Text = txtBox.Text
  770. end)
  771.  
  772. height = height + 20
  773. window.Size = UDim2.new(0,200,0,height)
  774.  
  775. return tbl
  776. end
  777.  
  778. ------------------
  779.  
  780. function windowModule:KeyBind(title, key, callback)
  781. if not title or typeof(title) ~= 'string' then
  782. return sendNotification('Invalid Title!', 'You must set the title as a string for this keybind!')
  783. end
  784.  
  785. if not pcall(function() return Enum.KeyCode[key] end) then
  786. return sendNotification('Invalid KeyCode!', 'You cannot set `'..tostring(key)..'` as a keybind!')
  787. end
  788.  
  789. local keyCode = nil
  790. for a,b in next, Enum.KeyCode:GetEnumItems() do
  791. if tostring(b) == string.format('Enum.KeyCode.%s', key) then
  792. keyCode = b
  793. break
  794. end
  795. end
  796.  
  797. if not callback or typeof(callback) ~= 'function' then
  798. return sendNotification('Invalid Callback!', 'You must set the callback function for this keybind: ' .. key)
  799. end
  800.  
  801. table.insert(getgenv().LBConnections,
  802. Main.Services.UserInputService.InputBegan:connect(function(key)
  803. if key.KeyCode == keyCode then
  804. callback()
  805. end
  806. end)
  807. )
  808.  
  809. LB_MODULE:Create(window, 'TextLabel', {
  810. BackgroundTransparency = 1,
  811. Position = UDim2.new(0,10,0,height-10);
  812. Size = UDim2.new(0,180,0,20),
  813. TextSize = 10;
  814. TextXAlignment = 0;
  815. TextYAlignment = 0;
  816. Text = string.format('%s', title);
  817. TextColor3 = Main.COLOR.TEXT;
  818. })
  819.  
  820. LB_MODULE:Create(window, 'TextLabel', {
  821. BackgroundTransparency = 1,
  822. Position = UDim2.new(0,10,0,height-10);
  823. Size = UDim2.new(0,180,0,20),
  824. TextSize = 10;
  825. TextXAlignment = 1;
  826. TextYAlignment = 0;
  827. Text = string.format('[%s]', key);
  828. TextColor3 = Main.COLOR.TEXT;
  829. })
  830.  
  831. height = height + 20
  832. window.Size = UDim2.new(0,200,0,height)
  833.  
  834. return window
  835. end
  836.  
  837. ------------------
  838.  
  839. function windowModule:GUIDestroy()
  840. for a,b in next, getgenv().LBConnections do
  841. b:Disconnect()
  842. end
  843. script:Destroy()
  844. Main.GUI:Destroy()
  845. end
  846.  
  847. return windowModule
  848. end
  849. end
  850.  
  851. return LB_MODULE
Add Comment
Please, Sign In to add comment