Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to change a TextBox's text into asterisks, like a password textbox?

1 answer

✓ Accepted answer

The number of characters in a string can be counted using #string, so we can use this to iterate through each character in the string, replace it with an asterisk, and repeat until we get to the end. After that, just replace the TextBox text with the string we just made. We'll use the FocusLost event to update the text.

TextBox = script.Parent
local replacer = "*"

TextBox.FocusLost:Connect(function()
	local string = TextBox.Text
	local newString = ""
	for i = 1, #string do
		newString = newString .. replacer
	end
	TextBox.Text = newString
end)

Strings wiki post

FocusLost event

This discussion is preserved as it was. New answers, comments, and votes are closed.