Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I make chat commands be both uppercase and lowercase?

It's perplexed me for a while. I've looked up the chatted function and strings on the wiki, but I cant find anything. I may not be looking in the right place. A wiki link and/or example code would be EXTREMELY helpful and is all I'm really looking for.

1 answer

✓ Accepted answer

I'm going to assume you mean that when a player types a command like this:

eXplODe

The command works. That's quite simple and you could just do this:

game.Players.PlayerAdded:connect(function(plr)
	plr.Chatted:connect(function(msg)
		if string.lower(msg) == "explode" then
			-- command code
		end
	end)
end)

string.lower() turns whatever string you provide lowercase. Just match that up with a lowercase command and it'll work every time. Hope I helped :)

1 comment

0

You could even do "msg:lower()" instead. Shorter and easier to read.

This discussion is preserved as it was. New answers, comments, and votes are closed.