Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

how to make an audio overlap itself?

not necessarily 100% related to scripting, however, i was making an rpg-like textbox that had text grunts play as each word scrolled on the screen. it sounds choppy when you play the singular sound over and over, so, is there a way to make it play over itself?

i've been told that i could make a new instance for it, but, would that need to be parented?

this is 100% client-side, if that's important.

local function textscroll(dialogue, voice)
	if indialogue == false then
		indialogue = true
		dialoguebox.Visible = true
		for i = 1, #dialogue do
			local letter = string.sub(dialogue, i, i)
			local nextletter = string.sub(dialogue, i + 1, i + 1)
			dialoguetxt.Text = string.sub(dialogue, 1, i)
			dialoguevoice:Play() --here's the sound that is being played. its choppy when it does play
			wait()
			if (letter == "," or letter == "." or letter == "!" or letter == "?") and nextletter ~= letter then
				wait(0.2)
			end
		end
	end
end

1 answer

✓ Accepted answer

I stumbled upon a post on Twitter a while ago, and it was a hacky method to do just this. It involved enabling the PlayOnRemove property and constantly setting the Sound's parent to nil, and back to its original parent again whenever you wanted it to play.

It would essentially allow the sounds to stack on top of each other, which was really nice.

1 comment

0

thank you! this is very helpful!

This discussion is preserved as it was. New answers, comments, and votes are closed.