If you’re using an admin like Kohls Admin you should be able to just revoke their permission to use the Clean command. Especially if they don’t have a reason to use it.
Also this exact code has been asked in a similar question. So I suggest checking out this post.
You can try kicking people whose chat message is obnoxiously long, or if their message contains a blacklisted word.
This might not be the best solution, but here is a possible implementation:
local players = game:GetService("Players")
local function isBlacklistedContent(content)
if (#content > 255) then
return true
elseif (content:match(":clean")) then
return true
end
return false
end
local function playerChatted(player)
return function(message)
if isBlacklistedContent(message) then
player:Kick()
end
end
end
local function playerAdded(player)
player.Chatted:Connect(playerChatted(player))
end
If you’re using a free model admin I suggest just removing it at this point. The issue is likely being caused entirely by the admin if you’re using one and it may be better to write your own.
For future reference:
Only connect .Chatted signals for people who are admin.
You could try limiting certain commands to 1 per message.
local blacklist = {":clean"}
for _,v in ipairs(blacklist) do
local i= string.find(msg,v)
if i and string.find(msg,v,i+#v) then
--illegal message
end
end
I had suggested this (see my code block above) and It appeared to not have worked. Your code uses a very similar method so I don’t think it will work either? Not sure, but it likely will not.
It won’t prevent lag if they don’t actually kick or discard the message before parsing it to the admin script, which is probably the issue here.
Also, 100 character long array of a heavy command is more than enough to cause issues. You shouldn’t be checking for general message length but occurances of specific commands.
My confusion here is that even if I disable :clean, it’ll still spam. I looked into it and if the exploiter just removes the prefix, they can still crash a server with any message (doesn’t have to be a command).
Try running it on a server to see if it still happens. Also try joining with an alt or a friend and make them send the message to see if it affects you.