How can i make a sound that can be activated and deactivated when a gui button is clicked

I did an oopsie. Sorry:

local bop = false
script.Parent.MouseButton1Down:connect(function()
if bop == false then
script.Parent.bip.PlaybackSpeed = 1
bop = true
else
script.Parent.bip.PlaybackSpeed = 0
bop = false
end
end)

Well the sound isnt playing when i click it

i AM using a local script but i still have a problem

no signs of errors in output so idk

Well, judging by the script you probably used, you were setting the sound’s speed instead of using something like script.Sound:Play() or sound.Playing = true

What i am aiming at is a gui script that plays a sound when its clicked (looped) and stops the sound when its clicked again

I have done what you have asked and I tested it out for myself. It works!

local bop = false
local long = 0
script.Parent.MouseButton1Down:connect(function()
if bop == false then
script.Parent.bip.TimePosition = long
script.Parent.bip:Play()
bop = true
else
long = script.Parent.bip.TimePosition
script.Parent.bip:Stop()
bop = false
end
end)

It worked Thank you very much, but what about reseting the time position when its stopped

1 Like

just set long to 0 whenever you want.

long = 0

Well again , it worked
thank you very much

1 Like

wait ive tested it and only i can hear it,
i want it that other players can hear it to
is it possible to do that?

1 Like

Yes it is. Although you need to use RemoteEvents which I can’t really use. I recommend you just look up a tutorial on those. Others say its easy so maybe you will get it too? (Also could you mark my previous comment as “Solution”? Sorry for this oddly placed comment.)

Welp i tried doing something but it dnint work out but still thanks

1 Like