Is it possible to check if a textbox isn't empty?

Hey,

I wanna know how I can check if a textbox isn’t empty.
So for example

if script.parent.Text = filled then

I hope you understand what I mean and you can help me. Otherwise, I will explain it more! :smiley:

1 Like
if #script.Parent.Text > 0 then

You’d also probably need to check for whitespaces, something like this

local text = string.gsub(script.Parent.Text, "%s", "")
if #text > 0 then

Checks for spaces and removes them and then compares

3 Likes

if TextBox.Text ~= nil or TextBox.Text == " "

1 Like

You can do:

local textBox = script.Parent
local runService = game:GetService("RunService")


runService.Heartbeat:Connect(function(deltaTime)

    if #textBox.Text > 0 then print("Text Box Is Not Empty!") end

end)

The best solution over here, idk why it is not solution for this post