Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

My ScreenGUI Button wont work?

So, I made a button that mutes in-game music if clicked...well...it's supposed to, anyways. The BUTTON works, but the function doesn't. I have a feeling I need to remake the script that mutes music. Any tips? Thanks!

Here's the script.

local Gui = script.Parent
local Player = script.Parent.Parent.Parent
local button = script.Parent.MouseButton1Clicked
local Char = Player.Character

Gui.ButtonMouse1Clicked:connect(button)
function button ()
ToggleMute ()

end

ToggleMute = Gui.MouseButton1Clicked:connect()

1 comment

1

Please provide your script so we can address your issues and help you fix it. Not make an entirely new script for you.

1 answer

✓ Accepted answer
p = game.Players.LocalPlayer
sound = p.Backpack:WaitForChild("LobbyMusic")



script.Parent.MouseButton1Click:connect(function()
	if sound.Volume == 1 then
	sound.Volume = 0
	else
	sound.Volume = 1
	end
end)

Here is a extremely simple script I made awhile ago. Add the music to the StarterPack and change the name on line 2 where it says "LobbyMusic" to whatever the name of the sound is called.

Replace this script with your current. Make sure you are using a localscript

1 comment

0

Thank you, very much!

This discussion is preserved as it was. New answers, comments, and votes are closed.