What do you want to achieve? Keep it simple and clear!
Im currently trying to find a way so when you are inside of an area it will have a different reverb rather than being outside.
What is the issue? Include screenshots / videos if possible!
I realized that using a touched event when CanCollide = false is not possible and trying to make sound areas is what im trying to maybe go for.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Ive tried looking this up and I found nothing. So im guessing im the first person to stumble upon this?
This is a local script:
local player = game.Players.LocalPlayer
local sounds = game.Workspace.SoundAmbience
for i,v in pairs(sounds:GetChildren()) do
if v:IsA("Part") then
v.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
game.SoundService.AmbientReverb = "Hallway"
elseif not hit.Parent:FindFirstChild("Humanoid") then
game.SoundService.AmbientReverb = "NoReverb"
end
end)
end
end
Reverb Types are Enumerations, not string value. So instead of using 'Hallway" and "NoReverb", try using Enum.ReverbType.Hallway and Enum.ReverbType.NoReveb.
I’ve gone ahead and tried this but got no different result… or maybe I just did it wrong.
local region = game.Workspace.SoundAmbience:GetChildren()
while wait() do
for i,v in pairs(region) do
local partsinregion = workspace:FindPartsInRegion3(region, v, 3)
for _, parts in pairs(partsinregion) do
if parts.Parent:FindFirstChild("Humanoid") ~= nil then
game.SoundService.AmbientReverb = Enum.ReverbType.Hallway
else
game.SoundService.AmbientReverb = Enum.ReverbType.NoReverb
end
end
end
end
local Regions = {}
for _, Part in pairs(workspace:GetDescendants()) do
if Part:IsA("Part") then
if Part:FindFirstChild("EntryReverb") ~= nil then
if not Part.EntryReverb:IsA("StringValue") then continue end
if Part:FindFirstChild("LeaveReverb") == nil then
table.insert(Regions, {Region3.new(Part.Position - (0.5 * Part.Size), Part.Position + (0.5 * Part.Size)), Part.EntryReverb.Value, game:GetService("SoundService").AmbientReverb})
else
table.insert(Regions, {Region3.new(Part.Position - (0.5 * Part.Size), Part.Position + (0.5 * Part.Size)), Part.EntryReverb.Value, Part.LeaveReverb.Value})
end
Part:Destroy()
end
end
end
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local InRegion = false
Player.CharacterAdded:Connect(function(Char)
Character = Char
InRegion = false
end)
game:GetService("RunService").RenderStepped:Connect(function()
if not InRegion then
if Character ~= nil then
for _, RegionData in pairs(Regions) do
local HumanoidRootPart = Character:FindFirstChild("HumanoidRootPart")
if HumanoidRootPart ~= nil then
local Parts = workspace:FindPartsInRegion3WithWhiteList(RegionData[1], {HumanoidRootPart}, 20)
if #Parts > 0 then
game:GetService("SoundService").AmbientReverb = RegionData[2]
InRegion = true
coroutine.wrap(function()
repeat
wait()
InRegion = (#workspace:FindPartsInRegion3WithWhiteList(RegionData[1], {HumanoidRootPart}, 20) > 0)
until
not InRegion
game:GetService("SoundService").AmbientReverb = RegionData[3]
end)()
end
end
end
end
end
end)
Looks through all the parts in workspace, checks to see if it has a string value named “EntryReverb”, then makes it into a region3 and puts it into a table with the string value and the string value of “LeaveReverb” if it exists, if leavereverb doesnt exist it just uses the current reverb
then loops through all the regions and checks if the localplayer’s humanoidrootpart is inside of the region and if it is, it changes the reverb to the entry value then waits until the player leaves and when the player leaves it sets the reverb to the LeaveReverb value
Edit:
Looks like I forgot to clear the Auditorium Free Model of its scripts…
What I meant was that I don’t think it would work for this example: a playlist playing in the server so that each player hears it at the same instance/time a song is playing, but depending on where they are they hear it with different tones/effects.