How do i adjust the audio or sound that is running on my game when you are far away from the object that has the sound?
✓ ANSWER ACCEPTED
Audio Pitch Distance?
1 answer
✓ Accepted answer
Even if ROBLOX automatically does the Distance thing if a sound is inside a 3D Object like a part. If one person is close to it and one person is far away, it would sound the same. We can use a LocalPart for that.
To make the local part use a local script. Make the Part Parent = workspace.Camera
Instance.new("Part",workspace.Camera)
Finished Script
This uses get distance from character.
(Local Script!)
local part = Instance.new("Part",workspace.Camera)
--Change everything like size and position.
local sound = Instance.new("Sound", part)
--Change the SoundId and everything.
local plyr = game:GetService("Players").LocalPlayer
while wait() do --There is a better way to do this, I just need to write this quickly...
if plyr:GetDistanceFromCharacter(part.Position) < 15 then
sound.Pitch = .5 --This is an example. You may edit this script.
end
end
Hope this helps!(You need to edit the above script. It's just an example.)
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Roblox, automatically does this with distance, however changing pitch would simply get the magnitude to the two positions and change the pitch arcoding to the distance