Hello!! I’ve been working on a dialogue system in Roblox studio for a few days with the goal of making one just as customisable as the one in Undertale!
It has compatibility for all screen sizes(though text will act weird when the screen size is changed, e.g. through resizing the window), and has support for individual word and individual character configuration.
In order to achieve this, I used spritesheets for each font and made use of the ImageRectOffset value to show individual characters. Unfortunately, this reduces the amount of characters that you can use. If you use an unsupported character, 3 question marks should appear and the console should contain a warning stating that an unsupported character was used.
(Old Video before sequences and wave effect was made)
To use this dialogue system, a dictionary named dialogue has to be made, containing lines and config. Here’s an example:
local dialogue = {
lines = {
"* Hello! This is the first line of dialogue!",
"* Hi again! This is the second line of dialogue!"
},
config = {
lines = {
["1"] = {
Persistent = true -- Having Persistent set to true means that the configuration for the first line will be used for the next line, unless the next line already has configuration set.
colors = {
["1"] = Color3.fromRGB(255, 255, 255),
},
sounds = {
["1"] = game.SoundService["snd_txtsans"]
},
speeds = {
["1"] = 0.05
},
effects = {
["1"] = "normal"
},
fonts = {
["1"] = "Sans"
}
}
}
}
}
Additionally, regarding configuration, tables containing values such as sounds, colours or numbers for speeds can be used. This is called a sequence, and it will basically loop a configuration. Here’s an example of a sequence for colour:
colors = {
["1"] = {
["1"] = Color3.fromRGB(0, 249, 0),
["2"] = Color3.fromRGB(142, 250, 0),
["3"] = Color3.fromRGB(255, 251, 0),
["4"] = Color3.fromRGB(142, 250, 0),
["5"] = Color3.fromRGB(0, 249, 0)
}
},
Then, this table will be fired to a client through a remote.
game:GetService("ReplicatedStorage")["Customisable Dialogue System Resources"].ActivateDialogueSystem:FireAllClients(dialogue) -- This will make all players see dialogue.
After the remote is fired, a Localscript inside the dialogue GUI handles the construction of text. It shouldn’t need to be changed unless you want to add your own effect or change how the system works. Also, if you wish to use this then you will need to go into the Localscript and set the default values for sound to a sound that exists in your game.
These are the configurable properties:
- Text Colour
- Text Sound Effect
- Text Speed(how long of a delay there is for the next character to appear)
- Text Effect (An effect for text characters. Effects work through localscripts. Currently, there is only a wavy text effect and a shaky text effect.)
(A very important limitation is that only a single font can be used in 1 line of dialogue.)
I hope that you can find this of some use! Here is the uncopylocked place containing the dialogue system.
(If you have any questions or concerns, just reply and I’ll get back to you as soon as I can!)