Hi folks, I know I've already asked about 100 questions (Kidding, but it feels like it) but as a novice I still pick up new things and new errors along the way. Cutting to the chase, I have this code for my game in which I would like people to have the option to turn music on or off in game, but when I click the button it doesn't want to work. Please take a look at what I've tried.
script.Parent.MouseButton1Down:Connect(function() IsOn = true if IsOn == true then for i,v in pairs (script.Parent.Parent.TextButton:GetChildren())do if (v.ClassName == "Sound") then v.Volume = 1 script.Parent.Image = "rbxassetid://205571713" elseif IsOn == not false then IsOn = false end end end script.Parent.MouseButton1Down:Connect(function() IsOn = false if IsOn == false then for i,v in pairs (script.Parent.Parent.TextButton:GetChildren())do if (v.ClassName == "Sound") then v.Volume = 0 script.Parent.Image = "rbxassetid://205571728" elseif IsOn == not true then IsOn = true end end end end) end)
Any help would be very much appreciated, thank you all so kindly for your time and effort. I hope to hear from you soon!