So I'll give some context to the situation. I'm coding a combat system, and my goal is to play a random attack sound when you swing your sword. I want to be organized so I put said attack sounds inside a SoundGroup in SoundService.
I've been trying to play a random sound from that SoundGroup everytime you attack, but I can't quite figure out how to do it.
I'll paste what I've tried below:
-- variables
sounds = game:GetService("SoundService")
slashservice = sounds:WaitForChild("Slashes") -- name of the SoundGroup
slashes = slashservice[math.random(1,#slashservice:GetChildren())]
-- actual code to play the slashes (i didn't include my click function because it'd take up space.)
slashes:Play()
Any help is appreciated, feel free to ask questions!