Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can I fix this script so it allows me to toggle sound effects on/off?

Asked by 3 years ago

Yes, I am aware the scripting sucks.

Basically, as the title suggests, I'd need the sounds to have Reverb and Equalizer toggled on or off at the users request. I haven't got any error messages that indicate I've done it wrong. Completely puzzled as I can't find any videos online that help.

local button = script.Parent
local label = script.Parent.Parent.EnabledOrDisabled

local function toggle()
    if game.SoundService.CoreSound.EqualizerSoundEffect.Enabled == true and game.SoundService.CoreSound.ReverbSoundEffect.Enabled == true then
        game.SoundService.CoreSound.EqualizerSoundEffect.Enabled = false and game.SoundService.CoreSound.ReverbSoundEffect.Enabled == false
    else
        if game.SoundService.CoreSound.EqualizerSoundEffect.Enabled == false and game.SoundService.CoreSound.ReverbSoundEffect.Enabled == false then
            game.SoundService.CoreSound.EqualizerSoundEffect.Enabled = true and game.SoundService.CoreSound.ReverbSoundEffect.Enabled == true
        end
    end
end

button.MouseButton1Click:Connect(function()
    toggle()
end)

Answer this question