so i made a script where i put sounds "sound1 - sound6" in the StarterGUI, and in this script, it would play Sound1 and it would stop Sound2 - Sound6 when i enter a block that this code is put in, but it only works in Studio, and i have no idea why it doesn't work in-game... Anyone able to help?
Sound starting script:
script.Parent.Touched:connect(function(hit)
if hit.Parent:FindFirstChild('Humanoid') then
game.Players[hit.Parent.Name].PlayerGui.Sound2:Stop()
game.Players[hit.Parent.Name].PlayerGui.Sound3:Stop()
game.Players[hit.Parent.Name].PlayerGui.Sound4:Stop()
game.Players[hit.Parent.Name].PlayerGui.Sound5:Stop()
game.Players[hit.Parent.Name].PlayerGui.Sound6:Stop()
game.Players[hit.Parent.Name].PlayerGui.Sound1.Volume = 1
game.Players[hit.Parent.Name].PlayerGui.Sound1:Play()
end
end)
Sound ending script (when leaving the block):
script.Parent.TouchEnded:connect(function(hit)
if hit.Parent:FindFirstChild('Humanoid') then
game.Players[hit.Parent.Name].PlayerGui.Sound1.Volume = 0
end
end)