Spatial Voice

Spatial Voice is a proximity-based voice chat feature that simulates realistic communication based on how close you are to other users who are speaking. The closer you are to another user, the louder their voice; conversely, the farther away you are from another user, the softer their voice.

Spatial Voice is only available for places up to 50 users, and that load an avatar.

Enabling Spatial Voice

Before you begin to enable Spatial Voice, you must first publish your experience to enable the Game Settings menu within Studio.

To enable Spatial Voice within an experience:

  1. In the menu bar, navigate to the Home tab.
  2. In the Settings section, click on Game Settings. A Game Settings dialog displays.
  3. In the left-hand navigation, select Options.
  4. Enable the Spatial Voice toggle.

Spatial Voice is now available in every place in the experience that has their maximum number of users set to 50 or less.

Setting Maximum Users

If you previously set the maximum number of users in a place to more than 50, you can always modify it to a lesser number.

To set the maximum number of users:

  1. In the left-hand navigation of the Game Settings dialog, select Places. Every place within your experience displays.
  2. Click the ... button next to the place with more than 50 players, then select Edit.
  3. In the Max Players field, type in any number equal to or less than 50.
  4. Click the Save button.

When you update the maximum number of users in a place to fewer than 50, there may be servers already configured to a different, higher number. As those servers won’t support Spatial Voice, it is recommended to restart your servers.

Disabling Spatial Voice Per Place

If you don't want to enable Spatial Voice for every place within your experience, you can disable Spatial Voice within specific places that would otherwise be voice-eligible through the EnableDefaultVoice property.

To disable Spatial Voice for a place:

  1. In the Model tab of the menu bar, navigate to the Advanced section, then click the Service icon. The Insert Service dialog displays.
  2. Select VoiceChatService.
  3. In the Explorer window, select VoiceChatService.
  4. In the Properties window, disable the EnableDefaultVoice property.
  5. Restart your servers to ensure the change takes effect for all servers currently running your experience.

Changing Listener Perspective

You can adjust how a user perceives voice and all other sounds within your experience by calling SoundService:SetListener(). The SoundService listener determines the point from which users hear audio within the experience.

When you use an ObjectPosition ListenerType, users perceive sound through the position of the object while using the orientation of the camera. The sound comes through their device's left and/or right speaker depending on the orientation of the camera while the volume depends on the object's distance from the source of the sound.


1local SoundService = game:GetService("SoundService")
2local Players = game:GetService("Players")
3
4local me = Players.LocalPlayer
5local myCharacter = me.Character or me.CharacterAdded:Wait()
6local myHead = myCharacter:WaitForChild("Head")
7
8SoundService:SetListener(Enum.ListenerType.ObjectPosition, myHead)
9

When you use an ObjectCFrame ListenerType, users perceive sound through the position and orientation of the object. For example, if their character's head is the object and they face to the right, sound will come through their device's left speaker since the character's left ear is now facing the source of the sound, and the volume depends on how close their character is to the source of the sound.


1local SoundService = game:GetService("SoundService")
2local Players = game:GetService("Players")
3
4local me = Players.LocalPlayer
5local myCharacter = me.Character or me.CharacterAdded:Wait()
6local myHead = myCharacter:WaitForChild("Head")
7
8SoundService:SetListener(Enum.ListenerType.ObjectCFrame, myHead)
9

Checking Spatial Voice Status

You can check if a user has enabled Spatial Voice by calling VoiceChatService:IsVoiceEnabledForUserIdAsync()in a LocalScript.

For example, if you want to enable a UI-layer for voice-enabled users, reference the following script:


1local Players = game:GetService("Players")
2local VoiceChatService = game:GetService("VoiceChatService")
3
4local localPlayer = Players.LocalPlayer
5local success, enabled = pcall(function()
6 return VoiceChatService:IsVoiceEnabledForUserIdAsync(localPlayer.UserId)
7end)
8if success and enabled then
9 localPlayer.PlayerGui.MyVoiceGui.Enabled = true
10end
11

Warnings

A warning message displays if a user or place isn't eligible for Spatial Voice. Reference the following table for possible solutions:

Warning Message Resolution
Current place is not eligible for Spatial Voice. Spatial Voice is available for places with Max Players <= 50. Reduce the Max Player value for the place to 50 or less in the Game Settings dialog.
Current Player is not eligible to use Spatial Voice. Users who are a part of the Spatial Voice Beta are eligible to use Spatial Voice.