SlateUI
DocsComponentsGitHub
Install SlateUI Plugin
SlateUI
DocsComponentsGitHub
Install SlateUI Plugin

Components

  • installation
  • components
  • button
  • inputs
  • notification
  • progressbar
  • loading
  • proximity
  • router
  • cutscene
  • effects
  • subtitles
  • cameraplus
Component

SubtitleSystem

A cinematic subtitle manager featuring a character registry, typewriter text effects, color-coded names, and synced voice blips.

Overview

Subtitles can be displayed manually or triggered automatically via the Cutscene module. By utilizing the Character Registry, you can define an NPC's display name, text color, and talking sound once, and the system will automatically format all of their lines.

GUI Hierarchy Requirements

This module expects a specific GUI structure to exist in the player's PlayerGui. Ensure you have the following hierarchy created:

PlayerGui └─ SubtitleGui (ScreenGui) └─ SubtitleContainer (Frame) └─ SubtitleLabel (TextLabel, with RichText enabled)

Global Configuration

luau
1
2
3
4
5
6
7
local Subtitles = require(game.ReplicatedStorage.Subtitles.SubtitleSystem)
 
-- You can mutate the global config table at runtime to fit your game's pacing
Subtitles.Config.TypeSpeed = 0.05 -- Seconds between each character in typewriter mode
Subtitles.Config.FadeTime = 0.3 -- UI fade in/out duration
Subtitles.Config.BackgroundOpacity = 0.6 -- How dark the container frame gets
Subtitles.Config.UseTypewriter = true -- Default typewriter state for all subtitles

Registering Characters

luau
1
2
3
4
5
6
7
8
9
10
11
Subtitles:RegisterCharacter("commander", {
Name = "Cmdr. Shepard",
Color = Color3.fromRGB(56, 189, 248),
SoundId = "rbxassetid://123456789" -- Short blip sound played on reveal
})
 
Subtitles:RegisterCharacter("ai", {
Name = "SYSTEM",
Color = Color3.fromRGB(239, 68, 68),
SoundId = "rbxassetid://987654321"
})

Showing Subtitles & Using Callbacks

luau
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
-- Simple usage
Subtitles:Show({
character = "commander",
text = "We need to move, now!",
duration = 3
})
 
-- Advanced usage with a callback when the subtitle finishes reading
Subtitles:Show({
character = "ai",
text = "WARNING: Core temperature critical.",
duration = 4,
typewriter = true,
onComplete = function()
print("Subtitle finished! Trigger explosion here.")
end
})

Show() Options Dictionary

PropTypeDefaultDescription
textstring""The line of dialogue to display. HTML tags are stripped during character counting.
characterstringnilThe ID of a pre-registered character to fetch Name, Color, and SoundId from.
durationnumber2Time in seconds to keep the subtitle on screen after typing finishes.
typewriterbooleanConfig defaultOverrides the global UseTypewriter config for this specific line.
speaker / speakerColorstring / Color3nilAllows you to bypass the registry and provide a one-off speaker name and color.
onCompletefunctionnilTask spawned when the subtitle duration ends and the fade-out begins.