Introducing: CoreNotificationV1!
A lightweight, easy to use, module which utilizes Roblox’s CoreGUI to create custom notifications.
This module includes:
- Custom Buttons
- Callbacks
- Icons
- Sounds
- And more!
Usage:
Here is an example usage on how to use this module.
local RS = game:GetService("ReplicatedStorage")
local CoreNotification = require(RS.CoreNotification:WaitForChild("CoreNotificationV1"))
local function callback(choice)
print(choice .. " was chosen!")
end
CoreNotification:Notify(
"Example Notification", -- Title
"Example body text", -- body text
111630714337304, -- Notification Image
"Button1", -- Button 1
"Button2", -- Button2
5, --Duration
callback
)
You can also create different callbacks for each button.
local function callback(choice)
if choice == "Button1" then
local message = Instance.new("Message")
message.Text = "Button 1 Was Chosen"
elseif choice == "Button2" then
local message = Instance.new("Message")
message.Text = "Button 2 Was Chosen"
end
end
Video Usage:
Video of what we created above:
Here’s something creative i made with this module:
Download:
This was my first community post, how well did i do?
- It was Great!
- It was good
- Could do better
- Meh…
- I hate it
0 voters
if you have any issues, PM me. This resource is for INTERMEDIATE/BEGINNER scripters, you advanced people can probably write this yourself.
Source Code
local notify = {}
local StarterGui = game:GetService("StarterGui")
local defaultDuration = 5
function notify:Notify(
title: string,
text: string,
imageId: number,
button1: string?,
button2: string?,
duration: number?,
callback: (string) -> ()?
)
local bindable = Instance.new("BindableFunction")
function bindable.OnInvoke(response)
if callback then
callback(response)
end
end
local notificationData = {
Title = title,
Text = text,
Duration = duration or defaultDuration,
Callback = bindable,
}
if imageId then
notificationData.Icon = "rbxassetid://" .. imageId
end
if button1 and button1 ~= "" then
notificationData.Button1 = button1
end
if button2 and button2 ~= "" then
notificationData.Button2 = button2
end
local success, err = pcall(function()
StarterGui:SetCore("SendNotification", notificationData)
end)
if not success then
warn("Failed to display notification:", err)
end
end
return notify