Legend_Dev

Untitled

Apr 14th, 2020
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.66 KB | None | 0 0
  1. local Library = {}
  2. local UILib = Instance.new("ScreenGui")
  3. local TabXPosition = 30
  4.  
  5. UILib.Name = "UILib"
  6. UILib.Parent = game:GetService("CoreGui")
  7. UILib.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
  8.  
  9. function Library:Tab(name)
  10. local Tab = Instance.new("TextLabel")
  11. local TabFrame = Instance.new("Frame")
  12. local TabFrameSize = 0
  13. local TabMouseLeft = true
  14. local TabFrameMouseLeft = true
  15. local DropDownFrameMouseLeft = true
  16. local ButtonListLayout = Instance.new("UIListLayout")
  17.  
  18. local function dragify(Frame)
  19. local dragToggle = nil
  20. local dragInput = nil
  21. local dragStart = nil
  22. local dragPos = nil
  23. local startPos = nil
  24. local Delta = nil
  25. local Position = nil
  26.  
  27. local function updateInput(input)
  28. Delta = input.Position - dragStart
  29. Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + Delta.X, startPos.Y.Scale, startPos.Y.Offset + Delta.Y)
  30. game:GetService("TweenService"):Create(Frame, TweenInfo.new(.15), {Position = Position}):Play()
  31. end
  32.  
  33. Frame.InputBegan:Connect(function(input)
  34. if (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then
  35. dragToggle = true
  36. dragStart = input.Position
  37. startPos = Frame.Position
  38. input.Changed:Connect(function()
  39. if (input.UserInputState == Enum.UserInputState.End) then
  40. dragToggle = false
  41. end
  42. end)
  43. end
  44. end)
  45.  
  46. Frame.InputChanged:Connect(function(input)
  47. if (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then
  48. dragInput = input
  49. end
  50. end)
  51.  
  52. game:GetService("UserInputService").InputChanged:Connect(function(input)
  53. if (input == dragInput and dragToggle) then
  54. updateInput(input)
  55. end
  56. end)
  57. end
  58.  
  59. Tab.Name = name
  60. Tab.Parent = UILib
  61. Tab.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
  62. Tab.BorderSizePixel = 0
  63. Tab.Position = UDim2.new(0, TabXPosition, 0, 30)
  64. Tab.Size = UDim2.new(0, 100, 0, 20)
  65. Tab.Font = Enum.Font.SciFi
  66. Tab.Text = name
  67. Tab.TextColor3 = Color3.new(1, 1, 1)
  68. Tab.TextSize = 14
  69.  
  70. TabXPosition = TabXPosition + 130
  71. dragify(Tab)
  72.  
  73. TabFrame.Name = "TabFrame"
  74. TabFrame.Parent = Tab
  75. TabFrame.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
  76. TabFrame.BorderSizePixel = 0
  77. TabFrame.Position = UDim2.new(0, 0, 0, 20)
  78. TabFrame.Size = UDim2.new(0, 100, 0, 0)
  79.  
  80.  
  81. ButtonListLayout.Name = "ButtonListLayout"
  82. ButtonListLayout.Parent = TabFrame
  83. ButtonListLayout.SortOrder = Enum.SortOrder.LayoutOrder
  84.  
  85. local TabLibrary = {}
  86.  
  87. function TabLibrary:Button(text, func)
  88. TabFrameSize = TabFrameSize + 20
  89. TabFrame.Size = UDim2.new(0, 100, 0, TabFrameSize)
  90. local Button = Instance.new("TextButton")
  91. Button.Name = text
  92. Button.Parent = TabFrame
  93. Button.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
  94. Button.BorderSizePixel = 0
  95. Button.Size = UDim2.new(0, 100, 0, 20)
  96. Button.Font = Enum.Font.SciFi
  97. Button.Text = " " .. text
  98. Button.TextColor3 = Color3.new(1, 1, 1)
  99. Button.TextSize = 14
  100. Button.TextXAlignment = Enum.TextXAlignment.Left
  101. Button.MouseButton1Click:Connect(func)
  102. end
  103. function TabLibrary:DropDown(text, drops, func)
  104. TabFrameSize = TabFrameSize + 20
  105. TabFrame.Size = UDim2.new(0, 100, 0, TabFrameSize)
  106. local DropDownButton = Instance.new("TextButton")
  107. local DropDownOpened = false
  108. local DropDownFrame = Instance.new("Frame")
  109. local DropDownFrameSize = 0
  110. local DropDownListLayout = Instance.new("UIListLayout")
  111. DropDownButton.Name = text
  112. DropDownButton.Parent = TabFrame
  113. DropDownButton.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
  114. DropDownButton.BorderSizePixel = 0
  115. DropDownButton.Size = UDim2.new(0, 100, 0, 20)
  116. DropDownButton.Font = Enum.Font.SciFi
  117. DropDownButton.Text = text
  118. DropDownButton.TextColor3 = Color3.new(1, 1, 1)
  119. DropDownButton.TextSize = 14
  120. DropDownButton.MouseButton1Click:Connect(function()
  121. if DropDownOpened then
  122. for i, v in pairs(DropDownFrame:GetChildren()) do
  123. if v:IsA("TextButton") then
  124. v.Visible = false
  125. end
  126. end
  127. DropDownFrame:TweenSize(UDim2.new(0, 100, 0, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Sine, 0.25, true)
  128. DropDownOpened = false
  129. DropDownMouseLeft = true
  130. else
  131. DropDownFrame:TweenSize(UDim2.new(0, 100, 0, DropDownFrameSize), Enum.EasingDirection.Out, Enum.EasingStyle.Sine, 0.25, true)
  132. while DropDownFrame.Size ~= UDim2.new(0, 100, 0, DropDownFrameSize) do
  133. wait()
  134. end
  135. for i, v in pairs(DropDownFrame:GetChildren()) do
  136. if v:IsA("TextButton") then
  137. v.Visible = true
  138. end
  139. end
  140. DropDownOpened = true
  141. end
  142. end)
  143.  
  144. DropDownFrame.Name = "DropDownFrame"
  145. DropDownFrame.Parent = DropDownButton
  146. DropDownFrame.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
  147. DropDownFrame.BorderSizePixel = 0
  148. DropDownFrame.Position = UDim2.new(0, 0, 0, 20)
  149. DropDownFrame.Size = UDim2.new(0, 100, 0, 0)
  150.  
  151. Tab.MouseEnter:Connect(function()
  152. TabMouseLeft = false
  153. TabFrame:TweenSize(UDim2.new(0, 100, 0, TabFrameSize), Enum.EasingDirection.In, Enum.EasingStyle.Sine, 0.25, true)
  154. while TabFrame.Size ~= UDim2.new(0, 100, 0, TabFrameSize) do
  155. wait()
  156. end
  157. for i, v in pairs(TabFrame:GetChildren()) do
  158. if not v:IsA("UIListLayout") then
  159. v.Visible = true
  160. end
  161. end
  162. end)
  163. Tab.MouseLeave:Connect(function()
  164. TabMouseLeft = true
  165. if TabFrameMouseLeft and DropDownFrameMouseLeft then
  166. for i, v in pairs(TabFrame:GetChildren()) do
  167. if not v:IsA("UIListLayout") then
  168. v.Visible = false
  169. end
  170. end
  171. TabFrame:TweenSize(UDim2.new(0, 100, 0, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Sine, 0.25, true)
  172. for i, v in pairs(DropDownFrame:GetChildren()) do
  173. if v:IsA("TextButton") then
  174. v.Visible = false
  175. end
  176. end
  177. DropDownFrame.Size = UDim2.new(0, 100, 0, 0)
  178. DropDownOpened = false
  179. DropDownMouseLeft = true
  180. end
  181. end)
  182. TabFrame.MouseEnter:Connect(function()
  183. TabFrameMouseLeft = false
  184. end)
  185. TabFrame.MouseLeave:Connect(function()
  186. TabFrameMouseLeft = true
  187. if TabMouseLeft and DropDownFrameMouseLeft then
  188. for i, v in pairs(TabFrame:GetChildren()) do
  189. if not v:IsA("UIListLayout") then
  190. v.Visible = false
  191. end
  192. end
  193. TabFrame:TweenSize(UDim2.new(0, 100, 0, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Sine, 0.25, true)
  194. for i, v in pairs(DropDownFrame:GetChildren()) do
  195. if v:IsA("TextButton") then
  196. v.Visible = false
  197. end
  198. end
  199. DropDownFrame.Size = UDim2.new(0, 100, 0, 0)
  200. DropDownOpened = false
  201. DropDownMouseLeft = true
  202. end
  203. end)
  204. DropDownFrame.MouseEnter:Connect(function()
  205. DropDownFrameMouseLeft = false
  206. end)
  207. DropDownFrame.MouseLeave:Connect(function()
  208. DropDownFrameMouseLeft = true
  209. if TabMouseLeft and TabFrameMouseLeft then
  210. for i, v in pairs(TabFrame:GetChildren()) do
  211. if not v:IsA("UIListLayout") then
  212. v.Visible = false
  213. end
  214. end
  215. TabFrame:TweenSize(UDim2.new(0, 100, 0, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Sine, 0.25, true)
  216. for i, v in pairs(DropDownFrame:GetChildren()) do
  217. if v:IsA("TextButton") then
  218. v.Visible = false
  219. end
  220. end
  221. DropDownFrame.Size = UDim2.new(0, 100, 0, 0)
  222. DropDownOpened = false
  223. DropDownMouseLeft = true
  224. end
  225. end)
  226.  
  227. DropDownListLayout.Name = "DropDownListLayout"
  228. DropDownListLayout.Parent = DropDownFrame
  229. DropDownListLayout.SortOrder = Enum.SortOrder.LayoutOrder
  230.  
  231. for i, v in pairs(drops) do
  232. DropDownFrameSize = DropDownFrameSize + 20
  233. DropDownFrame.Size = UDim2.new(0, 100, 0, DropDownFrameSize)
  234. local DropsButton = Instance.new("TextButton")
  235. DropsButton.Name = v
  236. DropsButton.Parent = DropDownFrame
  237. DropsButton.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
  238. DropsButton.BorderSizePixel = 0
  239. DropsButton.Size = UDim2.new(0, 100, 0, 20)
  240. DropsButton.Font = Enum.Font.SciFi
  241. DropsButton.Text = " " .. v
  242. DropsButton.TextColor3 = Color3.new(1, 1, 1)
  243. DropsButton.TextSize = 14
  244. DropsButton.Visible = false
  245. DropsButton.MouseButton1Click:Connect(function()
  246. for i, v in pairs(DropDownFrame:GetChildren()) do
  247. if v:IsA("TextButton") then
  248. v.Visible = false
  249. end
  250. end
  251. DropDownFrame:TweenSize(UDim2.new(0, 100, 0, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Sine, 0.25, true)
  252. DropDownOpened = false
  253. DropDownMouseLeft = true
  254. func(v)
  255. end)
  256. end
  257. DropDownFrame.Size = UDim2.new(0, 100, 0, 0)
  258. end
  259. function TabLibrary:Label(name, text)
  260. TabFrameSize = TabFrameSize + 20
  261. TabFrame.Size = UDim2.new(0, 100, 0, TabFrameSize)
  262. local Label = Instance.new("TextLabel")
  263. Label.Name = name
  264. Label.Parent = TabFrame
  265. Label.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
  266. Label.BorderSizePixel = 0
  267. Label.Size = UDim2.new(0, 100, 0, 20)
  268. Label.Font = Enum.Font.SciFi
  269. Label.Text = " " .. text
  270. Label.TextColor3 = Color3.new(1, 1, 1)
  271. Label.TextSize = 14
  272. Label.TextXAlignment = Enum.TextXAlignment.Left
  273. end
  274. function TabLibrary:TextBox(text, func)
  275. TabFrameSize = TabFrameSize + 20
  276. TabFrame.Size = UDim2.new(0, 100, 0, TabFrameSize)
  277. local TextBox = Instance.new("TextBox")
  278. TextBox.Name = text
  279. TextBox.Parent = TabFrame
  280. TextBox.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
  281. TextBox.BorderSizePixel = 0
  282. TextBox.Size = UDim2.new(0, 100, 0, 20)
  283. TextBox.Font = Enum.Font.SciFi
  284. TextBox.PlaceholderColor3 = Color3.fromRGB(128, 128, 128)
  285. TextBox.PlaceholderText = text
  286. TextBox.Text = ""
  287. TextBox.TextColor3 = Color3.new(1, 1, 1)
  288. TextBox.TextSize = 14
  289. TextBox.FocusLost:Connect(function(Enter)
  290. if Enter then
  291. func(TextBox.Text)
  292. end
  293. end)
  294. end
  295. function TabLibrary:Toggle(text, func)
  296. TabFrameSize = TabFrameSize + 20
  297. TabFrame.Size = UDim2.new(0, 100, 0, TabFrameSize)
  298. local ToggleLabel = Instance.new("TextLabel")
  299. local ToggleButton = Instance.new("TextButton")
  300. ToggleLabel.Name = text
  301. ToggleLabel.Parent = TabFrame
  302. ToggleLabel.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
  303. ToggleLabel.BorderSizePixel = 0
  304. ToggleLabel.Size = UDim2.new(0, 100, 0, 20)
  305. ToggleLabel.Font = Enum.Font.SciFi
  306. ToggleLabel.Text = " " .. text
  307. ToggleLabel.TextColor3 = Color3.new(1, 1, 1)
  308. ToggleLabel.TextSize = 14
  309. ToggleLabel.TextXAlignment = Enum.TextXAlignment.Left
  310.  
  311. ToggleButton.Name = "ToggleButton"
  312. ToggleButton.Parent = ToggleLabel
  313. ToggleButton.BackgroundColor3 = Color3.new(1, 0, 0)
  314. ToggleButton.Position = UDim2.new(0, 82, 0, 2)
  315. ToggleButton.Size = UDim2.new(0, 16, 0, 16)
  316. ToggleButton.Font = Enum.Font.SourceSans
  317. ToggleButton.Text = ""
  318. ToggleButton.TextColor3 = Color3.new(0, 0, 0)
  319. ToggleButton.TextSize = 14
  320. ToggleButton.MouseButton1Click:Connect(function()
  321. if ToggleButton.BackgroundColor3 == Color3.new(1, 0, 0) then
  322. ToggleButton.BackgroundColor3 = Color3.new(0, 1, 0)
  323. func(true)
  324. else
  325. ToggleButton.BackgroundColor3 = Color3.new(1, 0, 0)
  326. func(false)
  327. end
  328. end)
  329. end
  330.  
  331. return TabLibrary
  332. end
  333.  
  334. return Library
Advertisement
Add Comment
Please, Sign In to add comment