MatXpl Posted October 31, 2011 Posted October 31, 2011 Hi! I have sobe gui Edit Field, but how do I set up the possibility of using only the digits 0 - 9 with no alphabet ( a - z ) ?
bandi94 Posted October 31, 2011 Posted October 31, 2011 check what that person write in the editbox and if is not a number 0-9 then cancel it
Castillo Posted October 31, 2011 Posted October 31, 2011 function checkEdit(edit) local text = guiGetText(edit) if not tonumber(text) then return false end local text = tonumber(text) if text < 1 or text < 10 then return true else return false end end Should work.
bandi94 Posted October 31, 2011 Posted October 31, 2011 Solidsnake14's script check if you write a number so you can only write number's
Aibo Posted October 31, 2011 Posted October 31, 2011 iirc cancelEvent() does nothing onClientGUIChanged. it doesnt prevent the editbox value from changing. moreover, editbox already has it's value changed when it's called. local edit = guiCreateEdit(0, 0, 1, 0.1, "", true) -- your editbox addEventHandler("onClientGUIChanged", edit, function() guiSetText(source, guiGetText(source):gsub("[^0-9]","")) end)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now