AudioTextToSpeech:LoadAsync() yields forever when called server-side on a production server.

AudioTextToSpeech:LoadAsync() and AudioTextToSpeech.IsLoaded work perfectly as expected in studio, but not on the game servers:

  • AudioTextToSpeech:LoadAsync() yields forever and never fires,
  • AudioTextToSpeech.IsLoaded never sets.

Tested with the following server scripts:

local referencePart = workspace.Part

local AudioTextToSpeech = Instance.new('AudioTextToSpeech')
AudioTextToSpeech.VoiceId = '1'
AudioTextToSpeech.Text = 'This is the test.'
AudioTextToSpeech.Parent = referencePart

local result = AudioTextToSpeech:LoadAsync()
print(result)

if result ~= Enum.AssetFetchStatus.Success then
	return
end

if not AudioTextToSpeech.IsLoaded then
	AudioTextToSpeech:GetPropertyChangedSignal('IsLoaded'):Wait()
end
print(AudioTextToSpeech.IsLoaded)

AudioTextToSpeech:Play()
local referencePart = workspace.Part

local AudioTextToSpeech = Instance.new('AudioTextToSpeech')
AudioTextToSpeech.VoiceId = '1'
AudioTextToSpeech.Text = 'This is the test.'
AudioTextToSpeech.Parent = referencePart

AudioTextToSpeech:Play()

if not AudioTextToSpeech.IsLoaded then
	AudioTextToSpeech:GetPropertyChangedSignal('IsLoaded'):Wait()
end
print(AudioTextToSpeech.IsLoaded)

Reproduction steps:

  1. Create and publish a place in studio or use an existing published place,
  2. Insert two server scripts in ServerScriptService with RunContext set to either Legacy or Server and use the code snippets provided above,
  3. Playtest the place in studio and then in game, notice how the script works in studio but not on the live server.

Expected behavior

AudioTextToSpeech and its properties should work the same on the production server as they do in studio.

5 Likes

After further investigation I noticed that this particular issue also covers the following AudioTextToSpeech properties and events:

  • TimeLength
  • IsPlaying (does not set to false once the audio playback has been completed)
  • .Ended
  • .Looped

Therefore it is very difficult or in some cases even impossible for creators to use the text to speech on the server side.

2 Likes

Yup, I’m having the same problems, everything alright in studio but when I go into a real game server, it just doesn’t work.

Hello!

AudioTextToSpeech is not supported server-side- it won’t load on server-side scripts. Apologies for the confusion!

We plan on making the error message for AudioTextToSpeech when loaded server-side a lot clearer in the future.

1 Like
  1. Please document this somewhere. It’s very frustrating to have built my systems in Studio with the expectation this will work in production only to be met with a cryptic 401 Unauthorized warning. Only until I stumbled upon this post I realized what the issue was.
  2. Why’s this not supported server-side? We need an audio to be heard by ~100 players simultaneously. Why should we waste our request quota on loading each audio on each player individually? This forces us to backpedal and mass upload voice lines instead.