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

How would I make a number only text box?

Hello, I am trying to make a textbox gui where if you type something other than a number then it will remove the non number characters in the text. I have tried tostring() and tonumber() and gsub. How can I do this correctly?

1 answer

✓ Accepted answer

in a runservice heartbeat loop you could do something like TextBox.Text = tonumber(TextBox.Text) or ''

the or '' is to make sure tonumber() doesn't return nil.

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