Advertisement
Benover9009

Notification gui

Dec 4th, 2024 (edited)
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.17 KB | None | 0 0
  1. local NotificationLibrary = {}
  2. local notifications = {}
  3.  
  4. function NotificationLibrary:ShowNotification(text, duration)
  5.     local player = game:GetService("Players").LocalPlayer
  6.     local playerGui = player:FindFirstChild("PlayerGui") or player:WaitForChild("PlayerGui")
  7.  
  8.     local ultimateNotification = Instance.new("ScreenGui")
  9.     ultimateNotification.Name = "NotificationGui"
  10.     ultimateNotification.Parent = playerGui
  11.  
  12.     local drag = Instance.new("Frame")
  13.     drag.Name = "NotificationFrame"
  14.     drag.Parent = ultimateNotification
  15.     drag.Active = true
  16.     drag.BackgroundTransparency = 1.000
  17.     drag.Size = UDim2.new(0, 300, 0, 100)
  18.     drag.Position = UDim2.new(0, 10, 1, -110)
  19.     drag.BackgroundColor3 = Color3.fromRGB(64, 64, 64)
  20.  
  21.     local textLabel = Instance.new("TextLabel")
  22.     textLabel.Size = UDim2.new(1, -20, 1, 0)
  23.     textLabel.Position = UDim2.new(0, 10, 0, 0)
  24.     textLabel.BackgroundTransparency = 1
  25.     textLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
  26.     textLabel.Font = Enum.Font.SourceSans
  27.     textLabel.TextSize = 24
  28.     textLabel.Text = text
  29.     textLabel.TextWrapped = true
  30.     textLabel.Parent = drag
  31.  
  32.     drag.Draggable = true
  33.  
  34.     local uiCornerFrame = Instance.new("UICorner")
  35.     uiCornerFrame.CornerRadius = UDim.new(0, 10)
  36.     uiCornerFrame.Parent = drag
  37.  
  38.     local tweenService = game:GetService("TweenService")
  39.     local fadeInfo = TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
  40.  
  41.     tweenService:Create(drag, fadeInfo, {BackgroundTransparency = 0}):Play()
  42.     tweenService:Create(textLabel, fadeInfo, {TextTransparency = 0}):Play()
  43.  
  44.     task.delay(duration or 3, function()
  45.         local fadeOutInfo = TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
  46.         tweenService:Create(drag, fadeOutInfo, {BackgroundTransparency = 1}):Play()
  47.         tweenService:Create(textLabel, fadeOutInfo, {TextTransparency = 1}):Play()
  48.  
  49.         task.wait(0.5)
  50.         ultimateNotification:Destroy()
  51.     end)
  52.  
  53.     table.insert(notifications, drag)
  54. end
  55.  
  56. NotificationLibrary:ShowNotification("sigma notification", 3)
  57.  
  58. print("Notification Library created successfully.")
  59. return NotificationLibrary
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement