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

Checking if a value has "x" characters?

I'm trying to make a code input GUI, and it checks if you have entered 4 or more characters. I don't know how to do this, would anybody be able to explain it to me? I am aware it uses math or something like that, but unsure of it's exact usage.

1 comment

2

if #script.Parent.TextBox.Text >= 4 then

2 answers

✓ Accepted answer

It's super easy. # gives you the length of a string (in number of characters). Therefore, you can just do this:

if #string >= 4 then

another way to do this is to do

if ('string'):len()>=4 then
--block of code
end

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