hi, im trying to make sound environment scripts for my game but they only seem to work in studio mode and not in the actual game and when i jump the song repeats (i was using R6.) i used a localscript and placed them all in the StarterGui. i also put both of the sounds in the StarterGui. here is the code i got from a youtube tutorial:
script.Parent.Touched:connect(function(hit)
if hit.Parent:FindFirstChild('Humanoid')then
game.Players[hit.Parent.Name].PlayerGui.Sound2.Volume=1
game.Players[hit.Parent.Name].PlayerGui.Sound2:Play()
game.Players[hit.Parent.Name].PlayerGui.castlemusic:Stop()
end
end)
that script was to have Sound2 play when you walk into the house and for the castlemusic to stop. thanks in advance. from poopypigeon245

2 comments
also i have filteringenable on
Use a RemoteEvent to play the sounds on the Client? I am not 100% positive that playing the sound from the server would result in a problem. But this is a good start.