Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How would I make a number only text box?

Asked by 4 years ago

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

Log in to vote
0
Answered by
DollorLua 235 Moderation Voter
4 years ago

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.

Ad

Answer this question