So i want to do a code that when its left clicked it would mute the music and when right clicked it would unmute music, and the button would be a GUI screen button.
function leftClick() game.SoundService.vibing.Playing = false function rightClick() game.SoundService.vibing.Playing = true end script.Parent.MouseButton1Click:Connect(leftClick) script.Parent.MouseButton2Click:Connect(rightClick)
You aren't really muting it though you are just trying to stop it on left click and play it on right click but doing it the wrong way. Also your functions need to be local.
local function leftClick() game.SoundService.vibing.Volume = 0 -- Mutes the Volume end local function rightClick() game.SoundService.vibing.Volume = 0.5 -- Mess with the number if you want end script.Parent.MouseButton1Click:Connect(leftClick) script.Parent.MouseButton2Click:Connect(rightClick)
What this script is it actually mutes the volume instead of stopping or playing it.
You need to use .activated not .Mouseclicked
function leftClick() game.SoundService.vibing.Playing = false function rightClick() game.SoundService.vibing.Playing = true end script.Parent.Activated:Connect(leftClick) script.Parent.Activated:Connect(rightClick)
(idk if this is right but its usually what i do)