How to know if .Chatted event fired when a player spammed?

Hello. Sorry if I did not clarify myself so well, so here is my point.
I made a custom chat using Roblox’s Bubble Chat as the message sender. Now, it all works perfectly fine, but when a player is spamming and his message is not sent .Chatted event is still firing causing his message to appear on the custom chat. Is there any way to prevent it? If I was unclear, I may provide an explanation video if you just ask.

Add cooldowns to your script. Simplem

4 Likes

use tick(), it start from is a 1970 January 1st. It’s a UNIX epoch time.

The chat message sender is Bubble Chat. I meant that .Chatted is still firing, I will provide an example right now.

Oh you mean you need disable player chat if he spamming?

are you talking about the old one or the new one

I did not mean to disable the player’s chat, I said how to prevent .Chatted from firing without considering if a player is spamming in the default message sender. Here’s an example video, I hope you understand:

OHHHH i got it. Just add tick() to check time from last message.

I just to know if when .Chatted is fired how to know if a player is spamming or not. I provided an example video above, you may check it out and it can be more clear.

I uploaded the same video with another website: https://streamable.com/pe2j4x

Streamable banned in my country…

There you go:


You can see that it didn’t chat the message but .Chatted still fired considering the chat has added this message even though it was blocked for spamming.

Try this,

(player added here)
local chatTick = tick()
local amount = 0
Player.Chatted:Connect(function(msg)
amount += 1
if (amount >= 3 and tick() - chatTick < 1) then
print('spamming.')
amount = 0
chatTick = tick()
end
if tick() - chatTick > 1 then

amount = 0
end
chatTick = tick()
end)

Might be wrong, I made it here xD

1 Like

I need to get the exact same delay as that the default bubble chat has. So it must be accurate in seconds and all.

why not check if the current message was the last message then disable the chat?

local lastmessage = ""
game.Players.LocalPlayer.Chatted:Connect(function(msg)
    if msg == lastmessage then
         local StarterGui = game:GetService('StarterGui')
         StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, false)
         wait(3)
         StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, true)
    else
     lastmessage = msg
    end
end)
2 Likes

You’ll need to hook into the chat modules. Player.Chatted is important to always fire to allow for varying levels of custom chat including using your own spam detection instead.

It’s hard to tell you exactly how without understanding how you’ve set it up.

1 Like

I want the delay to be similliar to the default chat’s delay.

Thanks everybody for the answers, but it yet did not help me figure out. I will just make a custom chat message sender. G’day/night! :+1: