_G.isInMenu = true
local music1 = game.Workspace.menuScript.Folder.music1
local music2 = game.Workspace.menuScript.Folder.music2
local music3 = game.Workspace.menuScript.Folder.music3
music1.Looped = true
music2.Looped = true
music3.Looped = true
local I = false
if _G.isInMenu == true then
I = true
music1:Play()
while true do
if I == false then
music1:Stop()
if _G.isInMenu == false then
I = false
end
break
end
wait(0.2)
end
end
local button = script.Parent
button.MouseButton1Click:Connect(function()
_G.isInMenu = false
end)
The second script is under a button in a ScreenGui. It's structured correctly. The first script is a normal script, it is structured correctly. What happens is that whenever I press the button it just keeps on playing the menu music and doesn't stop. I have no clue what is going on. There aren't any errors either. Thanks in advance!
