NotificationStyle - Module Powered Notifications

Disclaimer

This module was made when i knew almost nothing about scripting.
I might remake it in the future.


About

NotificationStyle is simple-to-use notifications module I made quite some time ago
It’s pretty much something that I made for practice

Parameters

Player: Player -- can be nil if running on client --
Configuration: table

Configuration

Style: string (if nil: "Modern");
Duration: number (if nil: 5)

Sound: string or number (if nil: "Pop");

Title: string or number (if nil: "Notification");
Text: string or number (if nil: "Text was not found");
Icon: string or number (if nil: "Exclamation");

FadeInTweenInfo: TweenInfo (if nil: replacement_FadeInTweenInfo),
FadeOutTweenInfo: TweenInfo (if nil: replacement_FadeOutTweenInfo),

Usage

Lets think that NotificationStyle is located inside ReplicatedStorage

require(game.ReplicatedStorage.NotificationStyle)(game.Players.LocalPlayer --[[ or nil if running on client ]], {
	Style = "Compact",
	Timeout = 10,
	
	Sound = "Badge", -- supports numbers and "rbxassetid://number"
	
	Title = "Example",
	Text = "The FitnessGram Pacer Test is a multistage aerobic capacity test that progressively gets more difficult as it continues. The 20 meter pacer test will begin in 30 seconds. Line up at the start. The running speed starts slowly, but gets faster each minute after you hear this signal. [beep] A single lap should be completed each time you hear this sound. [ding] Remember to run in a straight line, and run as long as possible. The second time you fail to complete a lap before the sound, your test is over. The test will begin on the word start. On your mark, get ready, start.",
	Icon = nil,

    --[[ Honestly who will be using these two
	FadeInTweenInfo = nil,
	FadeOutTweenInfo = nil,
    ]]--
})

--// "Player" parameter is required to run the module on server (pls dont) //--
require(game.ReplicatedStorage.NotificationStyle)(game.Players.LocalPlayer)

--// "Player" parameter is not required to run the module on client (pls do) //--
require(game.ReplicatedStorage.NotificationStyle)()

Custom Styles

NotificationStyle comes with 5 preset styles.
However, they will not fit with a big chunk of games. It’s not a big deal to make a style, but keep these 2 things in mind:

  • Icon, Text and Title must always be a child of style frame. If you will be making some sort of image based background, make sure that the style itself is always a Frame.

  • If you want smaller or bigger devices to support the system, make sure that size of everything is set to Scale

Download

File: NotificationStyle.rbxm (13.9 KB)
Model: NotificationStyle - Module Powered Notifications - Roblox

Hope y’all will find this useful!

22 Likes

Well done! Looks relatively simple but useful! Thank you for the contribution!

No problems! If you will end up finding anything that can be improved in code it will be a pleasure if you PM me. I made it pretty quickly and haven’t really thought about that back then.

Ah! I think it would be a good idea to add a simple custom sound object option, where you can use a number value, instead of a string value to choose a sound.

The script on line 20 (I think it’s line 20) would just check if the sound is a string value, nil, or a number value, you already have the first 2, so a extra elseif if it’s a number value would work. Then you would just create a custom sound object, play it and destroy it once it’s complete! Otherwise if you’re very interested in making this as good as possible, maybe add more functions, such as server notification, so it sends a notification to all clients. Also tweening UI on the server is generally less good, because I’m pretty sure tweens aren’t replicated themselves, so the tween can look jaggy. A solution would be to send a remote event to the client to tween it!

1 Like

Thanks a bunch! I’ll get into it right now! I haven’t seen anything bad with tweens yet but I will try to make a laggy game and then test it in it.

It’s mostly just a problem with bad networking! For instance if the players ping is changing rapidly it can make the tween messy! Just a thing I’ve heard though! This is the same reason it’s better to play effects individually on each client, at least high movement effects such as a lightning bolt!

Pretty simple and quick update.

  • Added Icons folder where you can store all your Icon IDs
    • With parameter support of course
  • Added ID support for Sound parameter

I have a question. How do you trigger the notification in a script?
I tried a couple of methods by using the function in a local and server script, but they haven’t worked to my knowledge.
I think it has something to do with the first, the player value. Do you know what type of value it needs to be?

You can find player in local scripts with LocalPlayer.
With server scripts, you might need to detect a function. For example, game.Players.PlayerAdded, detecting if player used ProximityPrompts, ClickDetectors, etc.

Another small and quick update:

  • Added 2 new styles
  • Added 3 new icons
  • Added 6 new sounds
  • Added TweenStyle parameter
    • Aka custom EasingStyle

I wondering if you can make a tutorial about how to setup it.

new update: made the module much more easier to work with