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

Read A Double Click for Music?

Asked by 2 years ago

In my game there is background music where in the settings you can turn it off. The problem is I cant wrap my head around how to make it.

local Player = game.Players.LocalPlayer
local MusicOff = game.ReplicatedStorage.Remotes.MusicOff
local Sound = game.SoundService.BackgroundMusic
local Button = Player.PlayerGui.MainGui.SettingsMenu.MusicButton
local Music = Player:WaitForChild("Music")
local Clicks = 1


Button.MouseButton1Click:Connect(function()
    Music = false

    if Music == true then
        Sound.Volume = 0.4
    end

    if Music == false then
        Sound.Volume = 0
    end
end)

Music is a BoolValue i have on the player when the join the game. When you press the button I want it to turn off the Music but when the music is off and when you press it again it will turn back on and it resets.

Answer this question