Hello, I want to make a brick with ClickDetector that can play the id '2315428899' only if turned on and stop playing when a player turn it off. I'm new at scripting, can someone help me?
Here is the hierarchy I recommend you go with:
Example script:
local sound = script.Parent.Sound local bool = true script.Parent.ClickDetector.MouseClick:Connect(function() if bool == false then sound:Pause() -- Music can be resumed bool = true end if bool == true then if not sound.Played then sound:Play() bool = false elseif sound.Played then sound:Resume() bool = false end end end)
This script plays the sound then checks to see if the sound was played before resuming it. It also pauses it if the debounce is false.
Closed as Not Constructive by DeceptiveCaster and User#24403
This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.
Why was this question closed?