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

Checking if a value has "x" characters?

Asked by 8 years ago

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.

2
if #script.Parent.TextBox.Text >= 4 then M39a9am3R 3210 — 8y

2 answers

Log in to vote
0
Answered by
Perci1 4988 Trusted Moderation Voter Community Moderator
8 years ago

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
Ad
Log in to vote
1
Answered by 8 years ago

another way to do this is to do

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

Answer this question