xDom's Custom Typewriter Module

xDom's Typewriter Module

Download

What is this module?

xDom’s Typewriter Module is a custom text system that allows users to create custom text effects that would be considered impossible when using a normal typewriter system.

Features

xDom’s Typewriter Module is extremely easy to use, featuring 3 main functions:

  • Typewrite
  • Clear
  • UnbindEffectLoop

These functions are described in the “Documentation” section of this post.

The module also comes with 3 built in intro effects, and 1 built in consistent effect (as listed below):
Intro effects:

  • Spin
  • Fade in
  • Shake

Consistent effect:

  • Shake

Lastly, this module comes with built in text wrapping, and an easily accessible settings module (more about this in the Q&A section).

Q&A

Q: How do I edit the default settings of the typewriter module?
A: You go to the “TypewriterDefaultSettings” located under the main module and edit the values there. There are multiple comments in the settings module to help guide you.

Q: How do I add my own intro/consistent effects?
A: There are two modules inside of the main module called “IntroEffectsModule” and “ConsistentEffectsModule”, you can add your own intro/consistent effects by writing your own functions here. (Requires some scripting knowledge)

Q: Where do I place the module?
A: Place the module in ReplicatedStorage.

Working examples

NPC Dialogue:

local TypewriterModule = require(game.ReplicatedStorage.TypewriterModule)

--inputted text
local text = "Hello adventurer! Our village is in desperate need of help, and we require the assistance of a experienced fighter such as yourself. Please travel to the EVIL CAVE and slay 6 skeletons."

--effects that will be ran
local effects = {
	["Colors"] = {
		{
			["Position"] = 154, --characters 1-154 will be black
			["Color"] = Color3.fromRGB(0,0,0),
		},
		{
			["Position"] = 163,  --characters 155-163 will be red
			["Color"] = Color3.fromRGB(255,0,0),
		},
		{
			["Position"] = math.huge, --characters 164-end will be black
			["Color"] = Color3.fromRGB(0,0,0),
		},
	},
	["IntroEffects"] = {
		{
			["Position"] = 154, --characters 1-154 will be fade in
			["FunctionName"] = "FadeIn",
		},
		{
			["Position"] = 163, --characters 155-163 will shake in
			["FunctionName"] = "Shake",
		},
		{
			["Position"] = math.huge, --characters 164-end will fade in
			["FunctionName"] = "FadeIn",
		},
	},
	["ConsistentEffects"] = {
		{
			["Position"] = 154, --characters 1-154 will have no consistent effects
			["FunctionName"] = "None",
		},
		{
			["Position"] = 163, --characters 155-163 will shake until either Clear or UnbindEffectLoop are called
			["FunctionName"] = "Shake",
		},
		{
			["Position"] = math.huge, --characters 164-end will have no consistent effects
			["FunctionName"] = "None",
		},
	}
}

local frame = script.Parent.Frame.ScrollingFrame --frame that the text will be parented under

TypewriterModule.Typewrite(text, frame, nil, effects) --Typewrite function using the above values

Result:

Simple Text:

local TypewriterModule = require(game.ReplicatedStorage.TypewriterModule)

--inputted text
local text = "This is just a simple dialogue!"
local frame = script.Parent.Frame.ScrollingFrame --frame that the text will be parented under

TypewriterModule.Typewrite(text, frame, nil, nil) --Typewrite function using the above values

Result:

Why did I create this module?

I specifically created this module for a dialogue system in a game that I am working on, and I decided to open source it because I believed that it would be useful to new developers who are interested in creating their own typewriter/dialogue systems.

Documentation

Typewrite(text: string, textParent: Frame | ScrollingFrame, Settings: TypewriterSettings?, Effects: TypewriterEffects?)

Typewrites using the inputted text, settings, and effects. Settings/effects are optional inputs, if you input nil the default settings/effects will be applied.

Clear(frameToClear: Frame | ScrollingFrame)

Clears all text from the inputted frame, also stops all currently running effects.

UnbindEffectLoop()

Stops all running text effects for the client that calls the function. This function does not delete any existing text.

Developer's Note

This is my first ever open source module so feedback would be greatly appreciated, I am also free to answer any questions, just leave them down below and I’ll make sure to get to them ASAP.

  • W Module
  • L Module

0 voters

10 Likes

Sick! Can’t wait to test it out

I love it, you should add more effects!

Thanks, but the effects I added were mainly just for showcase. In the Q&A section I mentioned how you can add your own effects, but this requires some scripting knowledge.