script.Parent.MouseButton1Down:Connect(function()
local music = script.Parent.Parent.Parent.Parent.Parent.PlayerScripts.LocalBackgroundMusic:WaitForChild("BGM")
if music.Volume > 0.7 then
music.Volume = 0
script.Parent.Text = "Unmute Music"
elseif music.Volume < 0.7 then
music.Volume = 0.7
script.Parent.Text = "Mute Music"
end
end)
COMMUNITY QUESTION
I can't get this simple script to work I'm such a noob?
1 answer
If the volume is 0.7, nothing will happen.
script.Parent.MouseButton1Down:Connect(function()
local music = script.Parent.Parent.Parent.Parent.Parent.PlayerScripts.LocalBackgroundMusic:WaitForChild("BGM")
if music.Volume >= 0.7 then
music.Volume = 0
script.Parent.Text = "Unmute Music"
else
music.Volume = 0.7
script.Parent.Text = "Mute Music"
end
end)
This checks whether the volume is bigger than or equal to 0.7, but the original only does stuff when the volume is bigger than 0.7.
This discussion is preserved as it was. New answers, comments, and votes are closed.
