I have it so when the player first starts the game they are given a soundtrack, but I'd like it that when they'd enter a certain area and touch an invisible block it would change the music. How would I go about this?
COMMUNITY QUESTION
How to make a soundtrack play when a player steps on a block?
1 answer
I'm assuming the sound is in their PlayerGui to make it so they can hear it only.
script.Parent.Touched:connect(function(hit)
if hit.Parent and game.Players:GetPlayerFromCharacter(hit.Parent) then
p = game.Players:GetPlayerFromCharacter(hit.Parent)
game.Workspace.SoundYouWantToStop:Stop()
game.Workspace.SoundYouWantToPlay:Play()
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Since it is a one player server I've put it in the workspace, how would I do it if the sound was in workspace?
It's the same thing. For lines 4 and 5, redefine the paths. I'll do it.