Help adding a blacklist for letters

So, I’ve made a script that takes the “ContentText” of a TextBox instance, but there’s only one small issue, as of now, people can input both letters, and numbers.

	local SecurityText = securityLabel.ContentText

(Code is just a piece of what it actually is, the only issue with it is finding letters)
Is there any way to detect if the “SecurityText” variable contains letters or numbers?

1 Like

E.g. with an “if” statement.
(Text is too small to be sent.)

If you want to detect certain characters in a string you can use string.match(string,pattern)

If you want to blacklist both letters and numbers you can use the %W pattern:

local s = "Johnathan532"

if string.match(s, "%W") then
   print("Alphanumerics found")

The simplest way is to local Pass = tonumber(text) the code.

If it passes (returns a number), you have a number-only code. Otherwise, there’s text in it.

Edit: pcall isn’t required I forgot.

Alright, thank you very much! I also used :find and it also worked fine.

1 Like