How to affect audio direction

This wouldn’t work as there would be multiple clients and if I tried to make the part follow the player it would be messed up for everyone else. Plus, it would kind of ruin the static effect I was trying for where the sound would stay in one place and then slowly fade as you got closer but not have it go willy nilly out of the area I wanted the sound played in. This is difficult as it’s a rectangle shaped containment space for the sound.

Will try that, I don’t think I have that enabled so I’ll go try that and get back to you with the results. If this works it should solve my problem.

You will have to mess with it a bit. Seems lower sound volumes work best.
But all it all this is really nice and works well. Once you get how it’s working.

1 Like

Volumetric Sounds aren’t available in my beta features tab. They don’t show up. I only have ones in there that are recently released.

1 Like

well you could use raycast to get around that:

basically how the script works is that it raycasts in a heartbeat event from the player’s rootPart to the soundPart and if the result’s Instance is equal to the soundpart then we tween the volume to go from 1 to 0 and if the result is nil or not equal to the soundPart it just tweens the volume from 1 to 0:

-- StarterPlayer --> StarterCharacterScripts
local runService = game:GetService('RunService')

local character = script.Parent
local hrp = character:WaitForChild('HumanoidRootPart')
local params = RaycastParams.new()
params.FilterDescendantsInstances = {script.Parent}

local range = workspace.soundPart.Sound.RollOffMaxDistance
runService.Heartbeat:Connect(function()
	local direction = (workspace.soundPart.Position - hrp.Position).Unit * range
	local origin = hrp.Position
	local raycast = workspace:Raycast(origin, direction, params)
	if raycast and raycast.Instance == workspace.soundPart then
		game.TweenService:Create(workspace.soundPart.Sound, TweenInfo.new(0.25), {Volume = 1}):Play()
	else
		game.TweenService:Create(workspace.soundPart.Sound, TweenInfo.new(0.25), {Volume = 0}):Play()
	end
end)

very sorry for the late response, i wanted to reply yesterday but my internet was really bad.

2 Likes

No problem thanks for responding and the help! I’ll definitely try this method if I can’t find the beta feature that @Scottifly pointed out.

1 Like

If you go to SoundService inside the Explorer, there should be a property called VolumetricAudio, switch that to Enabled.

2 Likes

That’s probably why I didn’t see it. Thanks a lot!

You should mark @epicrobloxpro1994’s as the Solution so other people can also find the answer to the problem, and also so other people don’t see it as unsolved and keep replying to it.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.