Re:Notify | Simple & Clean Notifications Framework

As of V1.3, Redefine:A is only supported if the engine build version is 110 or higher, or R:ALite Version 1.0 or higher.

Re:Notify

A Simple yet Powerful Client-Based Notifications Framework

This module comes directly as a port from Redefine:A 5, hence the UI is exactly the same.

The module was made to separate the notifications from it, allowing you to create the exact same notifications while not using the system.

Achieve the same result as the image above
Notify(player,"This is a normal notification");
Notify(player,"This is a warning",{
	Type = "warning";	
});
Notify(player,"This is an error",{
	Type = "error";	
});
Notify(player,"This is a critical notification",{
	Type = "critical";
});
Notify(player,"This notification has a timeout",{
	Timeout = 20;
});
Notify(player,"This notification has a button",{
	Options = {
		"button"
	};
});
Notify(player,"This notification is ugly (lol)",{
	TextColor = Color3.new(math.random(),math.random(),math.random());
	BackgroundColor = Color3.new(math.random(),math.random(),math.random());
});
Notify(player,"This notification has an icon",{
	Image = "http://www.roblox.com/asset/?id=10993876141";
});
Notify(player,"This notification will spawn another one when clicked",{
	Options = {
		["Click me!"] = "Click me!";
		["No, Click me!"] = {Primary = true; Text = "No, Click me!"};
		["zzzz"] = "zzzz";
	};
	Callback = function(selection)
		env:Notify(player,selection);
	end;
});
local notification = env:Notify(player,"A notification will appear after this one expires.",{
	Timeout = 10;
	Clickable = false;
})
notification:AwaitResponse(function(_)
	env:Notify(player,"Hello, I'm the other notification!");
end)

How to use:

local ReNotify = require(15700220413);

local Notification = ReNotify( Player , "Text" , {Options} ); 
-- You can see what the Options are in the Cheat Sheet.

-- V1.2: Send the same notification to all players with a RemoteEvent. No server-sided control, however.
ReNotify.RemoteEvent:FireAllClients("Text" , {Options} );

GetSourceCode (Will redirect you to the MainModule / Re:Notify’s Creator Hub page)

"API" Cheat Sheet

Options:

-- Everything here is completely optional.
Type:"normal"|"warning"|"warn"|"error"|"critical";
Timeout:number;
Clickable:boolean;
TextColor:Color3;
BackgroundColor:Color3;
PushLowest:boolean;
Image:string;
Sound:string;
Options:{NotificationChoice|string};
Callback:((string|number)->any?); -- You are the one who manages the callback.

NotificationChoice:

Text:string;
Primary:boolean?;
TimedOut:boolean?;

Notification Class:

UID:string; -- Notification Identifier (internal)
Player:Player; -- The player who received the notification
Text:string; -- The original notification text
Options:Options; -- The options the notification had
Callback:function(Choice); -- The server callback
Completed:boolean; -- The notification has been completed (clicked / timedout)
SelectedOption:string?; -- What was the option that was selected

self:AwaitResponse(Callback) -> Choice; -- Yields the thread until a response it given (uses task.wait()); If Callback is given, calls the Callback upon completion.
self:Update(Options); -- Updates the existing notification. Doesn't do anything if the notification doesn't exist. (might error)
self:Destroy(); -- Removes the notification and clears the class as if it never existed.

There is currently no license for Re:Notify, but it will be changed to MIT once V2 is released.
You are free to use, modify, copy, or even sell (if not as-is). Whatever floats your boat.

46 Likes

Pushed version V1.1


→ Fixed a rare error that may occur from a wrongfully-transmitted ‘userdata’ instead of string. Fix was replicated from Redefine:A5. (note: i have no clue what caused it, but it appears as it was fixed in R:A with a tostring())

Nice library! Cleanest toasts I’ve seen so far in the community :+1:

5 Likes

Is there a way to notify all players or do I have to loop it manually?

Pretty sure you’d have to do it manually. The API doesn’t provide any function like that. It’s nothing that can’t be fixed with a loop, though, as you said.

2 Likes

I’ll make it possible to get the RemoteEvent and RemoteFunction so you can :FireAllClients() with the notifications in the next update, thank you for the suggestion.

3 Likes

Also, I was looking through the source code a bit, and noticed that the module returns (Player, string, Notification) -> (). I’m fairly sure it was supposed to be (Player, string, Options) -> Notification though.

2 Likes

Actually (:nerd_face:), The module returns (Player, string, Notification) -> Notification?, since there’s a slight chance the player would not receive a notification to begin with.

Will update the type with the next update as well.

3 Likes

:person_facepalming: Forgot there actually was a code path where a notification wasn’t returned.

1 Like

Pushed version V1.2


→ Made the module return a metatable so you can call it as explained, or you can now get the RemoteFunction/RemoteEvent and do ReNotify.RemoteEvent:FireAllClients('Text',{Options}). the only thing about RemoteEvents is that they won’t return the created UIDs.

→ Fixed Type for the Notify function to (Player, string, Notification) -> Notification?.

2 Likes

Pushed version V1.3


→ Made the module support Redefine:A5 (or R:ALite if the idea comes along) by making the notifications go through it.

→ Type fix for Notification.Type = string? to Notification.Type = ("normal"|"warning"|"warn"|"error"|"critical")?.

Requested module experienced an error while loading.

local Notify = require(15700220413);

Could you provide the direct error? It should appear above the one you mentioned. (Preferably in a private message as to not bloat the thread)

Version V1.3A


→ Fixed an oopsie ( @devmarissa )

1 Like

I recommend including the actual module link for users to get, since requiring it by ID doesn’t work in the client and has a higher chance to fail

2 Likes

I second this. OP could use Packages to achieve the behavior of require(id).

2 Likes

The module was intended to be a server-side framework allowing to send notifications directly from the server and get a response from the client.

I’ll add a client-side option later though as per the suggestion, but you will not be able to see what the client responds to such notifications in order to keep the server-side secure from remote spamming.

edit: I posted a direct link for the module for now


@PhoenixRessusection I will look into the Packages feature, I am familiar with it but never got to actually use it.

1 Like

Sorry, if this is considered necro-posting, but I want to remove the credits premade into the module and put it into my credit system (will do the same job).

You can fork the module and remove the credits in the LocalScript.