game.Players.jaytheidiot.Chatted:connect(function(Msg) if Msg == "Cheese" then Song:Stop() Song.SoundId = "rbxassetid://145143628" Song:Play() end end)
How would I make this check for the word "cheese" in a sentence. Not case sensitive?
To this case insensitive, we just operate on a lowercase version of the text:
msg = msg:lower()
We can use Lua's pattern matching to find something which a content is punctuation or space separated, if you actually require it to be a word (e.g., will not accept "cheesewheel" but will accept "cheese wheel")
msg = " " .. msg .. " "; local cheeseFound = msg:find("[%s%p]+cheese[%s%p]+");
Alternatively, if you just need to find "cheese" somewhere in the text, but not necessarily as its own word:
local cheeseFound = msg:find("cheese");
Post Script:
If an answer explains all you need, mark the answer as accepted so that Helpers and Askers have understand the solution