Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

My SoundRegions are not playing music can i get some help please?

So i am working on a game with my friend where each area plays different music like the very 1st version of his game, and i don't know how but the sound regions are not playing the music we tried different scripts but i never worked so if i could have some help that would be nice! Its a local script and it still isn't working BTW

local SoundRegionsWorkspace = game.Workspace:WaitForChild("SoundRegions")

local Found = true

while wait(1)do
	
	for i, v in pairs(SoundRegionsWorkspace: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
			-- Loop thingie
			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
			-- Start playing music
			if script.Parent.SoundRegions[v.Name].IsPlaying == false then
				script.Parent.SoundRegions[v.Name]:Play()
				break
			end
		else
			script.Parent.SoundRegions[v.Name]:Stop()
		end
	end
end

1 answer

This discussion is preserved as it was. New answers, comments, and votes are closed.