Hey! I’m trying to send a notification (StarterGui:SetCore - SendNotification) on a ClientEvent callback. It does send the notification, however, it multiplies each time for some reason.
What I mean is that for the first time, it sends once. For the second time, it sends twice. For the 100th time, it would send the notification 100 times.
Any idea why that happens?
Trigger.MouseButton1Click:Connect(function()
DataStoreEvent:FireServer(Players.LocalPlayer)
DataStoreEvent.OnClientEvent:Connect(function(blacklisted)
if blacklisted == false then
-- unrelated script here
elseif blacklisted == true then
StarterGui:SetCore("SendNotification",{
Title = "Blacklisted",
Text = "Your access for the report system and handcuffs is removed!",
Duration = 5,
})
end
end)
end)
DataStoreEvent.OnServerEvent:Connect(function(targetPlayer)
local blacklisted
local success, errormessage = pcall(function()
blacklisted = gameDataStore:GetAsync(targetPlayer.UserId)
end)
DataStoreEvent:FireClient(targetPlayer, blacklisted)
end)