Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 2 years ago
Edited 2 years ago

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

Log in to vote
0
Answered by 2 years ago

MMM Try

music1212:stop()

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

0
this is an server script kekemama645 0 — 2y
0
im sorry but this does not work kekemama645 0 — 2y
0
This might be worth a try. Try using only one music id and use this () instead of this{} theking66hayday 841 — 2y
0
still wont work kekemama645 0 — 2y
View all comments (7 more)
0
ok theking66hayday 841 — 2y
0
mmmmmmmmmm theking66hayday 841 — 2y
0
any errors?? in output theking66hayday 841 — 2y
0
assigning 10 values to 1 variable leaves some values unused but in output it says Expected ')' (to close '(' at column 19), got ',' kekemama645 0 — 2y
0
Maybe the issue is that you can't put that many sound id's in a script theking66hayday 841 — 2y
0
Try using only 1 sound id in the script. And let me then know the error code is theking66hayday 841 — 2y
0
theres no errors but the background music wont be removed either kekemama645 0 — 2y
Ad
Log in to vote
0
Answered by 2 years ago

you use sound.IsPlaying, like this:

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

0
this does not work im afraid. kekemama645 0 — 2y
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. SharkRayMaster 265 — 2y
0
still no affect kekemama645 0 — 2y

Answer this question