script.Parent.MouseButton1Click:connect(function() game.Workspace.Music.IntoTheForest.Volume = 0 if game.Workspace.Music.IntoTheForest.Volume>.1 then game.Workspace.Music.IntoTheForest.Volume = 1 end end)
So this is my script. I'm trying to make a button that will turn my song (IntoTheForest) on and off. I probably did something very wrong because I am a beginner and was experimenting with the use of if and then. It didn't work, and no errors appeared in the Output. What did I do wrong? Also, turning it off works, but it can't be turned back on. I need assistance with that part of the script.
This script is just going to set the volume to 0 and then run the if staement which will never trigger because the volume will always be 0
Try:
script.Parent.MouseButton1Click:Connect(function() if workspace.Music.IntoTheForest.Volume >.1 then workspace.Music.IntoTheForest.Volume = 0 else workspace.Music.IntoTheForest.Volume = 1 end end)
Hope I didn't spell anything wrong I'm on my phone rn
Basically what this does, when the button is clicked it will check to see if the volume is greater than .1 (if it is playing) then it will set it to 0. And if it is less than .1 (if it isn't playing) then it will set it to 1