Broken sound regions?

I was making a sound region for each of my maps on my game. The sound region WAS playing until after I died, it stopped out of the blue. Here is a YouTube video of it:

The script is fully functioning, no errors. I have no clue what even caused this to happen in the first place.

Edit: The screen recording was bad. After the music stopped playing, it teleported me back to the same map and no music was playing.

We can’t help you without a code.

local SoundsInRegion = game.Workspace:WaitForChild("SoundsRegions")

local Found = false

while wait(1)do
	
	for i,v in pairs(SoundsInRegion:GetChildren())do
		
		Found = false
		local region = Region3.new(v.Position - (v.Size/2), v.Position + (v.Size/2))
		
		local parts = game.Workspace:FindPartsInRegion3WithWhiteList(region, game.Players.LocalPlayer.Character:GetDescendants())
		
		for _, part in pairs(parts)do
			
			if part:FindFirstAncestor(game.Players.LocalPlayer.Name) then
				
				print("Player was Found")
				Found = true
				break
				
			else
				
				Found = false
				print("Player was not Found in region")
				
			end
			
		end
		
		if Found == true then
			
			if script.Parent.Sounds[v.Name].IsPlaying == false then
				
				script.Parent.Sounds[v.Name]:Play()
				break
			end
		else
			
			script.Parent.Sounds[v.Name]:Stop()
			
		end
		
	end
	
end

Is it locally handled? If so, is the local script in StarterGui? If it is, make sure its in a ScreenGui with the ResetOnSpawn disabled.

Put it on StarterPlayerScripts, and try it again.

That didn’t work either. I believe that it needs to be handled with the startergui. The startergui is the main parent of the regions.

what is resetonspawn? And it is part of the screengui parent, so that is in the way of the broken regions.

If its in StarterGui, the script will be deleted, then re-made on player death. To prevent this, you can put it inside a StarterGui and turn ResetOnSpawn to false. Its a property of a ScreenGui.

the soundregions do work sometimes but not all the time.

Here is one thing:

found this in the console. As you can see the script i put above when replying to @varjoy is the script that I was using. I don’t spy anything about “position is not a valid member of weld”.

It could be that when you use the break it actually cancels the entire loop. Maybe change your system up a bit where it doesn’t need to use that break.