Advertisement
LeviTheOtaku

levigradiencelib

Apr 16th, 2020
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 8.94 KB | None | 0 0
  1. local library = {}
  2. local mouse = game.Players.LocalPlayer:GetMouse()
  3. local ts = game:GetService("TweenService")
  4.  
  5.  
  6. function library:createWindow(title, colors)
  7. local csk = {}
  8. local step = 1 / (#colors-1)
  9. for i=1,#colors do
  10. if i == 1 then
  11. table.insert(csk, i, ColorSequenceKeypoint.new(0, colors[i]))
  12. else
  13. table.insert(csk, i, ColorSequenceKeypoint.new(0 + step*(i-1), colors[i]))
  14. end
  15. end
  16.  
  17. local window = {}
  18. local WindowName = Instance.new("ScreenGui")
  19. local Window = Instance.new("Frame")
  20. local Title = Instance.new("TextLabel")
  21. local ToggleOpen = Instance.new("TextButton")
  22. local Underglow = Instance.new("Frame")
  23. local Content = Instance.new("Frame")
  24.  
  25. WindowName.Name = title
  26. WindowName.Parent = game.Players.LocalPlayer.PlayerGui
  27.  
  28. Window.Name = "Window"
  29. Window.Parent = WindowName
  30. Window.BackgroundColor3 = Color3.new(0.0784314, 0.0784314, 0.0784314)
  31. Window.BorderSizePixel = 0
  32. Window.Position = UDim2.new(0, 150, 0, 150)
  33. Window.Size = UDim2.new(0, 175, 0, 25)
  34.  
  35. Title.Name = "Title"
  36. Title.Parent = Window
  37. Title.BackgroundColor3 = Color3.new(1, 1, 1)
  38. Title.BackgroundTransparency = 1
  39. Title.Position = UDim2.new(0.15, 0, 0, 0)
  40. Title.Size = UDim2.new(0.7, 0, 1, 0)
  41. Title.Font = Enum.Font.SourceSansBold
  42. Title.FontSize = Enum.FontSize.Size14
  43. Title.Text = title
  44. Title.TextColor3 = Color3.new(1, 1, 1)
  45. Title.TextScaled = true
  46. Title.TextSize = 14
  47. Title.TextWrapped = true
  48. local UIGradient_1 = Instance.new("UIGradient", Title)
  49. UIGradient_1.Color = ColorSequence.new(csk)
  50.  
  51. ToggleOpen.Name = "ToggleOpen"
  52. ToggleOpen.Parent = Window
  53. ToggleOpen.BackgroundColor3 = Color3.new(1, 1, 1)
  54. ToggleOpen.BackgroundTransparency = 1
  55. ToggleOpen.BorderSizePixel = 0
  56. ToggleOpen.Position = UDim2.new(0.85, 0, 0, 0)
  57. ToggleOpen.Size = UDim2.new(0.15, 0, 1, 0)
  58. ToggleOpen.Font = Enum.Font.SourceSansBold
  59. ToggleOpen.FontSize = Enum.FontSize.Size14
  60. ToggleOpen.Text = "+"
  61. ToggleOpen.TextColor3 = Color3.new(1, 1, 1)
  62. ToggleOpen.TextScaled = true
  63. ToggleOpen.TextSize = 14
  64. ToggleOpen.TextWrapped = true
  65. local UIGradient_2 = Instance.new("UIGradient", ToggleOpen)
  66. UIGradient_2.Color = ColorSequence.new(csk)
  67.  
  68.  
  69. ToggleOpen.MouseButton1Down:connect(function()
  70. if Content.Size == UDim2.new(1,0,#Content:GetChildren()-1,0) then
  71. Content:TweenSize(UDim2.new(1,0,0,0), Enum.EasingDirection.Out, Enum.EasingStyle.Sine, 0.1, true)
  72. ToggleOpen.Text = "+"
  73. elseif Content.Size == UDim2.new(1,0,0,0) then
  74. Content:TweenSize(UDim2.new(1,0,#Content:GetChildren()-1,0), Enum.EasingDirection.Out, Enum.EasingStyle.Bounce, 0.1, true)
  75. ToggleOpen.Text = "-"
  76. end
  77. end)
  78.  
  79. Underglow.Name = "Underglow"
  80. Underglow.Parent = Window
  81. Underglow.BackgroundColor3 = Color3.new(1, 1, 1)
  82. Underglow.BorderSizePixel = 0
  83. Underglow.Position = UDim2.new(0, 0, 1, -2)
  84. Underglow.Size = UDim2.new(1, 0, 0, 2)
  85. local UIGradient_3 = Instance.new("UIGradient", Underglow)
  86. UIGradient_3.Color = ColorSequence.new(csk)
  87.  
  88. Content.Name = "Content"
  89. Content.Parent = Window
  90. Content.BackgroundColor3 = Color3.new(1, 1, 1)
  91. Content.BackgroundTransparency = 1
  92. Content.BorderSizePixel = 0
  93. Content.Position = UDim2.new(0, 0, 1, 0)
  94. Content.Size = UDim2.new(1, 0, 0, 0)
  95. Content.ClipsDescendants = true
  96.  
  97. local UIListLayout = Instance.new("UIListLayout", Content)
  98. UIListLayout.SortOrder = Enum.SortOrder.LayoutOrder
  99.  
  100. local mouseondrag = false
  101. Window.MouseEnter:connect(function()
  102. mouseondrag = true
  103. end)
  104. Window.MouseLeave:connect(function()
  105. mouseondrag = false
  106. end)
  107.  
  108. local mousedown = false
  109. mouse.Button1Down:connect(function()
  110. if mouseondrag == true then
  111. mousedown = true
  112. end
  113. end)
  114. mouse.Button1Up:connect(function()
  115. mousedown = false
  116. end)
  117.  
  118. spawn(function()
  119.  
  120. while true do
  121. wait()
  122. if mousedown == true then
  123. Window:TweenPosition(UDim2.new(0, mouse.X, 0, mouse.Y), Enum.EasingDirection.Out, Enum.EasingStyle.Sine, 0.1, true)
  124. end
  125. end
  126. end)
  127.  
  128.  
  129.  
  130.  
  131. function window:createToggle(text, func, waittime)
  132. local TogglePanelBackground = Instance.new("Frame")
  133. local ToggleBackground = Instance.new("Frame")
  134. local ToggleSlider = Instance.new("Frame")
  135. local ToggleText = Instance.new("TextLabel")
  136.  
  137. TogglePanelBackground.Name = "TogglePanelBackground"
  138. TogglePanelBackground.Parent = Content
  139. TogglePanelBackground.BackgroundColor3 = Color3.new(0.0980392, 0.0980392, 0.0980392)
  140. TogglePanelBackground.BorderSizePixel = 0
  141. TogglePanelBackground.Size = UDim2.new(1, 0, 0, 25)
  142.  
  143. ToggleBackground.Name = "ToggleBackground"
  144. ToggleBackground.Parent = TogglePanelBackground
  145. ToggleBackground.BackgroundColor3 = Color3.new(1, 0, 0)
  146. ToggleBackground.BorderSizePixel = 0
  147. ToggleBackground.Position = UDim2.new(0.649999976, 0, 0.100000001, 0)
  148. ToggleBackground.Size = UDim2.new(0.300000012, 0, 0.800000012, 0)
  149.  
  150. ToggleSlider.Name = "ToggleSlider"
  151. ToggleSlider.Parent = ToggleBackground
  152. ToggleSlider.BackgroundColor3 = Color3.new(0.0980392, 0.0980392, 0.0980392)
  153. ToggleSlider.BorderColor3 = Color3.new(1, 1, 1)
  154. ToggleSlider.BorderSizePixel = 2
  155. ToggleSlider.Position = UDim2.new(0.0, 0, 0, 0)
  156. ToggleSlider.Size = UDim2.new(0.400000006, 0, 1, 0)
  157. ToggleSlider.BorderMode = Enum.BorderMode.Inset
  158. local UIGradient_1 = Instance.new("UIGradient", ToggleSlider)
  159. UIGradient_1.Color = ColorSequence.new(csk)
  160.  
  161. ToggleText.Name = "ToggleText"
  162. ToggleText.Parent = TogglePanelBackground
  163. ToggleText.BackgroundColor3 = Color3.new(1, 1, 1)
  164. ToggleText.BackgroundTransparency = 1
  165. ToggleText.Position = UDim2.new(0.0500000007, 0, 0, 0)
  166. ToggleText.Size = UDim2.new(0.5, 0, 1, 0)
  167. ToggleText.Font = Enum.Font.SourceSansBold
  168. ToggleText.FontSize = Enum.FontSize.Size18
  169. ToggleText.Text = "Toggle"
  170. ToggleText.TextColor3 = Color3.new(1, 1, 1)
  171. ToggleText.TextSize = 16
  172. ToggleText.TextWrapped = true
  173. local UIGradient_2 = Instance.new("UIGradient", ToggleText)
  174. UIGradient_2.Color = ColorSequence.new(csk)
  175.  
  176. local enteredSlider = false
  177. ToggleBackground.MouseEnter:connect(function()
  178. enteredSlider = true
  179. end)
  180. ToggleBackground.MouseLeave:connect(function()
  181. enteredSlider = false
  182. end)
  183.    
  184. local toggle = false
  185. mouse.Button1Up:connect(function()
  186. if enteredSlider == true then
  187. if ToggleSlider.Position == UDim2.new(0.6,0,0,0) then
  188. ToggleSlider:TweenPosition(UDim2.new(0,0,0,0), Enum.EasingDirection.Out, Enum.EasingStyle.Bounce, 0.1, true)
  189. ToggleBackground.BackgroundColor3 = Color3.fromRGB(255,0,0)
  190. toggle = false
  191. elseif ToggleSlider.Position == UDim2.new(0,0,0,0) then
  192. ToggleSlider:TweenPosition(UDim2.new(0.6,0,0,0), Enum.EasingDirection.Out, Enum.EasingStyle.Bounce, 0.1, true)
  193. ToggleBackground.BackgroundColor3 = Color3.fromRGB(0,255,0)
  194. toggle = true
  195. end
  196. end
  197. end)
  198.    
  199.  
  200. spawn(function()
  201. while wait(waittime) do
  202. if toggle then
  203. func()
  204. end
  205. end
  206. end)
  207. end
  208.  
  209. function window:createButton(text, buttontext, func)
  210. local ButtonPanelBackground = Instance.new("Frame")
  211. local Button = Instance.new("Frame")
  212. local TextLabel = Instance.new("TextLabel")
  213. local ButtonLabel = Instance.new("TextLabel")
  214.  
  215. ButtonPanelBackground.Name = "ButtonPanelBackground"
  216. ButtonPanelBackground.Parent = Content
  217. ButtonPanelBackground.BackgroundColor3 = Color3.new(0.0980392, 0.0980392, 0.0980392)
  218. ButtonPanelBackground.BorderSizePixel = 0
  219. ButtonPanelBackground.Position = UDim2.new(0, 0, 0, 25)
  220. ButtonPanelBackground.Size = UDim2.new(1, 0, 0, 25)
  221.  
  222. Button.Name = "Button"
  223. Button.Parent = ButtonPanelBackground
  224. Button.BackgroundColor3 = Color3.new(0, 0, 0)
  225. Button.BorderColor3 = Color3.new(1, 1, 1)
  226. Button.BorderSizePixel = 2
  227. Button.Position = UDim2.new(0.649999976, 0, 0.100000001, 0)
  228. Button.Size = UDim2.new(0.300000012, 0, 0.800000012, 0)
  229. local UIGradient_1 = Instance.new("UIGradient", Button)
  230. UIGradient_1.Color = ColorSequence.new(csk)
  231.  
  232. TextLabel.Parent = Button
  233. TextLabel.BackgroundColor3 = Color3.new(1, 1, 1)
  234. TextLabel.BackgroundTransparency = 1
  235. TextLabel.Position = UDim2.new(0, 0, 0, 1)
  236. TextLabel.Size = UDim2.new(1, 0, 1, 0)
  237. TextLabel.Font = Enum.Font.SourceSansBold
  238. TextLabel.FontSize = Enum.FontSize.Size14
  239. TextLabel.Text = "GO"
  240. TextLabel.TextColor3 = Color3.new(1, 1, 1)
  241. TextLabel.TextScaled = true
  242. TextLabel.TextSize = 14
  243. TextLabel.TextWrapped = true
  244. TextLabel.TextYAlignment = Enum.TextYAlignment.Bottom
  245.  
  246. ButtonLabel.Name = "ButtonLabel"
  247. ButtonLabel.Parent = ButtonPanelBackground
  248. ButtonLabel.BackgroundColor3 = Color3.new(1, 1, 1)
  249. ButtonLabel.BackgroundTransparency = 1
  250. ButtonLabel.Position = UDim2.new(0.0500000007, 0, 0, 0)
  251. ButtonLabel.Size = UDim2.new(0.5, 0, 1, 0)
  252. ButtonLabel.Font = Enum.Font.SourceSansBold
  253. ButtonLabel.FontSize = Enum.FontSize.Size18
  254. ButtonLabel.Text = "TP to player"
  255. ButtonLabel.TextColor3 = Color3.new(1, 1, 1)
  256. ButtonLabel.TextSize = 16
  257. ButtonLabel.TextWrapped = true
  258. local UIGradient_2 = Instance.new("UIGradient", ButtonLabel)
  259. UIGradient_2.Color = ColorSequence.new(csk)
  260. local onButton = false
  261. Button.MouseEnter:connect(function()
  262. onButton = true
  263. end)
  264. Button.MouseLeave:connect(function()
  265. onButton = false
  266. end)
  267.    
  268. local toggle = false
  269. mouse.Button1Up:connect(function()
  270. if onButton == true then
  271. func()
  272. spawn(function()
  273. Button.BorderSizePixel = 1.5
  274. wait(0.05)
  275. Button.BorderSizePixel = 2
  276. end)
  277. end
  278. end)
  279. end
  280.  
  281. return window
  282. end
  283.  
  284. return library
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement