BLOXBUILDS
Discord
Back
UI/UX

Notification Popup

Paste into StarterPlayerScripts as a LocalScript. Shows a short toast. Other server scripts can FireClient a RemoteEvent named Notification to reuse the same popup.

-- Paste into StarterPlayer > StarterPlayerScripts as a LocalScript.
-- From the server: ReplicatedStorage.Notification:FireClient(player, "Hello")

local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TweenService = game:GetService("TweenService")

local player = Players.LocalPlayer
local gui = Instance.new("ScreenGui")
gui.Name = "Notifications"
gui.ResetOnSpawn = false
gui.Parent = player:WaitForChild("PlayerGui")

local function toast(message: string)
	local label = Instance.new("TextLabel")
	label.AnchorPoint = Vector2.new(0.5, 0)
	label.Position = UDim2.new(0.5, 0, 0, 24)
	label.Size = UDim2.fromOffset(360, 40)
	label.BackgroundColor3 = Color3.fromRGB(19, 22, 28)
	label.Text = message
	label.TextColor3 = Color3.new(1, 1, 1)
	label.Font = Enum.Font.GothamBold
	label.TextSize = 16
	label.BackgroundTransparency = 1
	label.TextTransparency = 1
	label.Parent = gui

	local corner = Instance.new("UICorner")
	corner.CornerRadius = UDim.new(0, 12)
	corner.Parent = label

	TweenService:Create(label, TweenInfo.new(0.2), { BackgroundTransparency = 0.1, TextTransparency = 0 }):Play()
	task.delay(2, function()
		local fade = TweenService:Create(label, TweenInfo.new(0.25), { BackgroundTransparency = 1, TextTransparency = 1 })
		fade:Play()
		fade.Completed:Wait()
		label:Destroy()
	end)
end

task.delay(1, function()
	toast("Welcome to the game")
end)

local remote = ReplicatedStorage:FindFirstChild("Notification")
if not remote then
	remote = Instance.new("RemoteEvent")
	remote.Name = "Notification"
	remote.Parent = ReplicatedStorage
end
if remote:IsA("RemoteEvent") then
	remote.OnClientEvent:Connect(function(message)
		if typeof(message) == "string" then
			toast(message)
		end
	end)
end