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

How do I make it so sounds don't get cut off when the same sound plays again?

So I have an animation being played on the character, and when a certain keyframe has been reached, it plays a sound. Since there are many key frames that play the same sound, the sound plays repetitively. The problem is that the sound currently playing gets cut off when the sound plays again. If you don't understand what I'm talking about, I'll post two examples.

This is what I want it to sound like: https://instaud.io/13ge

What it really sounds like in game: https://instaud.io/13gf

As you can see, with the second audio the sound gets cut off when the same sound plays again.
Also, here is the script I made just in case:

local player = game.Players.LocalPlayer
local char = player.Character
local animation = script.fight

animation:Clone().Parent = char.Humanoid

wait(1)

local animTrack = char.Humanoid:LoadAnimation(animation)
animTrack:Play()

animTrack.KeyframeReached:connect(function(slash)
	script.slash:Play()
end)

2 comments

0

I believe the problem you are having, is that sounds can only play once at a time. Try copying 'script.slash' and playing that instead

0

I'm confused, what do you mean by copy "script.slash"?

1 answer

✓ Accepted answer
local player = game.Players.LocalPlayer
local char = player.Character
local animation = script.fight

animation:Clone().Parent = char.Humanoid

wait(1)

local animTrack = char.Humanoid:LoadAnimation(animation)
animTrack:Play()

animTrack.KeyframeReached:connect(function(slash)
    local clone = script.slash:Clone()
	clone.Parent = script
	clone:Play() --*
end)

look at the sound instance like a CD player. It can only play one track at a time. So if you want to listen to multiple sounds at once, you need more cd players. the line marker --* was changed to make a copy of the sound and play it instead

3 comments

0

It didn't work. It didn't play the sound, nor did it clone it. It doesn't say any error in the output either... Maybe this is a problem because you didn't do "Clone().Parent ="?

0

Forgot to re-parent the clone.

0

Hey, thanks. You solved my problem, and I wish there was an easier way to do this but this is gotta be it for now. Thanks!

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