Hi! Please excuse the large script. It is mainly space. I need help finding out what is the problem with my script. I have put it prevention measures but that doesn't seem to work. Here is the problem:
Whenever you stop listening to the music, it will still do the wait time and play the next song. Even though the music SHOULD be off. I really need help. Please?
playing = false
local s1 = script.Parent.Parent.song
local s2 = script.Parent.Parent.song2
local s3 = script.Parent.Parent.song3
local s4 = script.Parent.Parent.song4
script.Parent.MouseButton1Down:connect(function()
if playing == false then -- check if audio is playing
playing = true -- allow the script to know if its on or not
script.Parent.Text = "Music: On" -- change the name like you wanted
s1:Stop()
s2:Stop()
s3:Stop()
s4:Stop()
wait(0.5)
s1:Play() -- play all the music
wait(120)
if script.Parent.Text == "Music: Off" then
s1:Stop()
s2:Stop()
s3:Stop()
s4:Stop()
end
s1:Stop()
s2:Stop()
s3:Stop()
s4:Stop()
wait(1)
if script.Parent.Text == "Music: Off" then
s1:Stop()
s2:Stop()
s3:Stop()
s4:Stop()
end
s2:Play()
wait(106.371)
if script.Parent.Text == "Music: Off" then
s1:Stop()
s2:Stop()
s3:Stop()
s4:Stop()
end
s1:Stop()
s2:Stop()
s3:Stop()
s4:Stop()
wait(1)
if script.Parent.Text == "Music: Off" then
s1:Stop()
s2:Stop()
s3:Stop()
s4:Stop()
end
s3:Play()
wait(101)
if script.Parent.Text == "Music: Off" then
s1:Stop()
s2:Stop()
s3:Stop()
s4:Stop()
end
s1:Stop()
s2:Stop()
s3:Stop()
s4:Stop()
wait(1)
if script.Parent.Text == "Music: Off" then
s1:Stop()
s2:Stop()
s3:Stop()
s4:Stop()
end
s4:Play()
wait(76)
if script.Parent.Text == "Music: Off" then
s1:Stop()
s2:Stop()
s3:Stop()
s4:Stop()
end
s4:Stop()
wait(0.1)
script.Parent.Text = "Music: Off"
else -- if audio is playing we want to stop it
playing = false
s1:Stop()
s2:Stop()
s3:Stop()
s4:Stop()
script.Parent.Text = "Music: Off"
end
end)

1 comment
Anyone? I really need help on this. I am confused.