I was wondering if you guys could help me on making a part play or stop its music when a player clicks it. Similar to when you click the potato in Bus Stop Simulator. Btw I added a clicking sound when you click the part.
local clickdetector = script.Parent:WaitForChild("ClickDetector")
clickdetector.MouseClick:Connect(function()
game.Workspace.BOOM.Sound:Stop()
game.StarterPlayer.Humanoid.Sound:Stop()
local clickdetector = script.Parent:WaitForChild("ClickDetector")
end)
wait(1)
clickdetector.MouseClick:Connect(function()
game.Workspace.BOOM.Sound:Stop()
game.StarterPlayer.Humanoid.Sound:Play()
end)
This is all I can come up with, sadly. Please tell me what I'm doing wrong, It would really help! And yes the part which music is coming off from it is called 'BOOM'.

3 comments
Thank you so much this helped a lot!
You could just do workspace:WaitForChild('BOOM'):WaitForChild('Sound').Playing = not workspace.BOOM.Sound.Playing
That is not the correct way to play a sound ^