Hiding Text TextBox

Hello, so I have a script that hides a password but I want it to hide when there is text but when there is no text in the textbox then the placeholder text will appear again.

So far I have this code:

local TextBox = script.Parent.TextLabel

script.Parent:GetPropertyChangedSignal("Text"):Connect(function()
	if script.Parent.Text == 1 > 8 then -- 1 > 8 for above 1 char
script.Parent.TextTransparency = 1
		else
script.Parent.TextTransparency = 0
	end
	TextBox.Text = string.rep("*", #script.Parent.Text)
end)
1 Like

Couldn’t you just check for any whitespace or if the TextBox’s Text is equal to 0 using gsub?

local TextBox = script.Parent.TextLabel

TextBox:GetPropertyChangedSignal("Text"):Connect(function()
    local Text = TextBox.Text:gsub("%s", "")

    if #Text == 0 then
        TextBox.TextTransparency = 1
    else
        TextBox.TextTransparency = 0
    end
end)
3 Likes

Thank you. Thing is, I just stole the code online :man_facepalming:

Y u steal code though

You can self-learn from doing the epic scripting using the articles provided by ROBLOX!

I know but sometimes I just :water_buffalo: