local textPath = script.Parent local text = "" local textlen = string.len(text) for i = 1, textlen do textPath.Text = (string.sub(text, 1, i)) script.Parent.Sound:Play() wait(0.04) end
I'm making a GUI that has a character 'speak' text, but I want the character to say the multiple sets of text in a single function without needing a messy script.
Basically, I want my local text variable to have a table containing different texts and manipulating said table to say certain phrases.
In this case, it's just going to be something like this:
local text = { "T"; "E"; "S"; "T"; }
I need this manipulative variable to be intertwined into my current script, but I don't know how to. Also, if a kind gentleman/lady would tell me how to order how the text is "played-through", I would be greatful.
Ultimately, I'm asking for somebody to modify my script to the way I like it, I apologize if this sounds like a request; I have no real idea on how to do this.
function phrase1() local phrase = ("Hello.") end function phrase2() local phrase = ("How are you?") end local phrase = phrase1() --starts with phrase1 for i=1,string.len(phrase)do wait(0.1) p.Text = string.sub(word,1,i) end phrase2() --convert to phrase two for i=1,string.len(phrase)do wait(0.1) p.Text = string.sub(word,1,i) end --rinse and repeat
function chat1() local word = ("Hello.") for i=1,string.len(word)do wait(0.1) p.Text = string.sub(word,1,i) end end
The above script will take whatever your local word is, and then spell it out one letter at a time. Hope that's what you wanted.