Using a table for finding chat messages

I am making a game and it requires me to see if someone said something and if they said it then they lost health and points. I did it but I realized it would probably be more organized if I could do it with a table. However, my brain is the size of a peanut, and I can’t figure out how. If anyone could help that would be great. Ill supply more info if needed.

https://developer.roblox.com/en-us/api-reference/event/Player/Chatted

local players = game:GetService("Players")

players.PlayerAdded:Connect(function(player)
	player.Chatted:Connect(function(message)
		if string.lower(message) == string.lower("") then --change expected message
			local character = player.Character or player.CharacterAdded:wait()
			local humanoid = character:WaitForChild("Humanoid")
			humanoid.Health -= 50
			--do other stuff if necessary
		end
	end)
end)

You can use table.find() to achieve this, however this will only work if the player who chatted says exactly the same word. To fix this and make it vary more I would recommend mainly to learn how to use string.match() and string.lower() (Reference).

local Players = game:GetService("Players")
local Client = Players.LocalPlayer or Players:GetPropertyChangedSignal("LocalPlayer"):Wait()

local Words = {"Hello", "Bye"}

Client.Chatted:Connect(function(msg)
	if table.find(Words, msg) then
		print(msg)
	end
end)

Thank you, im really not the greatest at this. Helps a ton!

Thank you very much! Very helpful