✓ Accepted answer
##Problem
Your script is not retyping the string because nr will get to be larger than the string's length. This is because you never reset the value of nr to 0. Since everything past the written string is a empty value, the script does not add anything to the TextLabel. Your code is also inefficient as there are variables you don't necessarily need.
##Solution
You can get rid of the nr variable entirely as well as the length and str variable.
With the revised script, I kept the variables TxtBox and textString. After defining those I set up a function to be connected to later on in the script. With the function I made a for loop that utilized the string's length function directly. I then took the TextLabel and set its Text property to the sub of the string from 1 to i. What i is in a numeric for loop is basically a variable. The for loop will make i count up until it reaches the end, which in this case would be the string's text length. Within the loop I put the wait function with .075 in the parenthesis. Finally the script should end with the connection line to the function.
##Final Script
txtBox = script.Parent.Parent.TextLabel
textString = "You chose: Food, what would you like to eat or drink?"
function Clicked()
for i=1, textString:len() do
txtBox.Text = textString:sub(1,i)
wait(.075)
end
end
script.Parent.MouseButton1Click:connect(Clicked)
######Hopefully this answered your question, if it did hit the Accept Answer button to the left. If you have any questions, feel free to leave them in the comments below.
2 comments
Alright, so what is the problem? Also, your question title should be a one sentence summary of what the problem is.
Well, It litterly does nothing. Nothing in the logs too :/