How to stop .Chatted event firing if player's been hit by flood detection

Hello, I’m using the legacy chat version and i’m trying to see, how would I make it so this script doesn’t print (“Message Has Been Sent!”) if the player has been hit by the Roblox Spam / Flood Detection?

local Players = game:GetService("Players")
local lastChatTimes = {}

Players.PlayerAdded:Connect(function(Player)
	lastChatTimes[Player] = os.time()

	Player.Chatted:Connect(function(msg)
		lastChatTimes[Player] = os.time()
		print("Message Has Been Sent!")
	end)
end)
1 Like