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

How could I make a TextBox only accept Numbers?

Would I use

String.lower()

?

1 answer

✓ Accepted answer

You can check if a message is a number by using tonumber.

Examples,

local x = 235

if tonumber(x) then
	print("Number")
else
	print("String")
end

-- OUTPUT
"Number"


local x = "385"

if tonumber(x) then
	print("Number")
else
	print("String")
end

-- OUTPUT
"Number"


local x = "Batman"

if tonumber(x) then
	print("Number")
else
	print("String")
end

-- OUTPUT
"String"

Using this you should easily be able to only accept numbers as input.

1 comment

0

Already fixed it sorry. But thanks for the help ill use this in the future.

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