Problem with typewriter effect

function module.typeWrite(object, text, length, sound)
	object:GetPropertyChangedSignal("Text"):Connect(function()
		sound:Play()
	end)
	for i = 1, #text, 1 do
		object.Text = string.sub(text,1,i)
		wait(length)
	end
end

Thank you, the sound works perfectly now! However, it is a bit slower now. How could I make it faster without breaking it?

try using this script with the length 0.02 to see if it works

some changes in the script:

function module.typeWrite(object, text, length, sound)
    local connection
	connection = object:GetPropertyChangedSignal("Text"):Connect(function()
		sound:Play()
	end)
	for i = 1, #text do
		object.Text = string.sub(text,1,i)
		wait(length)
	end
    connection:Disconnect()
end

So the solution was to make the wait time as long as the sound. That is .05
I said “Seems work fine with a wait as long as the sound … try switching .02 to .05 or .06”

the problem as the audio of the writesound as playing more fast than the text showing (idk why this was happening to him), i tested in my game with 0.02 and it worked fine

Because you had it waiting .02 and the sound length was .05 … that’s why I suggested using .05

"TypewriterModule.typeWrite(object, "Yo! “, writeSound.TimeLength, writeSound)”

writeSound.TimeLength is the same as saying .05 that’s how long the sound is.

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