Categories > Coding > Lua >

Custom Notification System

New Reply

Posts: 3

Threads: 3

Joined: Sep, 2024

Reputation: 0

Posted

Tutorial

 

showCustomNotification("TopText", "MiddleText", DurationNotificationWillBeShownFor)
 
Script
 
local NotificationContainer = Instance.new("ScreenGui")
NotificationContainer.Name = "CustomNotifications"
NotificationContainer.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")

local activeNotifications = {}

local function updateNotificationPositions()
    for i, notification in ipairs(activeNotifications) do
        notification:TweenPosition(
            UDim2.new(1, -260, 1, -110 - (i-1) * 110),
            Enum.EasingDirection.Out,
            Enum.EasingStyle.Quart,
            0.3,
            true
        )
    end
end

local function showCustomNotification(title, text, duration)
    local Notification = Instance.new("Frame")
    Notification.Size = UDim2.new(0, 250, 0, 100)
    Notification.Position = UDim2.new(1, -260, 1, -110)
    Notification.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
    Notification.BorderSizePixel = 0
    Notification.Parent = NotificationContainer

    local UICorner = Instance.new("UICorner")
    UICorner.CornerRadius = UDim.new(0, 10)
    UICorner.Parent = Notification

    local TitleLabel = Instance.new("TextLabel")
    TitleLabel.Size = UDim2.new(1, 0, 0, 30)
    TitleLabel.BackgroundTransparency = 1
    TitleLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
    TitleLabel.TextSize = 18
    TitleLabel.Font = Enum.Font.SourceSansBold
    TitleLabel.Text = title
    TitleLabel.Parent = Notification

    local TextLabel = Instance.new("TextLabel")
    TextLabel.Size = UDim2.new(1, -20, 1, -40)
    TextLabel.Position = UDim2.new(0, 10, 0, 30)
    TextLabel.BackgroundTransparency = 1
    TextLabel.TextColor3 = Color3.fromRGB(200, 200, 200)
    TextLabel.TextSize = 14
    TextLabel.Font = Enum.Font.SourceSans
    TextLabel.Text = text
    TextLabel.TextWrapped = true
    TextLabel.Parent = Notification

    table.insert(activeNotifications, Notification)
    updateNotificationPositions()

    delay(duration, function()
        for i, v in ipairs(activeNotifications) do
            if v == Notification then
                table.remove(activeNotifications, i)
                break
            end
        end
        Notification:Destroy()
        updateNotificationPositions()
    end)
end
showCustomNotification("TopText", "MiddleText", DurationNotificationWillBeShownFor)
 
-------------------------------------------------------------------------------
Yes you Can add Swears
There Is No limit Until it goes Off Screen
Add As Much text as you want But it may Clip off the screen
Websites Are Allowed
Yes This Can Be Used In Other Scripts
No Credit Does Not have to be Incredibly Visible But it must Be Atleast Seen And Known.
- Yes it can be 0.3-1 Transparency
  • 0

  • Comment

Login to unlock the reply editor

Add your reply

Users viewing this thread:

( Members: 0, Guests: 1, Total: 1 )