I’ve seen games like pls donate change the range of their vc. How is this done?
I haven’t dabbled with voice chat much, but looking into VoiceChatService might be a decent starting point. It looks like the VoiceChatService.UseAudioApi is the main way to either use the default or implement a custom system.
Any idea what to use on it to lower vc range?
like @East98 said, look into voice chat service. In VoiceChatService, Look into The instances AudioEmmiter and AudioListener. I believe the methods and the properties is what you’re looking for. (More into details check out the method SetDistanceAttenuation if im not mistaken which exists in both instances
The wiki says these 3 objects would be automatically created, although for me the AutioEmitter doesnt get created in the character. Can you help confirm this?
But even if its glitched, I went and created my own.
It seemed to work, but one issue is that you can now hear yourself. I solved this by removing the wire on the client.
The DistanceAttenuation is set to 0 at 40 studs. And when I can hear myself this works for myself. If I zoom out it works at 40 studs perfectly. However the issue is that when I test it with someone else, I can still hear their vc no matter how far I go, except its just faint.
I can’t tell if I’m doing something wrong with the setup or if this is a bug?
I just got to a place and saw that indeed audioemitter isnt created, however on distanceattenutation, you should use the method!. Here is a sample by roblox in the documment explaining how to use it properly:
local Players = game:GetService("Players")
local emitterPart = Instance.new("Part")
emitterPart.Anchored = true
emitterPart.Position = Vector3.new(0, 0, 0)
emitterPart.Parent = workspace
local emitter : AudioEmitter = Instance.new("AudioEmitter")
emitter.Parent = emitterPart
local curve = {}
curve[10] = 1 -- Within a distance of 10 studs, listeners hear this emitter at full volume
curve[100] = 0.4 -- At a distance of 100 studs, listeners hear this emitter at 40% volume
curve[300] = 0 -- At any distance farther than 300 studs, listeners cannot hear this emitter
emitter:SetDistanceAttenuation(curve)
-- Replicate the rolloff curve from the old voice implementation
-- Default voice without the new audio API uses quadratic rolloff ranging from 7 to 80 studs
local MIN_DISTANCE = 7
local MAX_DISTANCE = 80
local CURVE_STEP_SIZE = 2
local voiceCurve = {}
for i = MIN_DISTANCE, MAX_DISTANCE, CURVE_STEP_SIZE do
voiceCurve[i] = ((i - MIN_DISTANCE) - (MAX_DISTANCE - MIN_DISTANCE))^2 / (MAX_DISTANCE - MIN_DISTANCE)^2
end
voiceCurve[MAX_DISTANCE] = 0
local function setVoiceCurve(character)
local voiceEmitter : AudioEmitter = character:WaitForChild("AudioEmitter")
voiceEmitter:SetDistanceAttenuation(voiceCurve)
end
for _, player in Players:GetPlayers() do
if player.Character then
setVoiceCurve(player.Character)
end
player.CharacterAdded:Connect(setVoiceCurve)
end
What i do recommend however is that not all players are egible for vc, but im unsure how you check that. But once you check that the player has vc, you should use this so that no errors appear!
(FYI i found it here)
unfortunately I can still hear everything from a distance just faintly
Did you try lowering the studs seeing if there is any effect? Also check more about the api, i think you have to enable it
Okay so i just had a thought, i cannot execute this but if i get home before you do it then ill update you.
Since youre not seeing the audio emitter, that means useaudioapi is disabled, you should look into it and try to enable it, if you enable it then you can see the audio emitter
I’m pretty sure this is where I’d enabled it and it’s been like this. Unless I’m missing something.