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

Toggle Button Script?

Asked by 10 years ago

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

Log in to vote
0
Answered by
Spooce 78
10 years ago
local Music = script.Parent.Parent.Parent.Music
function onClick()
Music:Play()
end
script.Parent.MouseButton1Down:connect(onClick)

That will make it play...

0
ok got it... but how do i disable the music? FastSnail5 8 — 10y
0
Use :Stop() SlickPwner 534 — 10y
0
@SlickPwner Don't forget, you can also Pause a Sound-type instance 'Sound:Pause()'. TheeDeathCaster 2368 — 10y
Ad

Answer this question