This is the script that does not work
local textBox = script.Parent:WaitForChild("textBox")
local function checkstr(str)
local fullStr = ""
for i in string.gmatch(str, "%d") do -- Only checks for numbers
fullStr = fullStr..i
end
return fullStr
end
textBox.Changed:connect(function()
local filter = checkstr(textBox.Text)
textBox.Text = filter
end)
This is the script that works, however it does not allow a default text.
local textBox = script.Parent
local function checkstr(str)
local fullStr = ""
for i in string.gmatch(str, "%d") do -- Only checks for numbers
fullStr = fullStr..i
end
return fullStr
end
textBox.Changed:connect(function()
local filter = checkstr(textBox.Text)
textBox.Text = filter
end)
