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

my sound script only works in studio but not in the actual game?

Asked by 6 years ago

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)
0
use a localscript and put it into the playergui, with the same code but instead of script.Parent use workspace["Part_Name"] V_ChampionSSR 247 — 6y
0
what do you mean by ["Part_Name"] poopypigeon245 22 — 6y
0
i dont see a playergui either poopypigeon245 22 — 6y

Answer this question