So I don’t really know how to make this thing, I don’t even know where to start and I wanted to ask if there is a way to make a custom notification system, there is no tutorials on youtube about it and I really want to make myself a custom notification because gui’s get in the way.
This is the default ROBLOX notification system.
But is there a way to make a custom one?
(With like if there’s a new notification it slides the old one above it like stuff like that)
It is possible of course. Using a ScreenGui you can create a new TextLabel that will display the new notification. Here’ s a starter code.
In a moduleScript
local screenGui = game.Players.LocalPlayer:WaitForChild("PlayerGui"):WaitForChild("ScreenGui") -- assumes we have a screenGui name ScreenGui in PlayerGui
local notifObj = {}
notifObj.__index = notifObj
-- creates and returns a new notifObj
function notifObj.new()
local newNotifObj = setmetatable({}, notifObj)
return newNotifObj
end
-- creates a new notification in screengui, pushing up older messages, and setting a self-destruct timer to 5 seconds
function notifObj:PushMsg(msg)
-- push up old notifs
for _,oldNotif in pairs(screenGui:GetChildren()) do
oldNotif.Position = oldNotif.Position - UDim2.new(0,0,0, oldNotif.Size.Y.Offset + 10)
end
-- create new notif with timer
local newNotif = Instance.new("TextLabel", screenGui)
newNotif.Text = msg
newNotif.Size = UDim2.new(0,200,0,50)
newNotif.AnchorPoint = Vector2.new(1,1)
newNotif.Position = UDim2.new(1,-10,1,-10)
wait(5)
newNotif:Destroy()
end
return notifObj
Of course, if you don’t yet understand OOP, I highly recommend you looking into it. But just for now, this is how you’d use this moduleScript.
Sample LocalScript
local screenGui = Instance.new("ScreenGui", game.Players.LocalPlayer:WaitForChild("PlayerGui"))
local module = require (script.Parent:WaitForChild("ModuleScript"))
local notifObj = module.new()
local randNumb = math.random(1,5)
local i = 1
while wait(randNumb) do
coroutine.wrap(function()
notifObj:PushMsg("Message"..i)
end)()
randNumb = math.random(1,5)
i = i + 1
end
None of this is an actual finished product, but by adding things such as Tweening and custom labels for the look of the notification, this would work perfectly for a game.
You can copy and paste the codes in their respective scripts in the starterPlayerScripts folder and play around with it to make it work the way you like it.
I really appreciate it, this works absolutely fine and i’m about to make my own gui’s with tweening all of that, but really thank you for your help, i needed this.