I have a DJ panel, and I want them to play a song when they click the textbutton, but I don't want them to play 2 songs at a time. So I made this script but it doesn't stop the sound from playing if another one already is?
local s = game.Workspace.Part.Sound
local s2 = game.Workspace.Part.Sound2
local b = script.Parent.Parent.Song2.Script
script.Parent.MouseButton1Down:connect(function()
s.SoundId = "rbxassetid://148321914"
s:Play()
if s2.IsPlaying == true then
s:Stop()
print("yes")
end
end)

8 comments
any errors and is it printing yes??
No errors, but it does print yes. It just doesn't stop the sound.
This might be a roblox glitch, because it's been happening a lot recently.
Yes, there have been a lot of glitches, In my game I provide the boombox. And I cant turn the music off once i start it, even if i change the audio.
Alright, then how can I edit this to go around this glitch?
Wait it out
Set the sound's ARCHIVABLE property to false before playing it.
Should line 9 be "s2:Stop()"?