local brick = script.Parent
local sound = script.Parent.Sound
debounce = false
brick.Touched:connect(function(hit)
player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player and not debounce then
debounce = true
play = sound:Clone()
play.Parent = player.PlayerGui
play:Play()
wait(5)
debounce = false
end
end)
Right now this script doesn't work properly. After touching another brick with the same script, the music from both bricks plays at the same time.
Changing this:
if player and not debounce then
into this:
if player and not debounce and player.PlayerGui.sound.Playing == false then
did not work.
This is how it should work:
After touching the brick, music plays.
After touching another brick that causes the same song to play, nothing happens.
After touching a brick that causes another song to play, the first song stops and the second song starts.

2 comments
so brick1 is touched, music plays, brick2 is touched music is played, but nothing happens to music, and brick3 touched so all music starts and second one starts right?
Brick1 makes music1 play. Brick2 also makes music1 play, so nothing changes. Brick3 makes music2 play and stops all other music from playing