local gui = script.Parent
local TextBox = gui.TextBox
local TextLabel = gui.TextLabel
local ImageLabel = gui.Icon
TextBox.Changed:Connect(function()
if string.find('%p+', '') then
if TextBox.Text:len() == 0 then
TextLabel.Visible = true
ImageLabel.Visible = true
else
TextLabel.Visible = false
ImageLabel.Visible = false
end
end
end)
local gui = script.Parent
local TextBox = gui.TextBox
local TextLabel = gui.TextLabel
local ImageLabel = gui.Icon
TextBox.Changed:Connect(function()
if TextBox.Text:len() == 0 or TextBox.Text:match("^%s+$") then --if length of textbox text is 0 or if textbox text only contains whitespace characters
TextLabel.Visible = true
ImageLabel.Visible = true
else
TextLabel.Visible = false
ImageLabel.Visible = false
end
end)
Not entirely sure what you’re trying to achieve but if you want to match a string which only contains whitespace characters then you would do the following.