So, I’ve just came across this (as I’ve only now needed to use it) but whenever I play an audio inside of my typewrite for loop the audio keeps playing even after the text has finished being displayed?
Any help would be greatly appreciated, (i know I don’t need the time positions I was just testing out ways to fix this.)
local function typewrite(object,text,length)
object.MaxVisibleGraphemes = 0
for i = 1,#text,1 do
script.Parent.Parent.Audio.TimePosition = 0
script.Parent.Parent.Audio:Play()
object.Text = text
object.MaxVisibleGraphemes = i
task.wait(length)
end
script.Parent.Parent.Audio.TimePosition = 0
script.Parent.Parent.Audio:Stop()
end
local function typewrite(object, text, length)
object.MaxVisibleGraphemes = 0
object.Text = text
if script.Parent.Parent.Audio.Looped then
script.Parent.Parent.Audio.Looped = false
end
for i = 1, #text, 1 do
object.MaxVisibleGraphemes = i
script.Parent.Parent.Audio.TimePosition = 0
script.Parent.Parent.Audio:Play()
task.wait(length)
script.Parent.Parent.Audio:Stop()
end
if script.Parent.Parent.Audio.IsPlaying then
script.Parent.Parent.Audio:Stop()
end
script.Parent.Parent.Audio.TimePosition = 0
end
Did u put the print statement after or 1 line above when u stop the audio?
If it printed multiple times then you are firing multiple functions and that maybe the problem