Advertisement
EXO_DEV

Simple Notification system

Jun 26th, 2023 (edited)
2,154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.66 KB | Software | 0 0
  1. --[[
  2. made by _Exec4tle_#2226 as a FE Scripting Utility!
  3. you can execute loadstring just once
  4. loadstring(game:HttpGet("http://pastebin.com/raw/nfVbXZ6D", true))()
  5. example of usage:
  6. notify("Hello, this is a testing notification!", 10, 17)
  7.  
  8. notify(   "string",   duration,   fontsize   )
  9.  
  10. made not for long messages and not recommended to set high values on duration
  11. ]]--
  12.  
  13. --variables
  14. local starterGui = game:GetService("StarterGui")
  15. local pl = game.Players.LocalPlayer
  16. local ts = game:GetService("TweenService")
  17. _G.start = true
  18.  
  19. --main function
  20. getgenv().notify = function(message, duration, fontSize)
  21.     task.spawn(function()
  22.             message = message or ""
  23.             duration = duration or 2
  24.             fontSize = fontSize or 16
  25. local layoutGrid = Instance.new("UIListLayout")
  26. local screenGui = Instance.new("ScreenGui")
  27. local container = Instance.new("Frame")
  28.     if pl:WaitForChild("PlayerGui"):FindFirstChild("NotificationGui") then
  29.         --print("Notif Gui alr maden.\n"
  30.         --,"Re-Creating...\n"
  31.        -- )
  32.         --pl.PlayerGui.NotificationGui:Destroy()
  33.         else ------------
  34.        
  35.             screenGui.ResetOnSpawn = false
  36.             screenGui.Name = "NotificationGui"
  37.             screenGui.Parent = pl:FindFirstChild("PlayerGui")
  38.        
  39.             container.Name = "Container"
  40.             container.Parent = screenGui
  41.             container.Position = UDim2.new(0.775,0, 0,0)
  42.             container.Size = UDim2.new(0,350, 1,0)
  43.             container.Transparency = 1
  44.        
  45.             layoutGrid.Name = "Grid"
  46.             layoutGrid.Parent = container
  47.             layoutGrid.Padding = UDim.new(0.01,0)
  48.             layoutGrid.HorizontalAlignment = "Right"
  49.             layoutGrid.SortOrder = "LayoutOrder"
  50.         end
  51.     local textLabel = Instance.new("TextLabel")
  52.         textLabel.Size = UDim2.new(1, 0, 0.1, 0)
  53.         textLabel.Position = UDim2.new(1, 0, 0, 0)
  54.         textLabel.BackgroundTransparency = 1.0
  55.         textLabel.Transparency = 1.0
  56.         textLabel.BackgroundColor3 = Color3.new(0.08, 0, 0.2)
  57.         textLabel.TextColor3 = Color3.new(1, 1, 1)
  58.         textLabel.Font = Enum.Font.Ubuntu
  59.         textLabel.TextSize = fontSize
  60.         textLabel.TextWrapped = true
  61.         textLabel.Text = message
  62.         textLabel.Parent = pl.PlayerGui.NotificationGui.Container
  63.         textLabel.BorderSizePixel = 0.0
  64.         textLabel.BorderColor3 = Color3.fromRGB(0, 255, 255)
  65.         textLabel.BorderMode = "Inset"
  66.     local durFrame = Instance.new("Frame")
  67.         durFrame.Parent = textLabel
  68.         durFrame.Position = UDim2.new(0.0,0.0, 0.8,0.0)
  69.         durFrame.Size = UDim2.new(1.0,0.0, 0.2,0.0)
  70.         durFrame.BorderSizePixel = 0.0
  71. --  Tweens
  72.     ts:Create(textLabel, TweenInfo.new(duration/16, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut), {BackgroundTransparency = 0.0 } ):Play()
  73.     ts:Create(textLabel, TweenInfo.new(duration/16), {Transparency = 0.0 } ):Play()
  74.  
  75.     ts:Create(durFrame, TweenInfo.new(duration/2, Enum.EasingStyle.Linear), {Size = UDim2.new(0.0,0.0, 0.2,0.0) } ):Play()
  76.     ts:Create(durFrame, TweenInfo.new(duration/16, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut), {BackgroundTransparency = 0.0 } ):Play()
  77.     wait(duration/2)
  78.  
  79.     ts:Create(textLabel, TweenInfo.new(duration/16, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut), {BackgroundTransparency = 1.0}):Play()
  80.     ts:Create(textLabel, TweenInfo.new(duration/16), {Transparency = 1.0}):Play()
  81.    
  82.     ts:Create(durFrame, TweenInfo.new(duration/2, Enum.EasingStyle.Linear), {Size = UDim2.new(0.0,0.0, 0.2,0.0) } ):Play()
  83.     wait(duration/18)
  84.     textLabel:Destroy()
  85. end)
  86. end
  87. _G.notify = getgenv().notify
  88. getgenv().notff = _G.notify
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement