Advertisement
YANIS_EXPLOITS

UI LIB

Aug 5th, 2021
3,313
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.94 KB | None | 0 0
  1. local Lib = {}
  2.  
  3. function Lib:NewNotif(player, title, body, buttons, isFPS)
  4. if isFPS then
  5. if type(isFPS) == "boolean" then
  6. game:GetService("UserInputService").MouseIconEnabled = isFPS
  7. else
  8. isFPS = false
  9. end
  10. end
  11. local Closed = false
  12.  
  13. if not title or not type(title) == "string" then title = "Title" end
  14. if not body or not type(body) == "string" then body = "Body" end --Checking if there's values
  15.  
  16. local Notification = Instance.new("ScreenGui")
  17. local Main = Instance.new("Frame")
  18. local Head = Instance.new("TextLabel")
  19. local Body = Instance.new("TextLabel")
  20. local Buttons1 = Instance.new("Frame")
  21. local Button = Instance.new("TextButton")
  22. local Buttons2 = Instance.new("Frame")
  23. local Button_2 = Instance.new("TextButton")
  24. local Button2 = Instance.new("TextButton")
  25. local UICorner1 = Instance.new("UICorner")
  26. local UICorner2 = Instance.new("UICorner")
  27. local UICorner3 = Instance.new("UICorner")
  28. local UICorner4 = Instance.new("UICorner")
  29.  
  30. UICorner1.Parent = Main
  31. UICorner1.CornerRadius = UDim.new(0.05, 0)
  32.  
  33. UICorner2.Parent = Button
  34. UICorner2.CornerRadius = UDim.new(0.25, 0)
  35.  
  36. UICorner3.Parent = Button_2
  37. UICorner3.CornerRadius = UDim.new(0.25, 0)
  38.  
  39. UICorner4.Parent = Button2
  40. UICorner4.CornerRadius = UDim.new(0.25, 0)
  41.  
  42. Notification.Name = "Notification"
  43. Notification.Parent = player.PlayerGui
  44. Notification.ZIndexBehavior = Enum.ZIndexBehavior.Global
  45.  
  46. Main.Name = "Main"
  47. Main.Parent = Notification
  48. Main.BackgroundColor3 = Color3.fromRGB(49, 49, 49)
  49. Main.Position = UDim2.new(1.1, 0, 0.6, 0)
  50. Main.Size = UDim2.new(0.202970296, 0, 0.196539178, 0)
  51. Main.ZIndex = 2147483646
  52.  
  53. Head.Name = "Head"
  54. Head.Parent = Main
  55. Head.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  56. Head.BackgroundTransparency = 1.000
  57. Head.Size = UDim2.new(1, 0, 0.18341051, 0)
  58. Head.Font = Enum.Font.SourceSansBold
  59. Head.Text = title
  60. Head.TextColor3 = Color3.fromRGB(255, 255, 255)
  61. Head.TextScaled = true
  62. Head.TextSize = 14.000
  63. Head.TextWrapped = true
  64. Head.ZIndex = 2147483647
  65.  
  66. Body.Name = "Body"
  67. Body.Parent = Main
  68. Body.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  69. Body.BackgroundTransparency = 1.000
  70. Body.Position = UDim2.new(0, 0, 0.176088959, 0)
  71. Body.Size = UDim2.new(1, 0, 0.544856012, 0)
  72. Body.Font = Enum.Font.SourceSansBold
  73. Body.Text = body
  74. Body.TextColor3 = Color3.fromRGB(255, 255, 255)
  75. Body.TextScaled = true
  76. Body.TextSize = 14.000
  77. Body.TextWrapped = true
  78. Body.ZIndex = 2147483647
  79.  
  80. Buttons1.Name = "Buttons1"
  81. Buttons1.Parent = Main
  82. Buttons1.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  83. Buttons1.BackgroundTransparency = 1.000
  84. Buttons1.Position = UDim2.new(0, 0, 0.720944762, 0)
  85. Buttons1.Size = UDim2.new(1, 0, 0.278036356, 0)
  86. Buttons1.Visible = false
  87. Buttons1.ZIndex = 2147483647
  88.  
  89. Button.Name = "Button"
  90. Button.Parent = Buttons1
  91. Button.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
  92. Button.Position = UDim2.new(0.0146341445, 0, 0, 0)
  93. Button.Size = UDim2.new(0.970000029, 0, 0.899999976, 0)
  94. Button.Font = Enum.Font.SourceSansBold
  95. Button.TextColor3 = Color3.fromRGB(255, 255, 255)
  96. Button.TextScaled = true
  97. Button.TextSize = 14.000
  98. Button.TextWrapped = true
  99. Button.ZIndex = 2147483647
  100. Button.Modal = isFPS
  101.  
  102. Buttons2.Name = "Buttons2"
  103. Buttons2.Parent = Main
  104. Buttons2.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  105. Buttons2.BackgroundTransparency = 1.000
  106. Buttons2.Position = UDim2.new(0, 0, 0.720944762, 0)
  107. Buttons2.Size = UDim2.new(1, 0, 0.278036356, 0)
  108. Buttons2.Visible = false
  109. Buttons2.ZIndex = 2147483647
  110.  
  111. Button_2.Name = "Button"
  112. Button_2.Parent = Buttons2
  113. Button_2.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
  114. Button_2.Position = UDim2.new(0.0146341445, 0, 0, 0)
  115. Button_2.Size = UDim2.new(0.469999999, 0, 0.899999976, 0)
  116. Button_2.Font = Enum.Font.SourceSansBold
  117. Button_2.TextColor3 = Color3.fromRGB(255, 255, 255)
  118. Button_2.TextScaled = true
  119. Button_2.TextSize = 14.000
  120. Button_2.TextWrapped = true
  121. Button_2.ZIndex = 2147483647
  122. Button_2.Modal = isFPS
  123.  
  124. Button2.Name = "Button2"
  125. Button2.Parent = Buttons2
  126. Button2.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
  127. Button2.Position = UDim2.new(0.545000017, 0, 0, 0)
  128. Button2.Size = UDim2.new(0.440731704, 0, 0.899999976, 0)
  129. Button2.Font = Enum.Font.SourceSansBold
  130. Button2.Text = "Button2"
  131. Button2.TextColor3 = Color3.fromRGB(255, 255, 255)
  132. Button2.TextScaled = true
  133. Button2.TextSize = 14.000
  134. Button2.TextWrapped = true
  135. Button2.ZIndex = 2147483647
  136. Button2.Modal = isFPS
  137.  
  138. Main:TweenPosition(UDim2.new(0.791, 0, 0.6, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Sine, .5, true)
  139.  
  140. --Notification comes out the bottom right side of the screen
  141.  
  142. local function Close()
  143. Closed = true
  144. Main:TweenPosition(UDim2.new(1.1, 0, 0.6, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Sine, .5, true)
  145. wait(.6)
  146. Notification:Destroy()
  147. end --Guess what this does...
  148.  
  149. if buttons and type(buttons) == "table" then
  150. pcall(function() --Use a protected call just incase Text or func in one of the tables is nil or wrong type
  151. if #buttons == 1 then
  152. Button.Text = buttons[1].Text --Button text
  153. Button.MouseButton1Click:Connect(function()
  154. if buttons[1]["func"] then if type(buttons[1]["func"]) == "function" then buttons[1]["func"]() end end
  155. Close()
  156. end) --Calling the function of the button if there is one, then close the notif
  157. Buttons1.Visible = true
  158. elseif #buttons == 2 then
  159. Button_2.Text = buttons[1].Text
  160. Button_2.MouseButton1Click:Connect(function()
  161. if buttons[1]["func"] then if type(buttons[1]["func"]) == "function" then buttons[1]["func"]() end end
  162. Close()
  163. end)
  164. Button2.Text = buttons[2].Text
  165. Button2.MouseButton1Click:Connect(function()
  166. if buttons[2]["func"] then if type(buttons[2]["func"]) == "function" then buttons[2]["func"]() end end
  167. Close()
  168. end)
  169. Buttons2.Visible = true
  170. end
  171. end)
  172. end
  173.  
  174. spawn(function()
  175. wait(10)
  176. if not Closed then Close() end
  177. end)
  178. end
  179.  
  180. return Lib
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement