I have made a typewriter styled dialogue system, and I have added a feature where the dialogue stops momentarily when it comes across a dot, comma, explanation mark, you get the idea.
However, I want to add a new part in this feature where if there is more than one of a character that pauses the dialogue all back to back, then it only pauses on the last character. How can I do this?
This is a video of the current system.
I have tried no solutions as there is not a single one that I have thought of yet, I’d appreciate any help.
This is my code.
function text(text, ignore, name)
local displayText = text
-- Replace line break tags so grapheme loop will not miss those characters
displayText = displayText:gsub("<br%s*/>", "\n")
displayText:gsub("<[^<>]->", "")
-- Set translated/modified text on parent
main.frame.Text.Text = displayText
main.frame.tName.Text = name
local index = 0
for first, last in utf8.graphemes(displayText) do
index = index + 1
main.frame.Text.MaxVisibleGraphemes = index
local character = string.sub(displayText, index, index)
if configs.skip == true then
game:GetService("RunService").RenderStepped:Wait()
ignore = true
else
wait(configs.dialoguespeed)
end
if table.find(textpauseicons, character) and not ignore then wait(0.5) end
end
if not configs.skip then
if not configs.auto then
repeat game:GetService("RunService").RenderStepped:Wait() until KeyVerify()
else
wait(1)
end
else
game:GetService("RunService").RenderStepped:Wait()
end
end