How to add kick on spam

Does Anyone Know how to add Kick on Spam Script in ur game if You can help me Please Contact me on discord BannersVoid#7698

2 Likes

You can use the player:Chatted event to check if the player has chatted the same string, if he has, kick or kick and register datastore.

Does it Have a Script?, If it does please let me know and send me on discord.

I don’t have a script, sorry. I’m just giving tips on how you can script one.

2 Likes
local DebounceList = {}
local ResetTime = 5
local MessageLimit = 5

function CheckDebounce()
for i, v in pairs(DebounceList) do
if v.Count >= MessageLimit then
v.Player:Kick("Message here")
end
end
end

function OnList(Player)
for i, v in pairs(DebounceList) do
if v.Player == Player then
return true, v
end
end
return false
end

function IncrementCount(Player)
local GetPlayer, Index = OnList(Player)
if not GetPlayer or not Index then return end
Index.Count = Index.Count + 1
end

game:GetService("Players").PlayerAdded:Connect(function(Player)
Player.Chatted:Connect(function()
local Listed, Index = OnList(Player)
if not Listed then
table.insert(DebounceList, #DebounceList + 1, {["Player"] = Player, ["Count"] = 0})
end
IncrementCount(Player)
CheckDebounce()
end)
end)

while wait(ResetTime) do
for i, v in pairs(DebounceList) do
if v.Count then
v.Count = 0
end
end
end
4 Likes

Doesn’t roblox already prevent this?

1 Like

Thank You it Worked :smiley: