I have a sound region script that detects if you are inside a parts region.
If you leave the area the music stops, if you walk into another parts region it starts another. and if the 2 parts overlap at any point, and you stand in the overlap, both audio plays at the same time. But if you have 2 parts of the same name, for 1 single audio, that audio doesnt play.
local SoundService = game:WaitForChild("SoundService")
local SoundRegionsWorkspace = game.Workspace:WaitForChild("SoundRegion")
local found = false
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
if part:FindFirstAncestor(game.Players.LocalPlayer.Name)then
found = true
break
else
found = false
end
end
if found == true then
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
I believe that whats happening is if your standing in 1 of the parts and not the other, its seeing it as true and false at the same time. and it starts and ends it at the same time. there is no error in the output, i've worked on it for 2 days and im still unsure how to structure it correctly so it can play the music if there are 2 parts of the same name
