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
To enable Spatial Voice within an experience:
- In the menu bar, navigate to the Home tab.
- In the Settings section, click on Game Settings. A Game Settings dialog displays.
- In the left-hand navigation, select Options.
- 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:
- In the left-hand navigation of the Game Settings dialog, select Places. Every place within your experience displays.
- Click the ... button next to the place with more than 50 players, then select Edit.
- In the Max Players field, type in any number equal to or less than 50.
- 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:
- In the Model tab of the menu bar, navigate to the Advanced section, then click the Service icon. The Insert Service dialog displays.
- Select VoiceChatService.
- In the Explorer window, select VoiceChatService.
- In the Properties window, disable the EnableDefaultVoice property.
- 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")34local me = Players.LocalPlayer5local myCharacter = me.Character or me.CharacterAdded:Wait()6local myHead = myCharacter:WaitForChild("Head")78SoundService: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")34local me = Players.LocalPlayer5local myCharacter = me.Character or me.CharacterAdded:Wait()6local myHead = myCharacter:WaitForChild("Head")78SoundService:SetListener(Enum.ListenerType.ObjectCFrame, myHead)9
Checking Spatial Voice Status
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")34local localPlayer = Players.LocalPlayer5local success, enabled = pcall(function()6 return VoiceChatService:IsVoiceEnabledForUserIdAsync(localPlayer.UserId)7end)8if success and enabled then9 localPlayer.PlayerGui.MyVoiceGui.Enabled = true10end11
A warning message displays if a user or place isn't eligible for Spatial Voice. Reference the following table for possible solutions:
|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.|