I'm trying to make a working stereo that cycles through a number of sounds when clicking on it. I've figured out how to make it play a sound once it's clicked but I can't figure out how to make it play a different sound when its clicked again.
This is what I have so far:
Stereo = script.Parent Sound = Stereo.Sound function onClicked() Sound:Play() end script.Parent.ClickDetector.MouseClick:connect(onClicked)
This should work. Please accept as answer. Tell me if you have any problems, I'm also sending you a friends req on roblox.
Stereo = script.Parent Sound1 = Stereo.Sound1 local soundNum = 0 function onClicked() local currenSound = game.workspace.Stereo if soundNum < 3 then ----- Change the number to your last sound soundNum = soundNum + 1 else soundNum = 1 end local selectedSound = currenSound["Sound" .. soundNum] selectedSound:Play() print(soundNum) end script.Parent.ClickDetector.MouseClick:connect(onClicked)