I’ve been trying to change the BackgroundColor3 to Color3.fromRGB(200, 0, 0) when the string isn’t a (string that can be converted into a) number. I’ve looked around on the DevForum, but couldn’t find any solutions.
Any help would be appreciated!

--Variables--
local list = script.Parent
--Script--
list.BubbleDuration.UserInput.Changed:Connect(function()
if tonumber(list.BubbleDuration.UserInput.Text) or list.BubbleDuration.UserInput.Text == "" then
list.BubbleDuration.UserInput.BackgroundColor3 = Color3.fromRGB(100, 100, 100)
print("Success.")
else
list.BubbleDuration.UserInput.BackgroundColor3 = Color3.fromRGB(200, 0, 0)
print("Error.")
end
end)

You can also use string patterns to detect digits. I assume your numbers are always integers, so this can work pretty well:

if string.match(text, '^%d$') then --or you can do %d%d for double digits, or %d+ for as many digits as you want
end

Basically, %d gets any digits from 0-9. You can do %d+ to make sure it captures all the digits, but if you have a set number of digits, then you can do %d for as many digits. The ^ is an anchor that makes sure the pattern occurs at the beginning and $ makes sure it occurs at the end, so when you combine both, it makes sure the entire string is numerical.