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

How do I make sound stop playing if another sound is playing?

Hello again scripthelpers, I need help with a script. I want the script to stop playing the sound if another sound is playing. Below is the script.

local bossmusic = {"rbxassetid://10807342692", "rbxassetid://10190830363", "rbxassetid://10807390747", "rbxassetid://10807415968", "rbxassetid://10807433758", "rbxassetid://10807466976", "rbxassetid://10807487309", "rbxassetid://10807521947", "rbxassetid://10807581238", "rbxassetid://10807613596"}
if bossmusic == bossmusic.Playing or bossmusic:Playing() then
	music1212:Destroy()
end

music1212 is the background music, the music i wanna get rid of if bossmusic is playing. bossmusic is music for the bosses. if bossmusic is playing then the background music should be removed.

2 answers

MMM Try

music1212:stop()

See if that works, also what type of script are you using??

11 comments

0

this is an server script

0

im sorry but this does not work

0

This might be worth a try. Try using only one music id and use this () instead of this{}

0

still wont work

0

ok

0

mmmmmmmmmm

0

any errors?? in output

0

assigning 10 values to 1 variable leaves some values unused but in output it says Expected ')' (to close '(' at column 19), got ','

0

Maybe the issue is that you can't put that many sound id's in a script

0

Try using only 1 sound id in the script. And let me then know the error code is

0

theres no errors but the background music wont be removed either

you use sound.IsPlaying, like this:

if bossmusic.IsPlaying == true then
    music1212:Stop()
end

3 comments

0

this does not work im afraid.

0

That's how you do it tho, so you must be doing something wrong, maybe try adding the boss music as a sound object.

0

still no affect

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