hello developers I hope you are well for days I have a sound error
** Which is what I want ?**
I want that when a player touches a zone a music sounds but when he touches another zone another music sounds
what is the problem ?
zone 1 has background music zone 2 has multiple music but when i play zone 1 it sounds good but if i play zone 2 the sound of zone 1 sounds but after a few seconds zone 1 sounds
zone 1 script:
local zonas = game.Workspace.zona1
local zo = game.Workspace.zonadisc
local sonido = game.StarterPlayer.StarterPlayerScripts.Sound
zonas.Touched:Connect(function()
while sonido.SoundId ~= "rbxassetid://11712998144" do
wait(1)
sonido.SoundId = "rbxassetid://11712998144"
sonido:Play()
zonas.Parent = game.StarterPlayer.StarterPlayerScripts.zonascrip1
zo.Parent = game.Workspace
while sonido.SoundId == "rbxassetid://11712998144" do
wait(58)
sonido.SoundId = "rbxassetid://11712998144"
sonido:Play()
end
end
zone 2 script:
local zo = game.Workspace.zonadisc
local zona = game.Workspace.zona1
local sonido = game.StarterPlayer.StarterPlayerScripts.Sound
zo.Touched:Connect(function()
if sonido.SoundId ~= "rbxassetid://11673884182" then
sonido.SoundId = "rbxassetid://11673884182"
sonido:Play()
while sonido.SoundId == "rbxassetid://11673884182" do
wait(1)
zo.Parent = game.StarterPlayer.StarterPlayerScripts.zonascrip2
zona.Parent = game.Workspace
wait(189)
while sonido.SoundId == "rbxassetid://11673884182" do
wait(1)
zo.Parent = game.Workspace
sonido.SoundId = "rbxassetid://11673808907"
sonido:Play()
zo.Parent = game.StarterPlayer.StarterPlayerScripts.zonascrip2
wait(213)
while sonido.SoundId == "rbxassetid://11673808907" do
wait(1)
zo.Parent = game.Workspace
sonido.SoundId = "rbxassetid://11666235052"
sonido:Play()
zo.Parent = game.StarterPlayer.StarterPlayerScripts.zonascrip2
wait(188)
while sonido.SoundId == "rbxassetid://11666235052" do
wait(1)
zo.Parent = game.Workspace
sonido.SoundId = "rbxassetid://11662744247"
sonido:Play()
zo.Parent = game.StarterPlayer.StarterPlayerScripts.zonascrip2
wait(208)
while sonido.SoundId == "rbxassetid://11662744247" do
wait(1)
zo.Parent = game.Workspace
sonido.SoundId = "rbxassetid://11663155482"
sonido:Play()
zo.Parent = game.StarterPlayer.StarterPlayerScripts.zonascrip2
wait(149)
while sonido.SoundId == "rbxassetid://11663155482" do
wait(1)
zo.Parent = game.Workspace
sonido.SoundId = "rbxassetid://11666357304"
sonido:Play()
zo.Parent = game.StarterPlayer.StarterPlayerScripts.zonascrip2
wait(325)
while sonido.SoundId == "rbxassetid://11666357304" do
wait(1)
zo.Parent = game.Workspace
sonido.SoundId = "rbxassetid://11663387521"
sonido:Play()
zo.Parent = game.StarterPlayer.StarterPlayerScripts.zonascrip2
wait(190)
zo.Parent = game.Workspace
sonido.SoundId = "rbxassetid://11673884182"
sonido:Play()
end
end
end
end
end
end
end
end
end)
if you have any questions please ask me i need your help THANKS…