game.Players.PlayedAdded:connect(function(player)
player.Chatted:connect(function(msg)
local function saidWord(message, word)
return string.match(string.lower(message), string.lower(word))
end
if msg == saidWord(msg, "hello") then
print(msg)
end
end)
end)
I have this script, so when a player chats something, and if that something is 'Hello', then it will print the message in the output. What I want though is sometimes players say 'Hello, how are you', or something like that, where they say 'Hello', but they add more to the message. Is it possible to pick it up if the word is used in a sentence.
EDIT
It does not print the message unless you say 'hello'

10 comments
try string.find
http://wiki.roblox.com/index.php?title=Function_dump/String_manipulation#string.find
String.find does not work at all.
Didn't I already answer this? https://scriptinghelpers.org/questions/29796/how-to-check-if-certain-word-is-used-in-chat#33183
You didn't answer it, cause it didn't work.....
Copy exatly what I wrote, paste it in to a clean script, and try it
Still does not work
Everytime I say a word it prints, even if the word isn't Hello
I editted my question with the exact code in the script. It does not work unless I just say hello in lowercase...
Your boolean expression is wrong. The function returns
helloorniland you are comparing it to the entire message. Try just puttingif saidWord(msg, "hello") then