Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do i make sound stop when a new sound plays?

Asked by 8 years ago

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?

1 answer

Log in to vote
1
Answered by 8 years ago

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)
0
But i need to make it so that when you touch a brick, the sound stops AsrielDreams 0 — 8y
0
@AsrielDreams Editted darkelementallord 686 — 8y
0
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() AsrielDreams 0 — 8y
0
Didint work, if it helps that was the sound script i put into the brick AsrielDreams 0 — 8y
0
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. darkelementallord 686 — 8y
Ad

Answer this question