I was looking at alvinblox on youtube and he was explaining how to make music in different sound environments. However, I seen some flaws within the code with playing music.Whenever, I jump it re fires the code again and plays the music again. I just want the music to continue to play WITHOUT RESTARTING until we leave the brick. Thanks in advance.
I've tried:
script.Parent.Touched:connect(function(hit)
if hit.Parent:FindFirstChild('HumanoidRootPart') then
game.Players[hit.Parent.Name].PlayerGui.Sound2:Stop()
game.Players[hit.Parent.Name].PlayerGui.Sound1.Volume = 1
game.Players[hit.Parent.Name].PlayerGui.Sound1:Play()
end
end)
and
Debounce = true
script.Parent.Touched:connect(function(hit)
if hit.Parent:FindFirstChild('HumanoidRootPart') and Debounce then
Debounce = false
game.Players[hit.Parent.Name].PlayerGui.Sound2:Stop()
game.Players[hit.Parent.Name].PlayerGui.Sound1.Volume = 1
game.Players[hit.Parent.Name].PlayerGui.Sound1:Play()
end
end)
and
script.Parent.Touched:connect(function(hit)
if hit.Parent:FindFirstChild('HumanoidRootPart') and game.Players[hit.Parent.Name].PlayerGui.Sound1.IsPlaying == false then
game.Players[hit.Parent.Name].PlayerGui.Sound2:Stop()
game.Players[hit.Parent.Name].PlayerGui.Sound1.Volume = 1
game.Players[hit.Parent.Name].PlayerGui.Sound1:Play()
end
end)
everytime I jump it still RESTARTS the music.
I want the music to continously play in the area until I leave.
