%p+ Not working correctly

The typewriter effect is supposed to pause for 1 second once there is puncuation. But its pausing every letter
image

local function typeWrite(text, label)
	label.Text = ""

	for i, v in text:split("") do
		label.Text = label.Text .. v
		if string.gmatch(string.sub(label.Text,1,i),"%p+") then
			warn("Puncuation", label.Text)
				wait(1)
			else
				
			task.wait(0.01)
				
		end
		script.DialogueSound:Play()
		end
	end

I would avoid using string.gmatch and do it as follows:

if string.match(string.sub(label.Text, i, i), "%p") then
   task.wait(1)
end;
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.