Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Check if all characters are available in the message?

Asked by
Cyrakohl 108
5 years ago
Edited 5 years ago

So basically what i'm trying to do is to try and check so the Player Message has all characters so for example If my message has a capital T itll still run and if it has a lowercase T itll still run I have my attempt here:

This is just the snippet of code i'm having issues with.

if Msg == string.match("Test","%.") then
        print("test")
    end

Also I would like to add the code doesn't run no errors in the output either.

0
no, bad User#24403 69 — 5y

1 answer

Log in to vote
1
Answered by 5 years ago

string.match(str, pattern, init = 1) returns the match found if any. nil if no match was found.

What you can do is either lower the message to check if it equals a word in all lowercase.

if Msg:lower() == "test" then -- you can also do Msg:upper() == "TEST" 
    ...
end

What these codes are doing is lowercasing the message and seeing if it equals "test".

Ad

Answer this question