-
What do you want to achieve?
Typewriter effect but instead of going every character it goes every word -
What is the issue?
Every function I’ve tried has not been able to support line breaks consecutively or not - What solutions have you tried so far?
- ChatGPT
- Code Assist
- My own knowledge of scripting
- Devforum searching
ChatGPT has given me this base function which I’ve tried to correct both myself and with ChatGPT
function typewriterEffect(label, text, delay)
label.Text = ""
local words = {}
for word in text:gmatch("%S+") do --Problem is here, it does not recognize \n
table.insert(words, word)
end
local function updateLabel()
for i, word in ipairs(words) do
if i > 1 then
label.Text = label.Text .. " " .. word
else
label.Text = word
end
wait(delay or 0)
end
end
spawn(updateLabel)
end