I'm trying to make a system where if a player says a certain word, something happens ingame. However, I've run in an issue where the "message" parameter of the Chatted event does not match with the actual chat. For example, this demonstration code is supposed to print "hello" if you chat the words "hi", and print "x" if you chat anything else. However, whenever I test it, it always responds "x", even if I write in "hi" in chat.
local player = game.Players.LocalPlayer
player.chatted:Connect(function(message, recipient)
if message == "hi" then
print("hello")
elseif message ~= "hi" then
print("x")
end
end)

1 comment
Thank you!