local plr = game.Players.LocalPlayer
local soundRegions = workspace:WaitForChild("SoundRegions") soundRegions = soundRegions:GetChildren()
local soundManagment = {}
for _,region in pairs(soundRegions) do
local info = {} local region3 = Region3.new(region.Position-(region.Size/2),region.Position+(region.Size/2)) region.Transparency = .5 info.Region = region3 info.Sound = script.SoundRegions:FindFirstChild(region.name).Sound table.insert(soundManagment,info)
end
game:GetService("RunService").RenderStepped:Connect(function()
for _, soundInfo in pairs(soundManagment) do local region = soundInfo.Region local sound = soundInfo.Sound local parts = workspace:FindPartsInRegion3WithIgnoreList(region,plr.Character:GetDescendants()) if #parts > 0 then if not sound.IsPlaying then sound:Play() end else sound:Stop() end)