If someone says “L”, “ez”, or “Trash” then the message either gets deleted or it is censored out with “*” stars. Please show both
game.Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(raw_msg)
local msg = tostring(raw_msg)
if msg == "EZ" then
msg = "##"
end
end)
end)
Try that out and tell me if it works
how about if i wanted to delete it
That is only changing a local variable, not what is displayed. OP needs to modify the chat core script.
You will have to fork the chat modules–but that is not hard.
You can modify the InternalApplyRobloxFilter
method, InternalApplyRobloxFilterNewAPI
method of ChatService
, or the InternalPostMessage
method of ChatChannel
If you improperly modify these your game might get moderated–not sure if you’re supposed to modify them at all.
I have tried to delete messages using the chat gui in playergui but it doesnt work as intended. It only deletes the text but leaves the frame and there is a gap in the chat any fix
Delete the Labels Parent so the Frame
I used the childadded event and I deleted it and didn’t work
There are a few ways to achieve it, but one is definitely easier than the other.
- Check if the message contains toxic words.
- Train and use neural networks, to determine whether a message contains toxicity.
You would have to fork the chat modules either way.
game.Players.PlayerAdded:Connect(function(plr)
plr.Chatted:Connect(function(msg)
msg = string.lower(msg)
if msg == “ez” or “trash” or “noob” or “dumb” or “shut” or “nub” or "dumb"then
plr:Kick(“Stop being toxic please”)
end
end)
end)
You should make a table for this instead of making a long line
Consider using msg:find()
for this as your checking if the chat is a string, making it very easy to bypass.
local toxicChats = {"ez","trash","noob","shut","nub"}
game.Players.PlayerAdded:Connect(function(plr)
plr.Chatted:Connect(function(msg)
msg = string.lower(msg)
for i=1,#toxicChats do
if msg:find(toxicChats[i]) then
plr:Kick(“Stop being toxic please”)
end
end
end)
end)
You could make something with this module Toxicity/Spam Prevention Module (Beta) Just require it and analyze the text to see if its toxic