What is SmartText?
SmartText is an open-sourced ModuleScript that makes formatting text using RichText simple. In fact, SmartText will do all the formatting for you!
Why use SmartText?
SmartText handles all the text formatting for you, so that you can focus on what’s important: the text. All you have to do is insert the ModuleScript, require it, and use it’s functions.
How to get started?
Get started with SmartText in three simple steps:
Insert it into ReplicatedStorage:
- Require it from another script
local ReplicatedStorage = game:GetService("ReplicatedStorage") local SmartText = require(ReplicatedStorage:WaitForChild("SmartText")
How to use SmartText?
SmartText can automatically format your text with functions, and all you have to do is pass in the text you want to be formatted. Then, SmartText will
return
the properly formatted version of the text you passed in. Some of SmartText’s function will require more than one argument, such as it’s:Size()
function. Bellow, you’ll find a list of all SmartText’s functions. A GitHub for SmartText’s documentation is coming soon.SmartText:Bold("Text") -- returns in bold format SmartText:Italic("Text") -- returns in an italic format SmartText:Underline("Text") -- returns in an underlined format SmartText:Strike("Text") -- returns in a strike-through format SmartText:Size("Text", 10) -- returns text with size passed through SmartText:ColorRGB("Text", 0, 0, 0) -- returns text in an RGB colored format SmartText:ColorHEX("Text", "#123456") -- returns text in a HEX corored format
Example #1
LocalScript inside of a TextLabel:
local ReplicatedStorage = game:GetService("ReplicatedStorage") local SmartText = require(ReplicatedStorage:WaitForChild("SmartText")) local bold = SmartText:Bold(":Bold ") local italic = SmartText:Italic(":Italic ") local line = SmartText:Underline(":Underline ") local strike = SmartText:Strike(":Strike ") local size = SmartText:Size(":Size ", 50) local rgb = SmartText:ColorRGB(":ColorRGB ", 200, 100, 100) local hex = SmartText:ColorHEX(":ColorHEX ", "#138dff") local face = SmartText:Face(":Face ", "Bangers") script.Parent.Text = bold .. italic .. line .. strike .. size .. rgb .. hex .. face
Result:
Place file for this example: SmartTextDemo.rbxl (24.0 KB)
Example #2
LocalScript inside of a TextLabel:
local ReplicatedStorage = game:GetService("ReplicatedStorage") local SmartText = require(ReplicatedStorage:WaitForChild("SmartText")) local text1 = "SmartText" text1 = SmartText:Bold(text1) text1 = SmartText:Size(text1, 30) text1 = SmartText:Face(text1, "Kalam") text1 = SmartText:ColorRGB(text1, 100, 200, 200) local text2 = "automatic formatting" text2 = SmartText:Bold(text2) text2 = SmartText:ColorRGB(text2, 100, 200, 200) script.Parent.Text = "By using " .. text1 .. ", you can easily create amazing looking text with " .. text2
Result:
Place file for this example:SmartTextDemo.rbxl (24.0 KB)