Hello everyone, I was wondering how I make it so when you type in a text box, another UI displays how many characters are in that box. I couldn’t find anything helpful anywhere else, thanks guys.
You can use string.len(YourText)
to get the number of characters in your textbox and update a TextLabel to display that value with a RenderStepped function.
I’m not familar with RenderStepped or len. Can you explain what this means please?
RenderStepped
runs every frame, so you can use this to constantly update your TextLabel to match the characters in the TextBox. string.len()
returns the amount of characters in a string.
string.len("Test") -- returns 4
Example code:
game:GetService("RunService").RenderStepped:Connect(function()
YourTextLabel.Text = "Number of characters: " .. string.len(YourTextBox.Text)
end)
1 Like
I think a better one would be TextBox:GetPropertyChangedSignal(“Text”) as it’s just a better idea, and is likely more efficient. But up to you.
3 Likes