Only allow numbers in Textbox?


Is there a way to only allow the player to enter numbers into a text box?
If not then how can I check if the player entered a number or not?



Thank you very much.

[editline]30th October 2013[/editline]

I have another problem.
You can still copy paste whatever character you want into the text box.
I’ve been searching but can’t seem to find a way to disable it.

As far as I know it isn’t possible, but if anybody has an idea please post it here.

[editline]30th October 2013[/editline]

Removed Code,

Code below works fine.

Using OnTextChanged, just tonumber the value. If the value is anything but a number, it’ll return nil. You can use this to check if something is entirely numbers or not.

DTextEntry.OnTextChanged = function()
if tonumber(DTextEntry:GetValue()) == nil then return false end