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

Toggle Button Script?

function MouseButton1Down()

script.Parent.Parent.Parent.Music = false --Music is the name of the script that holds the music

end

MouseButton1Down:connect()

i have this script in a button because i want the button to toggle the music in the game on and off. i have no idea what to do from here though! i think something is incomplete. help please.

1 answer

✓ Accepted answer
local Music = script.Parent.Parent.Parent.Music
function onClick()
Music:Play()
end
script.Parent.MouseButton1Down:connect(onClick)

That will make it play...

3 comments

0

ok got it... but how do i disable the music?

0

Use :Stop()

0

@SlickPwner Don't forget, you can also Pause a Sound-type instance 'Sound:Pause()'.

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