Hi there, back with another kick script needing help.
So this time I need help with this, why does my "kick on chat" script doesn't work?
local canKick = {"LocalPlayer"}
game.Players.PlayerAdded:Connect(function(plr)
for _, c in pairs(canKick) do
if plr.Name == c then
plr.Chatted:Connect(function(msg)
if string.sub(msg,1,5) == "Damn" then
local pl = game.Players:FindFirstChild(string.sub(msg,7))
if pl then
pl:Kick("Kicked for bad language.")
end
end
end)
end
end
end)
Just wanting help with this, just making a family friendly chat game! ;)
Thanks!

4 comments
is this a server script
What if they write the swear word somewhere else in their message? Also, why do you not use Roblox's default chat filter?
Why? People can counter it dude. Seen people saying words such as Phak etc. That BYPASSES Roblox's horrible tagged chat filter anyways. LOL.
If an API made by professionals is bypassed then I don't see how you can do any better https://developer.roblox.com/articles/Text-and-Chat-Filtering