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
1 | X = "HAHA" -- we have "X", a capitalized variable defined as HAHA, |
2 |
3 | if string.lower(X) = = "haha" then -- if X uncapitalized is "haha", then |
4 | print ( "Yes!" ) |
5 | end |
So, you would basically do
1 | if string.lower(msg) = = "blahblah" then |
2 | end |
1 | game:GetService( "Players" ).PlayerAdded:Connect( function (Player) |
2 | Player.Chatted:Connect( function (Msg) |
3 | if (Msg:lower() = = "haha" ) then -- this will lower the message and how it's capitalized. |
4 | end |
5 | end ) |
6 | end ) |