|
Name
|
PlayerChat
|
|
Arguments
(in table)
|
Player player, string text
|
|
Return option
|
Return false to block the message
|
Description
Fired when a player sends a chat message.
Examples
function Foo(args)
print(args.player:GetName().." says "..args.text)
end
Events:Subscribe("PlayerChat", Foo)
Creating a chat filter
blacklist = {
"arse",
"crap",
"heck",
"pants",
"breasts",
"stupid",
"fudge",
"darn"
}
function Foo(args)
local lowercased = args.text:lower()
for index, word in ipairs(blacklist) do
if lowercased:find(word) then
return false
end
end
return true
end
Events:Subscribe("PlayerChat", Foo)
See also
LocalPlayerChat