How to make string:math not case-sensitive?

I have a simple script right here

game.Players.PlayerAdded:Connect(function(player)
	player.Chatted:Connect(function(message)
		if message:match("Roblox") then
			print("i said roblox")
		end
	end)
end)

The problem is that this is case-sensitive. The player has to say exactly “Roblox”, with the uppercase and lowercase letters. If they, for example, said “roblox” or “rObLoX”, it won’t work.

How to make this not case-sensitive?

1 Like

if message:match("Roblox") or message:match("roblox") then
nevermind, but i think you should do a lil bit more research How to make string:match() not case sensitive?

1 Like

you could always use string.lower(txt) to make the text lowercase and then try it

2 Likes

You can use string.lower to prevent this:

game.Players.PlayerAdded:Connect(function(player)
	player.Chatted:Connect(function(message)
		if string.lower(message):match("roblox") then
			print("i said roblox")
		end
	end)
end)
2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.