I want to make a keypad code, so how do I reset the code it the amount of digits in the value is > than 3?
COMMUNITY QUESTION
How do I make a script that counts the amount of digits in a value?
2 answers
How many digits?
Well, you need to use string.len
If the value is only digits, then you can get the length of the value, which will tell you how many digits there are.
Here's an example:
local Number = 73948329
local Digits = string.len(tostring(Number))
print(Digits)
1 comment
0
example2: local bit = "Billy bob broke bob's billy bike." print(#bit)
I'm not a 100% sure on if this works, but try this:
local value = script.Parent.Digits.Value
if #value > 3 then
print("Your code here")
end
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
We'll need a tad more to work on.
Learn strings.