I am trying to make a script that fires when a person chats the word 'test'. However, there are multiple ways to say test in ROBLOX. You can say "TEST", "TesT", "teSt" and much more. How do I make it so that it fires for all of those no matter how it is capitalized?
Use string.lower()
, here are some usage examples. https://www.robloxdev.com/articles/Lua-Libraries/string#string.lower
X = "HAHA" -- we have "X", a capitalized variable defined as HAHA, if string.lower(X) == "haha" then -- if X uncapitalized is "haha", then print("Yes!") end
So, you would basically do
if string.lower(msg) == "blahblah" then end
game:GetService("Players").PlayerAdded:Connect(function(Player) Player.Chatted:Connect(function(Msg) if (Msg:lower() == "haha") then -- this will lower the message and how it's capitalized. end end) end)