How do you keep a sound from repeating with an onTouch function? I want it to play once then stop and go again when stepped on again. But instead the sound repeats a bunch of times while I stand on it. Help?
You can use a debounce to stop it repeating. For making it start/stop when you touch it, use a variable to make the variable true when the sound is playing.
db = false --Debounce variable playing = false --Checks if sound is playing (there's a property in Sound, but it's buggy) script.Parent.Touched:connect(function(hit) --Touched event's function. if db then return end --Stops the code if db is true. db = true --Sets db to true so the code doesn't run multiple times. --Optional check to see if hit is a player's character here. if playing == false then --Play your sound here. playing = true else --Stop your sound here. playing = false end wait(1) db = false --Waits 1 second before allowing someone to touch the brick again. Important, otherwise nobody will be able to touch your brick afterwards. end