Global Spatial Voice Script

I found a way to make Global Spatial Voice.

Basically the script creates another character locally per person and sets the players to the new character. This doesn’t actually remove them from the Workspace or disable their controls! So they will still be able to walk around. This could be used for intercoms or VIP Servers. Do whatever you want!

How does it work? Voice chat originates from the Humanoid. The Humanoid uses the HumanoidRootPart to push out the sound from your Microphone. The script creates a fake character that Spatial Voice will hook on to, and teleport the fake characters HumanoidRootPart to the camera allowing for you to hear users voices at an infinite distance.

THIS HAS BEEN TESTED THROUGHLY. IT WORKS BUT IM NOT SURE IF ITS VERY OPTIMIZED. USE AT YOUR OWN RISK!

Put this as a LocalScript in StarterGui

local player = game.Players.LocalPlayer
local VCPlayers = Instance.new("Folder")
VCPlayers.Name = "VCRoutes"
VCPlayers.Parent = player

for i,v in pairs(game.Players:GetChildren()) do
	if v ~= player then
		if VCPlayers:FindFirstChild(v.UserId) then
			VCPlayers:FindFirstChild(v.UserId):Destroy()
		end
		local Char = Instance.new("Model",VCPlayers)
		local humanoid = Instance.new("Humanoid",Char)
		local Root = Instance.new("Part",Char)
		Char.PrimaryPart = Root
		Char.Name = v.UserId
		coroutine.resume(coroutine.create(function()
			game:GetService("RunService").RenderStepped:Connect(function()
				Root.CFrame = game.Workspace.CurrentCamera.CFrame
			end)
		end))
		v.Character = Char
		v.CharacterAdded:Connect(function(char)
			v.Character = Char
		end)
	end
end

game.Players.PlayerAdded:Connect(function(plr)
	if VCPlayers:FindFirstChild(plr.UserId) then
		VCPlayers:FindFirstChild(plr.UserId):Destroy()
	end
	local Char = Instance.new("Model",game.Players.LocalPlayer)
	local humanoid = Instance.new("Humanoid",Char)
	local Root = Instance.new("Part",Char)
	Char.PrimaryPart = Root
	coroutine.resume(coroutine.create(function()
		game:GetService("RunService").RenderStepped:Connect(function()
			Root.CFrame = game.Workspace.CurrentCamera.CFrame
		end)
	end))
	plr.CharacterAdded:Connect(function(char)
		plr.Character = Char
	end)
end)

game.Players.PlayerRemoving:Connect(function(plr)
	if VCPlayers:FindFirstChild(plr.UserId) then
		VCPlayers:FindFirstChild(plr.UserId):Destroy()
	end
end)

Obviously my code probably isn’t the best. If you have a better version go ahead and post it here for others to use!

29 Likes

I have been looking for something like this for ages.

Same. That’s why I started experimenting and figured out how Spatial Voice works.

They actually do Spatial Voice stuff locally! So just setting there player as a part and teleporting it to your camera will allow you to hear people from infinite distances.

2 Likes

Just to confirm, when you say “globally” you mean the server the player is in and not across all servers in a experience?

1 Like

I’d assume so because with voice chat I’m pretty sure it’s only allowed to be used inside servers unlike chats which can be global.

Should’ve explained that.

No. At it’s current state it’s impossible to do that. I mean everyone in the server you are IN can hear you without being next to eachother. I am even making a Module called SpatialVoice++ which will allow toggled Global chat.

This could be used for among us type stuff.

1 Like

I developed something like this a while ago, allowing you to do a lot more than just global voice chat…

2 Likes

This is amazing, this allows for developers to make radio systems with spatial voice

Oh! I was looking up spatial voice and never found anything.

I’ll be sure to look up at that as it seems pretty cool! Has a lot of features. I’m making a core game where there’s a normal TownRP outside and reactor facility inside.

This will probably help me make the rest of the stuff I was dreaming to do about voice chat in my game.

And the next thing we need is a VR radio to actually use this.

This might help with a project I’m working on. I want to make it to where players can have different channels in-game and talk with each other, like walkie talkies. Will try to play around with this code.

Since I know it’s possible (since it’s featured in SCP 3008 game) I will try to figure out how to make Spatial Voice Audio effects. (The audio effects from Roblox)

hopefully that will also help. But don’t get too excited! Not sure if I could do it.

1 Like

I was told by multiple devs that it is possible and isn’t possible. I hope it can be done! Would go good in my project I’m working on.

Sorry for reviving this topic.

This is overall a well put-together script, works flawlessly with a few optimization tweaks & cleanup. Utilizing this for a Flight System I may release for the public, the player in flight near an airport → attach them to ATC team seat where they can hear ATC & vice versa/quick to use chat commands.

2 Likes