hi, ive made a script which makes a different music play when you walk into a different area, but it only works when im in studio. i put both of the sounds in PlayerGui and tried using a local script instead of a normal script. here is my code if it helps:

script.Parent.Touched:connect(function(hit)
if hit.Parent:FindFirstChild('Humanoid')then
 game.Players[hit.Parent.Name].PlayerGui.Sound1.Volume=1
 game.Players[hit.Parent.Name].PlayerGui.Sound1:Play()
 game.Players[hit.Parent.Name].PlayerGui.Sound2:Stop()	
 end
end)

and this is the code for the 2nd music:

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.Sound1:Stop()	
 end
end)

3 comments

0

use a localscript and put it into the playergui, with the same code but instead of script.Parent use workspace["Part_Name"]

0

what do you mean by ["Part_Name"]

0

i dont see a playergui either