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

Non case sensitive onchatted script?

Asked by
Kahnu 5
9 years ago

How would you detect a string, that's not case sensitive, without adding a new table for every single message you would like to detect, like hi, and if the player said Hi, it would still work without actually having to add "hi" and "Hi"

0
Use ':lower()' on both the chatted message and the table, then compare. (making it uppercase works, too) GoldenPhysics 474 — 9y

1 answer

Log in to vote
3
Answered by 9 years ago

For it to be non-cap sensitive, you should do;

if msg:lower() == "hi" then --Using ':lower()', it will revert what the player said into something like this: Player said 'HI', :lower() turns it to 'hi'
print("Hi bro! :D")
end 

Hope this helped!

Ad

Answer this question