I have a sound regions music style, and I'm trying to use a mute button in the bottom right of the screen to mute the music if you want to.
local hubmusic = game.StarterGui.SoundRegions.hubmusic local off = false script.Parent.MouseButton1Click:Connect(function() print("music function connected") if off == false then off = true hubmusic.Volume = ("0") print(hubmusic.Volume) elseif off == true then off = false hubmusic.Volume = ("0.5") print(hubmusic.Volume) end end)
What's weird is that it successfully changes the volume of the music because it tell it to print its value, but in the game, the volume was not changed at all.
the volume,u are making it as a string,instead change it to a number this is the script in case u dont understand what am i saying:
local hubmusic = game.StarterGui.SoundRegions.hubmusic local off = false script.Parent.MouseButton1Click:Connect(function() print("music function connected") if off == false then off = true hubmusic.Volume = 0 print(hubmusic.Volume) elseif off == true then off = false hubmusic.Volume = 0.5 print(hubmusic.Volume) end end)