BoolValue not changing

This code is made so that volume can be turned on and off. For some reason however the script is refusing to change the bool from “true” to “false”.

local Sounds = workspace:WaitForChild("Sounds")

local Button = script.Parent
local Music = Button:WaitForChild("Active")

Button.MouseButton1Click:Connect(function()
	
	if Music.Value == false then
		
		Music.Value = true
		Button.Image = 'rbxassetid://15998197117'
		
	end
	
	if Music.Value == true then
		
		Music.Value = false
		Button.Image = 'rbxassetid://15998200046'
		
	end
end)

This is on a local script.

Any help would be greatly appreciated!

It could be because it checks the first “If” statement and toggles it on, then checks the second one and toggles it back off. Use “else” to see if it works.

2 Likes

Thanks for help lol. I’m so dumb. :laughing:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.