Since the AudioTextToSpeech is limited to volume level 3 the only possible way that ive thought is using an audio emitter. Trying to boost the audio since its very quiet at the moment. When using, the code snippet below it breaks the code and results in not playing the audio at all.
Emitter.DistanceAttenuationMode = Enum.DistanceAttenuationMode.Custom
Emitter:SetDistanceAttenuation({[0] = 1.0, [100] = 1.0})
Full Snippet:
local Speakers = {}
function Speakers.PlaySpeaker(Audiotype, folder)
for _, speaker in ipairs(folder:GetDescendants()) do
if speaker:IsA("BasePart") then
local ATTS = Instance.new("AudioTextToSpeech")
ATTS.Parent = speaker
ATTS.Text = Audiotype
ATTS.Speed = 0.7
ATTS.Volume = 2
ATTS.VoiceId = 5
local Emitter = Instance.new("AudioEmitter")
Emitter.Parent = speaker
Emitter.DistanceAttenuationMode = Enum.DistanceAttenuationMode.Custom
Emitter:SetDistanceAttenuation({[0] = 1.0, [100] = 1.0})
local Wire = Instance.new("Wire")
Wire.Parent = speaker
Wire.SourceInstance = ATTS
Wire.TargetInstance = Emitter
ATTS:Play()
repeat
task.wait()
until ATTS.TimeLength > 0 or not ATTS.IsPlaying
if ATTS.TimeLength > 0 then
task.wait(ATTS.TimeLength)
end
Wire:Destroy()
Emitter:Destroy()
ATTS:Destroy()
end
end
end
return Speakers