How to check if a SendNotification popup is still being shown on the screen?

I use SendNotification to warn the user when his typing inside a TextBox is exceeding a limit of characters:

	game.StarterGui:SetCore("SendNotification",
	{
		Title = "MyTitle";
		Text = "MyText";
		Icon = "rbxassetid://5262562371";
		Duration = 5;
		Button1 = "MyTextButton"
	})

However, if a new Notification is activated before the time of the first Notification is exhausted, the Notifications are stacked:

Is there a way to detect if a previous Notification popup is still active, to avoid these duplicated notifications?

You can probably just use delay.

In your code, check if a variable, NotificationActive, is false. If false, then set it to true, and then send a notification if NotificationActive was false.

Then, you can just add a delay to set the NotificationActive back to false.

delay(5, function() NotificationActive = false end)
1 Like

You might want to keep a table of the configuration so you can keep the Duration field of it. Once config.Duration + 1 time passes (the extra 1 second is just a grace period, could be lowered or raised depending on how frequently you want the notifications to appear) you can then send another notification.

1 Like