Chat with 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.
Chat with spatial voice is only available for places up to 50 users, and that load an avatar.
Enabling Chat with Spatial Voice
To enable chat with 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.
Chat with 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 chat with spatial voice, it is recommended to restart your servers.
Disabling Chat with Spatial Voice Per Place
If you don't want to enable chat with spatial voice for every place within your experience, you can disable it within specific places that would otherwise be voice-eligible through the EnableDefaultVoice property.
To disable chat with 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 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.
local SoundService = game:GetService("SoundService")local Players = game:GetService("Players")local me = Players.LocalPlayerlocal myCharacter = me.Character or me.CharacterAdded:Wait()local myHead = myCharacter:WaitForChild("Head")SoundService:SetListener(Enum.ListenerType.ObjectPosition, myHead)
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.
local SoundService = game:GetService("SoundService")local Players = game:GetService("Players")local me = Players.LocalPlayerlocal myCharacter = me.Character or me.CharacterAdded:Wait()local myHead = myCharacter:WaitForChild("Head")SoundService:SetListener(Enum.ListenerType.ObjectCFrame, myHead)
Checking Chat with Spatial Voice Status
For example, if you want to enable a UI-layer for voice-enabled users, reference the following script:
local Players = game:GetService("Players")local VoiceChatService = game:GetService("VoiceChatService")local localPlayer = Players.LocalPlayerlocal success, enabled = pcall(function()return VoiceChatService:IsVoiceEnabledForUserIdAsync(localPlayer.UserId)end)if success and enabled thenlocalPlayer.PlayerGui.MyVoiceGui.Enabled = trueend
A warning message displays if a user or place isn't eligible for chat with 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 Chat with Spatial Voice Beta are eligible to chat in experiences using spatial voice.|