Product: Banner Notify | Best Way To Notify!

Heya! I was working on a system that prevents users from spamming the commands on my admin system (I’m doing so by using the .NumberOfActiveNotifications. Here is my code:

local prefix = "-"
local folder = game.ReplicatedStorage.admin
local BannerNotificationModule = require(game:GetService("ReplicatedStorage").BannerNotification_Storage.BannerNotificationModule)
local configs= {
	.3, 					
	Color3.fromRGB(0, 0, 0),

	0, 								
	Color3.fromRGB(255, 255, 255),
}
game.Players.PlayerAdded:Connect(function(plr)
	plr.Chatted:Connect(function(message)
		print(message)
		print(BannerNotificationModule.NumberOfActiveNotifications(plr))
		-- ping
		if message:sub(1, #prefix) == prefix then
			local command = message:sub(#prefix + 1):lower()
			if command == "ping" then
				print("Pong!")
				BannerNotificationModule:Notify("Pong!", "Pong! This is a test notification", "rbxassetid://11326670020", 5, configs,plr)
			end
		end
	end)
end)

Weirdly, my code gives this error when retrieving the .NumberOfActiveNotifications:

Any idea of why this happens? Or is this a problem within my code?

This is a recurring issue with Banner Notify, but I’m trying to fix it ﹕)

2 Likes

Alrighty. Thank you!!

||character limit||

The error is coming from checking the length of an instance, which logically can’t be done. However, your code won’t work regardless as banner library has no current way to actually know how many notifications are active as they are created on the client and you are checking on the server. Due to how replication works, those UI elements are only created for the player.

yo @blve_hxrizon, When the player resets and there is a notification active the notification never ends or disappears.
Check it Here (Dropbox)

just set ResetOnSpawn to false on the Gui object

yeah i did that, but it can happen in certain situation anyways.