Help me make an Telephone that when you click it starts a sound, and when you click it again, it stops the sound

Im trying to make a telephone but when i try making the audio turn off it don’t happen

1 Like

scrip please, can’t expect all people to create a script for you.

That’s the script to play but i dont know how to make it stop

Sound = script.Parent.Sound
Clicker = script.Parent.ClickDetector

function onclick(mouse)
Sound:Play()
end

2 Likes
local Sound = script.Parent.Sound
local Clicker = script.Parent.ClickDetector

local Debounce = true

Clicker.MouseClick:Connect(function()
 if Debounce then
     Debounce = false
     Sound:Play()
 else 
     Debounce = true
     Sound:Stop()
 end
end)
1 Like

I put this in wich script? Or if it is in both, wich part do i put both of them

Normal script, try it out and see if it working.

1 Like
local part = script.Parent
local sound = part.Sound
local click = part.ClickDetector

local toggle = false

local function onClick(player)
	toggle = not toggle
	if toggle then
		sound:Play()
	else
		sound:Stop()
	end
end

click.MouseClick:Connect(onClick)

Replace your script with this one, the button will then act as a toggle for the sound.

No way man! Thank you so much for the help!