How to check if something is a number

You can write your topic however you want, but you need to answer these questions:

  1. I want to check if something is a number.

  2. Idk how

  3. I tried one thing but it did not work.

The thing is from a text box.

3 Likes

typeof() is used to check if its a number,string or boolean so you can do something like

if typeof(textbox.Text) == "number" then
   --do something
end
6 Likes

To check whether it is a string or a number or a boolean you can use this function called typeof
here is an example:
TypeOfValue
This returned me String in the output because magnus is a string.
in case of textbox you can take the input of the player in the text box and check the type with this.
and then you can use a if statement
if textboxinput == number then
–do what you intend
end

Thanks!