Advertisement
Legend_Dev

ui lib

Oct 19th, 2019
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.67 KB | None | 0 0
  1. local Players = game.Players
  2. local Player = Players.LocalPlayer
  3. local Mouse = Player:GetMouse()
  4. if not _G.Theme then
  5. _G.Theme = {
  6. TextColor = Color3.new(1,1,1),
  7. TextFont = 'GothamBold',
  8. HoverColor = Color3.fromRGB(50,50,50),
  9. ClickColor = Color3.fromRGB(0,100,100),
  10. BackgroundColor = Color3.fromRGB(33,33,33),
  11. SliderColor = Color3.new(0,255,0),
  12. InfoColor = Color3.fromRGB(33,33,33),
  13. InfoTextColor = Color3.new(1,1,1),
  14. InfoTextFont = 'GothamBold',
  15. ToggledColor = Color3.new(0,255,0),
  16. CheckBoxColor = Color3.fromRGB(44,44,44),
  17. SliderButtonColor = Color3.new(0,255,0),
  18. }
  19. end
  20. local function ColorAdd(a,b)
  21. r,g,b = a.R+b.R,a.G+b.G,a.B+b.B
  22. return Color3.fromRGB(r,g,b)
  23. end
  24. local g = setmetatable({},{__metatable = 'This metatable is locked.'})
  25. g.Guis = {}
  26. g.Parent = Instance.new('ScreenGui',game.CoreGui)
  27.  
  28. g.new = function(self,text,Comment,TitleText)
  29. text = ' '..text
  30. local new = {}
  31. new.Children = {}
  32. new.FadeOut = function()
  33. for i,v in pairs(new.Children) do
  34. spawn(function()
  35. for i=1,10 do
  36. v.BackgroundTransparency = i/10
  37. wait()
  38. end
  39. v.Visible = false
  40. end)
  41. end
  42. end
  43. new.FadeIn = function()
  44. for i,v in pairs(new.Children) do
  45. spawn(function()
  46. v.Visible = true
  47. for i=1,10 do
  48. v.BackgroundTransparency = 1-(i/10)
  49. wait()
  50. end
  51. end)
  52. end
  53. end
  54.  
  55. local toggled = false
  56. self.Guis[text] = new
  57. local Gui = Instance.new('TextButton',self.Parent)
  58. new.Gui = Gui
  59. Gui.Text = text
  60. Gui.Size = UDim2.new(0,200,0,30)
  61. Gui.TextColor3 = _G.Theme.TextColor
  62. Gui.BackgroundColor3 = _G.Theme.BackgroundColor
  63. Gui.TextSize = 12
  64. Gui.Font = _G.Theme.TextFont
  65. Gui.BorderSizePixel = 0
  66. Gui.Draggable = true
  67. Gui.AutoButtonColor = false
  68. Gui.Position = UDim2.new(0,800,0,#g.Parent:GetChildren()*35)
  69. Gui.TextXAlignment = 'Left'
  70. local slider = Instance.new('Frame',Gui)
  71. slider.Size = UDim2.new(0,0,0,2)
  72. slider.Position = UDim2.new(.5,0,1,-2)
  73. slider.BorderSizePixel = 0
  74. slider.BackgroundColor3 = _G.Theme.SliderColor
  75. local info = Instance.new('TextLabel',Gui)
  76. info.Size = UDim2.new(0,0,1,0)
  77. info.Text = Comment
  78. info.BackgroundColor3 = _G.Theme.InfoColor
  79. info.TextSize = 12
  80. info.Position = UDim2.new(1,5,0,0)
  81. info.TextColor3 = _G.Theme.InfoTextColor
  82. info.ClipsDescendants = true
  83. info.Font = _G.Theme.InfoTextFont
  84. info.BorderSizePixel = 0
  85.  
  86. local infobar = Instance.new('Frame',info)
  87. infobar.Size = UDim2.new(1,0,0,2)
  88. infobar.Position = UDim2.new(0,0,1,-2)
  89. infobar.BackgroundColor3 = _G.Theme.SliderColor
  90. infobar.BorderSizePixel = 0
  91.  
  92. local Title = Instance.new('TextLabel',Gui)
  93. Title.Text = TitleText
  94. Title.Size = UDim2.new(1,0,1,0)
  95. Title.TextSize = 12
  96. Title.Font = _G.Theme.TextFont
  97. Title.TextColor3 = _G.Theme.TextColor
  98. Title.BackgroundColor3 = _G.Theme.BackgroundColor
  99. Title.Visible = false
  100. Title.BackgroundTransparency = 1
  101. Title.BorderSizePixel = 0
  102. Title.Position = UDim2.new(1,5,0,0)
  103.  
  104. local infobar = Instance.new('Frame',Title)
  105. infobar.Size = UDim2.new(1,0,0,2)
  106. infobar.Position = UDim2.new(0,0,1,-2)
  107. infobar.BackgroundColor3 = _G.Theme.ToggledColor
  108. infobar.BorderSizePixel = 0
  109.  
  110. table.insert(new.Children,Title)
  111. new.AddTab = function(Text)
  112. local a = Instance.new('TextLabel',Title)
  113. a.Position = UDim2.new(0,0,0,(#Title:GetChildren()-1)*30)
  114. a.Size = UDim2.new(1,0,1,0)
  115. a.Text = Text
  116. a.BackgroundColor3 = _G.Theme.BackgroundColor
  117. a.TextColor3 = _G.Theme.TextColor
  118. a.BorderSizePixel = 0
  119.  
  120. local b = Instance.new('Frame',a)
  121. b.Size = UDim2.new(1,0,0,2)
  122. b.Position = UDim2.new(0,0,1,-2)
  123. b.BorderSizePixel = 0
  124. b.BackgroundColor3 = _G.Theme.ToggledColor
  125. table.insert(new.Children,a)
  126. table.insert(new.Children,b)
  127.  
  128. local b = Instance.new('Frame',a)
  129. b.Size = UDim2.new(1,0,0,2)
  130. b.Position = UDim2.new(0,0,0,-2)
  131. b.BorderSizePixel = 0
  132. b.BackgroundColor3 = _G.Theme.ToggledColor
  133. table.insert(new.Children,a)
  134. table.insert(new.Children,b)
  135. end
  136. new.AddButton = function(Text)
  137. Text = ' '..Text
  138. local a = Instance.new('TextButton',Title);
  139. a.Size = UDim2.new(1,0,1,0)
  140. a.Position = UDim2.new(0,0,0,(#Title:GetChildren()-1)*30)
  141. a.Text = Text
  142. a.BackgroundColor3 = _G.Theme.BackgroundColor
  143. a.TextColor3 = _G.Theme.TextColor
  144. a.BorderSizePixel = 0
  145. a.TextXAlignment = 'Left'
  146. table.insert(new.Children,a)
  147. end
  148. new.AddChoose = function(Text,Preset,table)
  149. local a = Instance.new('TextLabel',Title)
  150. a.Size = UDim2.new(1,0,1,0)
  151. a.Position = UDim2.new(0,0,0,(#Title:GetChildren()-1)*30)
  152. a.Text = Preset
  153. a.BackgroundColor3 = _G.Theme.BackgroundColor
  154. a.TextColor3 = _G.Theme.TextColor
  155. a.BorderSizePixel = 0
  156. a.TextXAlignment = 'Left'
  157. new.Children[#new.Children+1] = a
  158. local b = Instance.new('TextButton',a)
  159. b.Size = UDim2.new(0,30,0,30)
  160. b.BackgroundTransparency = 1
  161. b.TextColor3 = _G.Theme.TextColor
  162. b.Text = '►'
  163. b.Position = UDim2.new(1,-30,0,0)
  164. local niggers = {}
  165.  
  166. --table.insert(new.Children,b)
  167. b.MouseButton1Click:connect(function()
  168. a.Text = Text
  169. if b.Text == '►' then
  170. b.Text = '◄'
  171. for i,v in pairs(table) do
  172. if not niggers[v] then
  173. local x = Instance.new('TextButton',b)
  174. x.Size = UDim2.new(0,200,0,30)
  175. x.BackgroundColor3 = _G.Theme.BackgroundColor
  176. x.Text = ' '..v
  177. x.Position = UDim2.new(1,0,0,30*(i-1))
  178. niggers[v] = x
  179. x.TextColor3 = _G.Theme.TextColor
  180. x.BorderSizePixel = 0
  181. x.MouseButton1Click:connect(function()
  182. a.Text = v
  183. for i,v in pairs(niggers) do
  184. v.Visible = false
  185. end
  186. b.Text = '►'
  187. end)
  188. else
  189. niggers[v].Visible = true
  190. end
  191. end
  192. else
  193. a.Text = Preset
  194. b.Text = '►'
  195. for i,v in pairs(niggers) do
  196. v.Visible = false
  197. end
  198. end
  199. end)
  200. return a
  201. end
  202. new.AddToggle = function(Text)
  203. Text = ' '..Text
  204. local toggle = false
  205. local a = Instance.new('TextLabel',Title);
  206. a.Size = UDim2.new(1,0,1,0)
  207. a.Position = UDim2.new(0,0,0,(#Title:GetChildren()-1)*30)
  208. a.Text = Text
  209. a.TextXAlignment = 'Left'
  210. a.BackgroundColor3 = _G.Theme.BackgroundColor
  211. a.TextColor3 = _G.Theme.TextColor
  212. a.BorderSizePixel = 0
  213. a.Name = Text
  214. local b = Instance.new('TextButton',a)
  215. b.Position = UDim2.new(1,-30,0,0)
  216. b.Size = UDim2.new(0,30,0,30)
  217. b.TextColor3 = _G.Theme.TextColor
  218. b.BackgroundColor3 = _G.Theme.CheckBoxColor
  219. b.BorderSizePixel = 0
  220. b.Text = ''
  221. b.TextSize = 12
  222. b.Font = _G.Theme.TextFont
  223. b.Name = 'Holder'
  224. b.AutoButtonColor = false
  225. local c = Instance.new('Frame',b)
  226. c.Size = UDim2.new(.5,0,.5,0)
  227. c.Position = UDim2.new(.23,0,.23,0)
  228. c.BackgroundColor3 = Color3.new(0,255,0)
  229. c.BackgroundTransparency = .3
  230. c.BorderSizePixel = 0
  231. c.Visible = false
  232. c.Name = 'Toggle'
  233. b.MouseButton1Click:connect(function()
  234. toggle = not toggle
  235. c.Visible = toggle
  236. end)
  237. table.insert(new.Children,a)
  238. table.insert(new.Children,b)
  239. --table.insert(new.Children,c)
  240. return c
  241. end
  242. new.AddSlider = function(Text,max)
  243. Text = ' '..Text
  244. local a = Instance.new('TextLabel',Title)
  245. a.Size = UDim2.new(1,0,1,0)
  246. a.Position = UDim2.new(0,0,0,(#Title:GetChildren()-1)*30)
  247. a.Text = Text
  248. a.TextXAlignment = 'Left'
  249. a.BackgroundColor3 = _G.Theme.BackgroundColor
  250. a.BorderSizePixel = 0
  251. a.TextColor3 = _G.Theme.TextColor
  252. local b = Instance.new('TextButton',a)
  253. b.Size = UDim2.new(.55,0,0,2)
  254. b.Position = UDim2.new(.30,0,.5,-1)
  255. b.BackgroundColor3 = _G.Theme.SliderColor
  256. b.BorderSizePixel = 0
  257. b.AutoButtonColor = false
  258. b.Text = ''
  259. local c = Instance.new('TextButton',b)
  260. c.Size = UDim2.new(0,9,0,9)
  261. c.Position = UDim2.new(0,0,.5,-4)
  262. c.Text = ''
  263. c.BackgroundColor3 = _G.Theme.SliderButtonColor
  264. c.BorderSizePixel = 0
  265. local val = Instance.new('TextLabel',b)
  266. val.Size = UDim2.new(0,30,0,30)
  267. val.Text = 0
  268. val.TextColor3 = _G.Theme.TextColor
  269. val.BackgroundTransparency = 1
  270. val.Position = UDim2.new(1,0,0,-15)
  271. table.insert(new.Children,a)
  272. table.insert(new.Children,b)
  273. table.insert(new.Children,c)
  274. local UserInputService = game:GetService("UserInputService")
  275.  
  276. local gui = c
  277.  
  278. local dragging
  279. local dragInput
  280. local dragStart
  281. local startPos
  282.  
  283. b.MouseButton1Down:connect(function()
  284. c.Position = UDim2.new(0,math.clamp(Mouse.X-b.AbsolutePosition.X,0,b.AbsoluteSize.X-2),0,-4)
  285. local perc = (b.AbsoluteSize.X-2)/gui.Position.X.Offset
  286. val.Text = math.floor(max/perc)
  287. end)
  288.  
  289. local function update(input)
  290. local delta = input.Position - dragStart
  291. gui.Position = UDim2.new(0, math.clamp(startPos.X.Offset + delta.X,0,b.AbsoluteSize.X-2), 0, -4)
  292. local perc = (b.AbsoluteSize.X-2)/gui.Position.X.Offset
  293. val.Text = math.floor(max/perc)
  294. end
  295.  
  296. gui.InputBegan:Connect(function(input)
  297. if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  298. dragging = true
  299. dragStart = input.Position
  300. startPos = gui.Position
  301.  
  302. input.Changed:Connect(function()
  303. if input.UserInputState == Enum.UserInputState.End then
  304. dragging = false
  305. end
  306. end)
  307. end
  308. end)
  309.  
  310. gui.InputChanged:Connect(function(input)
  311. if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
  312. dragInput = input
  313. end
  314. end)
  315.  
  316. UserInputService.InputChanged:Connect(function(input)
  317. if input == dragInput and dragging then
  318. update(input)
  319. end
  320. end)
  321. return val
  322. end
  323. new.AddColorSelection = function(Text)
  324.  
  325. end
  326.  
  327. local Tween = game:GetService'TweenService'
  328. local TweenInfo = TweenInfo.new(0.5, Enum.EasingStyle.Back)
  329. local spare = Instance.new('Frame',Gui)
  330. spare.BackgroundTransparency = 1
  331. spare.Size = UDim2.new(1,0,1,0)
  332. spare.ClipsDescendants = true
  333. Gui.MouseEnter:connect(function()
  334. slider:TweenSize(UDim2.new(1,0,0,-2),'Out','Sine',.3,true)
  335. slider:TweenPosition(UDim2.new(0,0,1,2),'Out','Sine',.3,true)
  336. if not toggled then
  337. info:TweenSize(UDim2.new(1,0,0.8,0),'Out','Sine',.5,true)
  338. end
  339. local tween = Tween:Create(Gui,TweenInfo,{BackgroundColor3 = _G.Theme.HoverColor})
  340. tween:Play()
  341. end)
  342. Gui.MouseLeave:connect(function()
  343. slider:TweenSize(UDim2.new(0,0,0,2),'Out','Sine',.3,true)
  344. slider:TweenPosition(UDim2.new(.5,0,1,-2),'Out','Sine',.3,true)
  345. info:TweenSize(UDim2.new(0,0,1,0),'Out','Sine',.5,true)
  346. local tween = Tween:Create(Gui,TweenInfo,{BackgroundColor3 = _G.Theme.BackgroundColor})
  347. tween:Play()
  348. end)
  349. Gui.MouseButton1Click:connect(function()
  350. -- info:TweenSize(UDim2.new(0,0,1,0),'Out','Sine',.2,true)
  351. info.Size = UDim2.new(0,0,1,0)
  352. spawn(function()
  353. local x = Instance.new('ImageLabel',spare)
  354. x.Size = UDim2.new(0,5,0,5)
  355. x.Position = UDim2.new(0,Mouse.X-Gui.AbsolutePosition.X,0,Mouse.Y-Gui.AbsolutePosition.Y)
  356. x.Image = "rbxassetid://63379753"
  357. x.ImageTransparency = .1
  358. x.ImageColor3 = _G.Theme.ClickColor
  359. x.BackgroundTransparency = 1
  360. x.BorderSizePixel = 0
  361. x:TweenSizeAndPosition(UDim2.new(0,300,0,300),UDim2.new(0,x.Position.X.Offset-150,0,x.Position.Y.Offset-150),'Out','Sine',1)
  362. for i=0.1,1,.05 do
  363. x.ImageTransparency = i+.1
  364. wait()
  365. end
  366. x:Destroy()
  367. end)
  368. toggled = not toggled
  369. if toggled then
  370. new.FadeIn()
  371. else
  372. new.FadeOut()
  373. end
  374. end)
  375. return new
  376. end
  377.  
  378. local Gui = g:new('Title', 'The preview text',' The Settings text')
  379. Gui.AddTab('Text')
  380. Gui.AddButton('Text')
  381. Gui.AddChoose('Text','Default Value', {'Value1','Value2'})
  382. Gui.AddTab('Text2')
  383. Gui.AddSlider('Text', 1000)
  384. Gui.AddToggle('Text')
  385.  
  386. local Gi = g:new('Title', 'The preview text',' The Settings text')
  387. Gi.AddTab('Tet')
  388. Gi.AddButton('Tet')
  389. Gi.AddChoose('Tet','Default Vlue', {'Valu1','Valu2'})
  390. Gi.AddSlider('Tet', 100)
  391. Gi.AddToggle('Tet')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement