so i wanna detect if the text on a TextBox is a number. how could i do that?
Edit: Nvm, i had to use tonumber
do something like
1 | if script.parent.Text = "1" , "2" |
1 | String = "124124" |
2 | if tostring ( tonumber (String)) = = "" then |
3 | print 'not Number' |
4 | else |
5 | print 'Is number' |
6 | end |
That is how to detect if it HAS numbers
EDIT:
That was a joke.
here is how to make the textbox only contain numbers
1 | textBox.Changed:connect( function (p) |
2 | if p = = "text" then |
3 | textBox.Text = tonumber (textBox.Text) |
4 | end |
5 | end ) |
Marked as Duplicate by cabbler and evaera
This question has been asked before, and already has an answer. If those answers do not fully address your question, then please ask a new question here.
Why was this question closed?