I just learned how too make sound play when the player touches a brick, but when the player enters a different room how do i make the first sound stop, and another sound play when they touch a different brick?
COMMUNITY QUESTION
How do i make sound stop when a new sound plays?
1 answer
The Stop() method is what you would use to stop the sound.
Here's a wiki page
You would use it in the same way that you used the Play() method:
local Sound = workspace.ExampleSound
Sound:Stop()
EDIT
To have it so that it stops the sounds when you touch a button, use the Touched event on your button part:
local Part = workspace.Part
local Sound = workspace.ExampleSound
Part.Touched:connect(function(ThingThatTouched) --Will run when "Part" is touched
if (ThingThatTouched.Parent:FindFirstChild("Humanoid")) then --If it is a player/NPC
Sound:Stop()
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

5 comments
But i need to make it so that when you touch a brick, the sound stops
@AsrielDreams Editted
local sound = Instance.new("Sound", Workspace) sound.Pitch = 1 -- Speed of the song (Preffer not to change it) sound.SoundId = "rbxassetid://321702143" -- Put the last numerbs of the link of the song(ROBLOX) that you want sound.Volume = .5 -- Volume(How much power) of the song sound.Looped = true -- If you want the song to repeat after the song is don script.Parent.Touched:connect(function()
Didint work, if it helps that was the sound script i put into the brick
Remember that it isn't our job to do it all for you. We will help you along, but it's up to you to write the code.