Introduction
Hello everyone! This is my first community resource, a simple closed captions system.
Example:
local ClosedCaptions = require(game.Players.LocalPlayer.PlayerGui.ClosedCaptions.CaptionModule)
-- Add a subtitle
ClosedCaptions.Caption("Hello world!", 5)
-- Add a subtitle using blips
ClosedCaptions.CaptionBlip("Hello world!", 5, game.SoundService.blip)
Parameters
ClosedCaptions.Caption(Text, Lifespan)
Text: string, text to be displayed
Lifespan: number, how long the subtitle is visible for before it starts fading away
ClosedCaptions.CaptionBlip(Text, Lifespan, Blip)
Text: string, text to be displayed
Lifespan: number, how long the subtitle is visible for before it starts fading away
Blip: Sound instance, the sound to be played for each character
Flags
When using CaptionBlip, you can include flags in the text to make the text go faster or slower:
!f makes text go faster
!s makes text go slower
!p pauses for 0.3s
!n makes the speed normal
commas pause for 0.3s
Example:
local ClosedCaptions = require(game.Players.LocalPlayer.PlayerGui.ClosedCaptions.CaptionModule)
ClosedCaptions.CaptionBlip("!fNow text is fast!!nNow it's normal.", 5, game.SoundService.blip)
ClosedCaptions.CaptionBlip("!s!s!sNow text is sloooowwww.", 5, game.SoundService.blip)
ClosedCaptions.CaptionBlip("Now!p it's!p pausing!p between!p every!p word.", 5, game.SoundService.blip)
Use subtitles in your game
Showcase: Closed Captions Example - Roblox
Model: https://create.roblox.com/store/asset/16808990736
Just put the model in StarterGui and import the module from any localscript!