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

Not stopping the sound?

Asked by 9 years ago

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)


0
any errors and is it printing yes?? NinjoOnline 1146 — 9y
0
No errors, but it does print yes. It just doesn't stop the sound. UnleashedGamers 257 — 9y
0
This might be a roblox glitch, because it's been happening a lot recently. parkderp1 105 — 9y
0
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. BSIncorporated 640 — 9y
View all comments (4 more)
0
Alright, then how can I edit this to go around this glitch? UnleashedGamers 257 — 9y
0
Wait it out parkderp1 105 — 9y
0
Set the sound's ARCHIVABLE property to false before playing it. Vlatkovski 320 — 9y
0
Should line 9 be "s2:Stop()"? chess123mate 5873 — 9y

1 answer

Log in to vote
-1
Answered by 9 years ago

There may be an error, correct me if I am wrong. I don't think "IsPlaying" is a bool.

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 then
        s:Stop()
        print("yes")
    end
end)

Leave a comment if it didn't work!

0
Didn't stop the song.. UnleashedGamers 257 — 9y
0
@sidekick, according to the ROBLOX Wiki the `IsPlaying` is a boolean, please look up before answering. woodengop 1134 — 9y
Ad

Answer this question