Managing sound on roblox

What is the most efficient way of managing sound for a punch when a person gets hit? (Many different sounds for variety)

– Instancing a new sound each time they get hit then setting the ID of that sound
– Cloning the sound, parenting and playing it
– Having one main sound controller setting the ids each time they get hit then playing

1 Like

The best way, as long as you don’t need audio to overlap, would probably to just have one “Sound”, inside the players torso or head. Then swap the SoundId out right before you :Play() it. Just make sure to use :PreloadAsync() on all of your IDs at the start of your script, so that you do not have any load time delay.

What if I do need to have them overlap?

If you need them to overlap with each other, your only option is to use multiple Sound objects. A single sound can not play two pieces of audio at once. Just create two different Sounds, and alternate :Play()ing between them. This way you can have more than one playing on top of each other at one time.

You can still use the method above, with the only exception being you have two Sounds instead of one.

1 Like