Easy TextToSpeech Module TTS

Easy TextToSpeech Module

Module Description
A fully-featured Text-to-Speech (TTS) module for Roblox, supporting voice switching, pitch, speed, volume, automatic queueing of messages, and safe handling of filtered text.


Module: ETextToSpeechModule
PlaceTest: TextToSpeechStudioPlace.rbxl (76.9 KB)

Key Features

  1. Multi-voice support
    Switch between 10 different voices, including British, US, Australian, and retro-styled voices, These are provided by Roblox..

    VoiceID Description
    1 British male
    2 British female
    3 US male 1
    4 US female 1
    5 US male 2
    6 US female 2
    7 Australian male
    8 Australian female
    9 Retro voice #1
    10 Retro voice #2
  2. Queue support for multiple messages
    You can pass single strings or tables of strings, and the module will automatically queue them and play sequentially.

    tts:PlayText({"Hello everyone!", "This is a queued message."}) 
  3. Filtered text handling
    Roblox may filter some words (e.g., “discord”), which normally breaks playback. This module automatically skips filtered messages and continues the queue, ensuring your TTS system never stops unexpectedly.

  4. Auto-throttling
    Roblox imposes limits on TTS requests per minute based on the number of concurrent players. The module calculates the minimum delay automatically and queues requests if necessary, avoiding rate-limiting errors like Failed to load sound : Rate limited by the client.

  5. Playback customization
    Each message supports optional parameters:

    • speed (0.5–2.0)
    • pitch (-12–12 semitones)
    • volume (0–3)

Example Usage

This is on StarterPlayerScripts ; LocalScript

local ReplicatedStorage = game:GetService("ReplicatedStorage") local TextToSpeech = require(ReplicatedStorage:WaitForChild("TextToSpeech")) local tts = TextToSpeech.new("1") -- Start with British male -- Play a single message tts:PlayText("Hello DevForum User", 1.2, 0, 2) -- Play multiple messages in a table tts:PlayText({"Hello CFiestaa", "hello, "..game.Players.LocalPlayer.Name}, 1.2, 0, 2) -- Example of filtered text handling tts:SetVoice(4) tts:PlayText("discord") -- Will skip automatically if filtered tts:SetVoice(2) tts:PlayText("This is queued message #2.") tts:SetVoice(6) tts:PlayText("And this is #3.") -- Handle queue completion tts.OnQueueFinished.Event:Connect(function() print("âś… All queued TTS messages finished!") end) 


Notes & Recommendations

  • Avoid using Event:Wait() between messages individually. Instead, queue all messages and wait for OnQueueFinished once.
  • Keep messages below 300 characters to avoid truncation. The module will automatically trim and warn if needed.
  • If using multiple players, the module calculates throttling automatically to prevent Rate limited by the client errors.
  • Please Read this Post Build More Immersive Experiences: Text-to-Speech API Full Release

For those who might be wondering, Roblox automatically filters any text you convert to speech to prevent bad words! I implemented a system that skips to the next message if one gets filtered, to prevent the error from stopping the TTS.


This is my first Free Resources, I appreciate any suggestions. :heart:

8 Likes

I didn’t even know there was something called “AudioTextToSpeech”. :sob:

2 Likes

Es bastante increible el tutorial sin duda lo usare para un futuro de hecho me recuerda mucho al pyttsx3 de python

1 Like

Dude this is so neat! Thank you for this cause the errors were bugging me a lot :slight_smile:

1 Like

Patche 1

  • The module now properly skips any text that fails the Roblox text filter instead of continuing to process it.

Voice #10 is the same as voice #9

are the same id sound that Roblox published in its announcement.