Advertisement
dkg_yt

uilib

Feb 20th, 2020
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.04 KB | None | 0 0
  1. local options = {
  2. rgb = true,
  3. sexy = false,
  4. stripescolor = Color3.fromRGB(35, 35, 35),
  5. topcolor = Color3.fromRGB(30, 30, 30),
  6. textcolor = Color3.fromRGB(255, 255, 255),
  7. slidercolor = Color3.fromRGB(255, 0, 55),
  8. underlinecolor = Color3.fromRGB(255, 0, 55),
  9. animatedbackground = false,
  10. togglekey = Enum.KeyCode.RightShift,
  11. sliderbackground = true,
  12. titlefont = Enum.Font.GothamBold,
  13. font = Enum.Font.Code,
  14. }
  15.  
  16. --[[ Library ]]--
  17.  
  18. local library = {}
  19. local tabs = {}
  20.  
  21. local TweenService = game:GetService("TweenService")
  22. local ws = game:GetService("Workspace")
  23. local uis = game:GetService("UserInputService")
  24. local rs = game:GetService("RunService")
  25.  
  26. local Design1 = Instance.new("ScreenGui")
  27.  
  28. Design1.Name = "Design1"
  29. Design1.Parent = game.CoreGui
  30.  
  31. local function GetWindowSize ()
  32. local ws = game:GetService("Workspace")
  33. local X = ws.Camera.ViewportSize.X
  34. local Y = ws.Camera.ViewportSize.Y
  35. return {["X"] = X, ["Y"] = Y}
  36. end
  37.  
  38. local uiengineinternals = {okhand = false, isreset = false, uiuwu = {
  39. howmuchtoincrease = 0.50,
  40. thecheck = math.floor(GetWindowSize().X / 300) - 1 -- new way of rows credits: sing (smart)
  41. }}
  42.  
  43. local oldPositions = {}
  44. local isopen = true
  45. local canaction = false
  46.  
  47. local function Resize (part,new,_delay)
  48. _delay = _delay or 0.3
  49. local tweenInfo = TweenInfo.new(_delay, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
  50. local tween = TweenService:Create(part, tweenInfo, new)
  51. tween:Play()
  52. end
  53.  
  54. uis.InputBegan:connect(function(inputobj)
  55. if inputobj.KeyCode == options.togglekey then
  56. if not canaction then
  57. return
  58. end
  59. if isopen then -- Closing
  60. canaction = false
  61. for index,tab in next, tabs do
  62. oldPositions[index] = tab.Position
  63. Resize(tab,{Position = UDim2.new(-1, 0, -1, 0)})
  64. end
  65. spawn(function() wait(0.5) canaction = true end)
  66. else -- Opening
  67. canaction = false
  68. for index,tab in next, tabs do
  69. Resize(tab,{Position = oldPositions[index]})
  70. end
  71. spawn(function() wait(0.5) canaction = true end)
  72. end
  73. isopen = not isopen
  74. end
  75. end)
  76.  
  77. local function CreateDrag (gui)
  78. local UserInputService = game:GetService("UserInputService")
  79. local dragging
  80. local dragInput
  81. local dragStart
  82. local startPos
  83.  
  84. local function update(input)
  85. local delta = input.Position - dragStart
  86. Resize(gui, {Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)}, 0.3)
  87. end
  88.  
  89. gui.InputBegan:Connect(function(input)
  90. if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  91. dragging = true
  92. dragStart = input.Position
  93. startPos = gui.Position
  94.  
  95. input.Changed:Connect(function()
  96. if input.UserInputState == Enum.UserInputState.End then
  97. dragging = false
  98. end
  99. end)
  100. end
  101. end)
  102.  
  103. gui.InputChanged:Connect(function(input)
  104. if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
  105. dragInput = input
  106. end
  107. end)
  108.  
  109. UserInputService.InputChanged:Connect(function(input)
  110. if input == dragInput and dragging then
  111. update(input)
  112. end
  113. end)
  114. end
  115.  
  116. local function Divider (hue, brightness, transparency, contrastlevel, speed, rpart)
  117. local Fragments = {}
  118. local length = rpart.AbsoluteSize.X
  119. local height = rpart.AbsoluteSize.Y
  120.  
  121. local function ColorFragment (n,c)
  122. local p = Fragments[n]
  123. p.BackgroundColor3 = c
  124. end
  125.  
  126. local WindowSize = GetWindowSize()
  127. local len = tonumber(tostring(rpart.Size.X):match("%d%p (%d+)"))
  128. for i = 1, length do
  129. Fragment = Instance.new("Frame", rpart)
  130. Fragment.BorderSizePixel = 0
  131. Fragment.Size = UDim2.new(0, 1, 0, height)
  132. Fragment.Position = UDim2.new((i - 1) / len, 0, 0, 0)
  133. Fragment.Transparency = transparency
  134. Fragment.ZIndex = rpart.ZIndex
  135.  
  136. table.insert(Fragments, Fragment)
  137.  
  138. local seth = hue + i / contrastlevel
  139. local setcolor = Color3.fromHSV(seth / 255 % 1, 1, brightness)
  140. ColorFragment(i, setcolor)
  141. end
  142.  
  143. local function Set (howmuch)
  144. for i = 1, length do
  145. local newh = hue + howmuch + i / contrastlevel
  146. local newcolor = Color3.fromHSV(newh / 255 % 1, 1, brightness)
  147. ColorFragment(i, newcolor)
  148. end
  149. end
  150.  
  151. local function Rotate ()
  152. for i = 255, 1, -1 do
  153. Set(i)
  154. wait(speed)
  155. end
  156. Set(0)
  157. end
  158.  
  159. spawn(Rotate)
  160.  
  161. spawn(function()
  162. while wait() do
  163. Rotate()
  164. end
  165. end)
  166. end
  167.  
  168. local function CreateTop (text)
  169. text = text or "New tab"
  170. local part = Instance.new("Frame", Design1)
  171.  
  172. local maxtabs = GetWindowSize().X / 300
  173.  
  174. if #tabs > uiengineinternals.uiuwu.thecheck and not uiengineinternals["okhand"] then
  175. uiengineinternals["isreset"] = true
  176. end
  177.  
  178. if uiengineinternals["isreset"] then
  179. part.Position = UDim2.new(0, 100, #tabs > uiengineinternals.uiuwu.thecheck and uiengineinternals.uiuwu.howmuchtoincrease or 0, 50)
  180. uiengineinternals["isreset"] = false
  181. uiengineinternals["okhand"] = true
  182. else
  183. part.Position = UDim2.new(0, #tabs == 0 and 100 or tabs[#tabs].Position.X.Offset + 300, #tabs > uiengineinternals.uiuwu.thecheck and uiengineinternals.uiuwu.howmuchtoincrease or 0, 50)
  184. end
  185.  
  186. part.Size = UDim2.new(0, 250, 0, 25)
  187. -- part.Position = UDim2.new(0, 100 + 300 * #tabs, 0, 50)
  188. part.BorderSizePixel = 4
  189. part.BorderColor3 = Color3.fromRGB(40, 40, 40)
  190. part.BackgroundColor3 = options.topcolor
  191. part.Draggable = true
  192. part.ZIndex = 3
  193.  
  194. local label = Instance.new("TextLabel", part)
  195. label.Size = part.Size
  196. label.BackgroundTransparency = 1
  197. label.TextSize = 19
  198. label.TextStrokeColor3 = Color3.new(0, 0, 0)
  199. label.TextStrokeTransparency = 0
  200. label.TextXAlignment = Enum.TextXAlignment.Right
  201. label.Font = options.titlefont
  202. label.TextColor3 = options.textcolor
  203. label.ZIndex = part.ZIndex
  204. label.Text = tostring(text) .. " "
  205. CreateDrag(part)
  206. table.insert(tabs, part)
  207.  
  208. local underline = Instance.new("Frame", part)
  209. underline.BackgroundColor3 = options.underlinecolor
  210. underline.BorderSizePixel = 0
  211. underline.Size = UDim2.new(0, 258, 0, 4)
  212. underline.Position = UDim2.new(0.5, -129, 1.2, -4)
  213. underline.ZIndex = part.ZIndex
  214. if options.rgb then
  215. --Divider(1, 2, 0, 2, 2, underline)
  216. function SCRIPT_CEHC71_FAKESCRIPT() -- Label.Script
  217. local script = Instance.new('Script')
  218. script.Parent = underline
  219. while wait() do
  220. local r = (math.sin(workspace.DistributedGameTime/2)/2)+0.5
  221. local g = (math.sin(workspace.DistributedGameTime)/2)+0.5
  222. local b = (math.sin(workspace.DistributedGameTime*1.5)/2)+0.5
  223. local color = Color3.new(r, g, b)
  224. script.Parent.BackgroundColor3 = color
  225. end
  226.  
  227. end
  228. coroutine.resume(coroutine.create(SCRIPT_CEHC71_FAKESCRIPT))
  229. end
  230. if options.sexy then
  231. Divider(1, 2, 0, 2, 2, underline)
  232. end
  233.  
  234. return part
  235. end
  236.  
  237. function library:CreateWindow (name)
  238. local elements = {}
  239. local parts = {}
  240.  
  241. local pixelspacing = 35
  242.  
  243. local Top = CreateTop(name)
  244. local body = Instance.new("Frame", Top)
  245.  
  246. body.Size = UDim2.new(0, 250, 0, 0)
  247. body.Position = UDim2.new(0.5, -125, 6.5, -130)
  248. body.BackgroundColor3 = Color3.fromRGB(32, 32, 32)
  249. body.BorderSizePixel = 4
  250. body.BorderColor3 = Color3.fromRGB(40, 40, 40)
  251. body.ClipsDescendants = true
  252.  
  253. local bodyelements = Instance.new("Frame", body)
  254. bodyelements.ZIndex = 2
  255. bodyelements.Size = body.Size + UDim2.new(0, 0, 0, 1000)
  256. bodyelements.BackgroundTransparency = 1
  257.  
  258. local function CreateBackground (color)
  259. local background = Instance.new("Frame", body)
  260. local function CreateSection (pos)
  261. local section = Instance.new("ImageLabel", background)
  262.  
  263. section.BackgroundColor3 = Color3.new(1, 1, 1)
  264. section.Position = pos
  265. section.Size = UDim2.new(0, 200, 0, 200)
  266. section.BackgroundTransparency = 1
  267. section.Image = "rbxassetid://3669652152" --background img
  268. section.ImageColor3 = color
  269. end
  270.  
  271. for x = 0, 2 do
  272. for i = 0, 5 do
  273. CreateSection(UDim2.new(0, 197 * x, 0, i * 200 - (i * 3)))
  274. end
  275. end
  276.  
  277. local function Rotate (speed)
  278. local oldpos = UDim2.new(0, 0, 0, 0)
  279. local newpos = UDim2.new(-1, 93, 0, 0)
  280. local tweenInfo = TweenInfo.new(speed, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
  281. local tween = TweenService:Create(background, tweenInfo, {Position = newpos})
  282.  
  283. tween:Play()
  284. wait(speed - 0.1)
  285. background.Position = oldpos
  286. end
  287.  
  288. spawn(function()
  289. while true do
  290. Rotate(10)
  291. end
  292. end)
  293. end
  294. if options.animatedbackground then
  295. CreateBackground(options.stripescolor)
  296. end
  297. local actionbutton = Instance.new("TextButton", Top)
  298. actionbutton.BackgroundTransparency = 1
  299. actionbutton.TextScaled = true
  300. actionbutton.TextColor3 = options.textcolor
  301. actionbutton.TextStrokeTransparency = 0
  302. actionbutton.TextStrokeColor3 = Color3.new(1, 1, 1)
  303. actionbutton.Size = UDim2.new(0, 25, 0, 25)
  304. actionbutton.Position = UDim2.new(0.02, 0, 0, 0)
  305. actionbutton.Text = "^"
  306. actionbutton.Rotation = 180
  307. actionbutton.ZIndex = Top.ZIndex
  308.  
  309. local function Close ()
  310. Resize(body,{Size = UDim2.new(0, 250, 0, 0), Position = UDim2.new(0.5, -125, 6.5, -150)})
  311. actionbutton.Text = ">"
  312. Resize(actionbutton, {Rotation = 180}, 0.25)
  313. actionbutton.Rotation = 0
  314. end
  315.  
  316. local function Open ()
  317. Resize(body, {Size = UDim2.new(0, 250, 0, pixelspacing * #parts), Position = UDim2.new(0.5, -125, 6.5, -130)})
  318. actionbutton.Text = "^"
  319. Resize(actionbutton, {Rotation = -180}, 0.25)
  320. actionbutton.Rotation = 0
  321. end
  322.  
  323. local open = true
  324. actionbutton.MouseButton1Click:connect(function()
  325. open = not open
  326. func = open and Open or Close
  327. func()
  328. end)
  329.  
  330. function elements:CreateButton (text, callback)
  331. text = text or "New button"
  332. callback = callback or function() end
  333.  
  334. local button = Instance.new("TextButton", bodyelements)
  335.  
  336. button.Size = UDim2.new(0, 240, 0, 30)
  337. button.Position = UDim2.new(0.02, 0, (pixelspacing / 1000) * #parts + 0.0025, 0)
  338. button.BackgroundTransparency = 0.1
  339. button.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
  340. button.BorderSizePixel = 1.5
  341. button.BorderColor3 = Color3.fromRGB(20, 20, 20)
  342. button.TextColor3 = Color3.new(1, 1, 1)
  343. button.TextSize = 18
  344. button.TextXAlignment = Enum.TextXAlignment.Left
  345. button.Font = options.font
  346. button.Text = " " .. tostring(text)
  347. button.ZIndex = bodyelements.ZIndex
  348.  
  349. button.MouseButton1Click:connect(function()
  350. pcall(callback)
  351. end)
  352.  
  353. Resize(body, {Size = UDim2.new(0, 250, 0, pixelspacing * #parts + 35)})
  354.  
  355. table.insert(parts, button)
  356. end
  357.  
  358. function elements:CreateSwitch (text, callback)
  359. local switchactions = {}
  360. text = text or "New switch"
  361. callback = callback or function() end
  362.  
  363. local switch = Instance.new("TextLabel", bodyelements)
  364. switch.Size = UDim2.new(0, 240, 0, 30)
  365. switch.Position = UDim2.new(0.02, 0, (pixelspacing / 1000) * #parts + 0.0025, 0)
  366. switch.BackgroundTransparency = 1
  367. switch.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
  368. switch.BorderSizePixel = 0
  369. switch.TextColor3 = Color3.new(1, 1, 1)
  370. switch.TextSize = 14
  371. switch.TextXAlignment = Enum.TextXAlignment.Left
  372. switch.Font = options.font
  373. switch.Text = " " .. tostring(text)
  374. switch.ZIndex = bodyelements.ZIndex
  375.  
  376. local enabled = false
  377. local checkmark = Instance.new("TextButton", switch)
  378. checkmark.Size = UDim2.new(0, 20, 0, 20)
  379. checkmark.Position = UDim2.new(0.9, 0, 0.15, 0)
  380. checkmark.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
  381. checkmark.BorderColor3 = Color3.fromRGB(45, 45, 45)
  382. checkmark.BorderSizePixel = 1
  383. checkmark.TextColor3 = Color3.new(1, 1, 1)
  384. checkmark.TextScaled = true
  385. checkmark.Text = ""
  386. checkmark.ZIndex = switch.ZIndex
  387. checkmark.AutoButtonColor = false
  388.  
  389. local function Trigger ()
  390. enabled = not enabled
  391. checkmark.Text = enabled and utf8.char(10003) or ""
  392. pcall(callback, enabled)
  393. end
  394.  
  395. checkmark.MouseButton1Click:connect(Trigger)
  396.  
  397. function switchactions:Set (state)
  398. enabled = state
  399. checkmark.Text = enabled and utf8.char(10003) or ""
  400. pcall(callback, enabled)
  401. end
  402.  
  403. Resize(body, {Size = UDim2.new(0, 250, 0, pixelspacing * #parts + 35)})
  404. table.insert(parts, switch)
  405.  
  406. return switchactions
  407. end
  408.  
  409. function elements:CreateBox(placeholder, callback)
  410. placeholder = placeholder or "New Box"
  411. callback = callback or function() end
  412. local button = Instance.new("TextBox", bodyelements)
  413. button.Size = UDim2.new(0, 240, 0, 30)
  414. button.Position = UDim2.new(0.02, 0, (pixelspacing / 1000) * #parts + 0.0025, 0)
  415. button.BackgroundTransparency = 1
  416. button.BorderSizePixel = 0
  417. button.TextColor3 = Color3.fromRGB(255, 255, 255)
  418. button.TextSize = 14
  419. button.TextXAlignment = Enum.TextXAlignment.Center
  420. button.Font = options.font
  421. button.Text = ""
  422. button.PlaceholderText = placeholder
  423. button.ZIndex = bodyelements.ZIndex
  424. button.FocusLost:connect(function()
  425. pcall(callback, button.Text)
  426. button.Text = ""
  427. end)
  428. Resize(body, {Size = UDim2.new(0, 250, 0, pixelspacing * #parts + 35)})
  429. table.insert(parts, button)
  430. end
  431.  
  432. function elements:CreateLabel(text)
  433. text = text or "New Label"
  434. local button = Instance.new("TextLabel", bodyelements)
  435. button.Size = UDim2.new(0, 240, 0, 30)
  436. button.Position = UDim2.new(0.02, 0, (pixelspacing / 1000) * #parts + 0.0025, 0)
  437. button.BackgroundTransparency = 1
  438. button.BorderSizePixel = 0
  439. button.TextColor3 = Color3.fromRGB(255, 255, 255)
  440. button.TextSize = 14
  441. button.TextXAlignment = Enum.TextXAlignment.Center
  442. button.Font = options.font
  443. button.Text = text
  444. button.ZIndex = bodyelements.ZIndex
  445. Resize(body, {Size = UDim2.new(0, 250, 0, pixelspacing * #parts + 35)})
  446. table.insert(parts, button)
  447. end
  448.  
  449. function elements:CreateSlider (text, minvalue, maxvalue, callback)
  450. local slideractions = {}
  451. text = text or "New slider"
  452. minvalue = minvalue or 0
  453. maxvalue = maxvalue or 100
  454. callback = callback or function() end
  455.  
  456. local box = Instance.new("TextLabel", bodyelements)
  457. box.Size = UDim2.new(0, 240, 0, 30)
  458. box.Position = UDim2.new(0.02, 0, (pixelspacing / 1000) * #parts + 0.0025, 0)
  459. box.BackgroundTransparency = 1
  460. box.TextColor3 = options.textcolor
  461. box.TextSize = 14
  462. box.TextXAlignment = Enum.TextXAlignment.Left
  463. box.TextYAlignment = Enum.TextYAlignment.Top
  464. box.Font = options.font
  465. box.Text = " " .. tostring(text)
  466. box.ZIndex = bodyelements.ZIndex
  467.  
  468. local value = Instance.new("TextLabel", box)
  469. value.Size = UDim2.new(0, 40, 0, 30)
  470. value.Position = UDim2.new(0.75, 0, 0, 0)
  471. value.BackgroundTransparency = 1
  472. value.TextColor3 = options.textcolor
  473. value.Text = minvalue
  474. value.TextSize = 10
  475. value.ZIndex = box.ZIndex
  476. value.TextYAlignment = Enum.TextYAlignment.Top
  477.  
  478. local container = Instance.new("ImageLabel", box)
  479. container.BackgroundTransparency = 1
  480. container.Position = UDim2.new(0.06, 0, 0.6, 0)
  481. container.Size = UDim2.new(0, 200, 0, 5)
  482. container.Image = "rbxassetid://2851926732"
  483. container.ImageColor3 = Color3.fromRGB(100, 100, 100)
  484. container.ScaleType = Enum.ScaleType.Slice
  485. container.SliceCenter = Rect.new(12, 12, 12, 12)
  486. container.ZIndex = box.ZIndex
  487.  
  488. local containerindicator = Instance.new("ImageLabel", container)
  489. containerindicator.BackgroundTransparency = 1
  490. containerindicator.Size = UDim2.new(0, 0, 0, 5)
  491. containerindicator.Image = "rbxassetid://2851926732"
  492. containerindicator.ImageColor3 = options.slidercolor
  493. containerindicator.ScaleType = Enum.ScaleType.Slice
  494. containerindicator.SliceCenter = Rect.new(12, 12, 12, 12)
  495. containerindicator.ZIndex = container.ZIndex
  496.  
  497. local ball = Instance.new("TextButton", container)
  498. ball.BackgroundTransparency = 1
  499. ball.Size = UDim2.new(0, 10, 0, 10)
  500. ball.Position = UDim2.new(0, 0, 0, -2.5)
  501. ball.BackgroundTransparency = 1
  502. ball.ZIndex = container.ZIndex
  503. ball.Text = ""
  504.  
  505. local balltexture = Instance.new("ImageLabel", ball)
  506. balltexture.Size = UDim2.new(1, 0, 1, 0)
  507. balltexture.Image = "rbxassetid://2851926732"
  508. balltexture.ScaleType = Enum.ScaleType.Slice
  509. balltexture.SliceCenter = Rect.new(12, 12, 12, 12)
  510. balltexture.ZIndex = ball.ZIndex
  511. balltexture.BackgroundTransparency = 1
  512.  
  513. do -- Slider math
  514. local currentvalue = minvalue
  515.  
  516. local Dragging
  517. ball.MouseButton1Down:connect(function()
  518. Dragging = true
  519. end)
  520. uis.InputEnded:Connect(function(inputObject)
  521. if inputObject.UserInputType == Enum.UserInputType.MouseButton1 then
  522. Dragging = false
  523. end
  524. end)
  525.  
  526. local originalpos = ball.Position
  527.  
  528. local function GetValue ()
  529. local maxval = container.AbsoluteSize.X
  530. local currentval = ball.Position.X.Offset
  531. return math.floor((currentval / maxval) * (maxvalue - minvalue) + minvalue)
  532. end
  533.  
  534. local function SetValue (x)
  535. local newposition = UDim2.new(
  536. UDim.new(
  537. 0,
  538. math.clamp(x, 0, container.AbsoluteSize.X)
  539. ),
  540. originalpos.Y
  541. )
  542. Resize(ball, {Position = newposition}, 0.14)
  543. if options.sliderbackground then
  544. local newsize = UDim2.new(
  545. UDim.new(
  546. 0,
  547. math.clamp(x, 0, container.AbsoluteSize.X)
  548. ), 0, 0
  549. ) + UDim2.new(0, 0, 0, 5)
  550. Resize(containerindicator, {Size = newsize}, 0.14)
  551. end
  552. value.Text = tostring(GetValue())
  553. end
  554.  
  555. uis.InputChanged:connect(function(InputObject, GameProcessedEvent)
  556. if ((not GameProcessedEvent) and Dragging) then
  557. if (InputObject.UserInputType == Enum.UserInputType.MouseMovement) then
  558. local set = InputObject.Position.X - container.AbsolutePosition.X
  559. SetValue(set)
  560. end
  561. end
  562. end)
  563.  
  564. value:GetPropertyChangedSignal("Text"):Connect(function()
  565. pcall(callback, GetValue())
  566. end)
  567.  
  568. function slideractions:Set (x) -- broken :(
  569. SetValue((x / (maxvalue - minvalue) + minvalue) / 200)
  570. end
  571. end
  572.  
  573. Resize(body, {Size = UDim2.new(0, 250, 0, pixelspacing * #parts + 35)})
  574. table.insert(parts, box)
  575. return slideractions
  576. end
  577.  
  578. spawn(function() wait(0.5) canaction = true end)
  579.  
  580. return elements
  581. end
  582.  
  583. return library
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement