Here is the script
01 | Filtered = { "Word1" , "Word2" , "Word3" } |
02 | game.Players.PlayerAdded:connect( function (p) |
03 | p.Chatted:connect( function (msg) |
04 | for i,v in pairs (Filtered) do |
05 | if msg = = v then |
06 | p:Kick() |
07 | end |
08 | end |
09 | end ) |
10 | end ) |
Whenever a player says a word in the Filtered table it should kick them. But it only works if they say the word in it so it cannot detect it in a sentence D: Please help!
For this script, you're going to want to use the find method. And I would also advise in using the lower method to match a word more easily. So, I have edited your script below, it should detect for the words in the wordlist whether the message was in caps or all lower case letters.
01 | Filtered = { "Word1" , "Word2" , "Word3" } |
02 | game.Players.PlayerAdded:connect( function (p) |
03 | p.Chatted:connect( function (msg) |
04 | for i,v in pairs (Filtered) do |
05 | if string.find(msg:lower(), v:lower()) then |
06 | p:Kick() |
07 | end |
08 | end |
09 | end ) |
10 | end ) |