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?