I'm trying to figure how to only make the for i loop for my game start when it's met a condition. Here's my script:
if script.Parent.Parent.Visible == true then for i = 1, #text do script.Parent.Text = string.sub(text, 1, i) wait(0.01) end end
The attempt you made is pretty close already. What you're missing is an event that'll fire each time script.Parent.Parent
changes, so that the script checks it every time.
For that we'll do the following:
script.Parent.Parent.Changed:connect(function() if script.Parent.Parent.Visible == true then -- To make sure that #text is greater than 1, I'd also wrap this inside a condition like this: if #text >= 1 then for i = 1, #text do script.Parent.Text = string.sub(text, 1, i) wait(0.01) end end end end)
Hope that helps. If it doesn't, feel free to ask further questions in the comments to this.