[!] This no longer is needed, and so you do not need to see this.
If you need to contain a whole lot of replaced strings with others, you should try EzReplace! It is quite a short module which I plan to focus on for now. DataStore Resource, my project I made too long ago will still get updates, just not as many as EzReplace’s.
What can it do?
It can replace strings with multiple changes, so if you wanted to, it could easily change a string with over 100 changes! (has been tested) . There is not much to say more than that!
How do I use it?
It only consists of 1 module which is easy to understand. This will be split up into 3 parts of this section.
Part 1 - AddNewChanging()
AddNewChanging is a function which adds a new string to be changed within another. Say we have a string saying “Riches favours the bold” and we add a changing like this:
local ezReplace = require(game.ReplicatedStorage.EzReplace) -- I suggest putting it in ReplicatedStorage
ezReplace.AddNewChanging("Riches", "Fortune")
Now, it adds a “Changing” which is an array of what to change and what to change it to so Riches, will turn into “Fortune”. But, this won’t suddenly create a whole entire string and print it / do what you need it to do yet.
Part 2 - Replace()
To replace a string, you want to use the function Replace which will return the changed string, let’s try it!
local ezReplace = require(game.ReplicatedStorage.EzReplace)
ezReplace.AddNewChanging("Riches", "Fortune")
local Replaced = ezReplace:Replace("Riches favours the bold.") -- This will turn into the changed sentence.
We can print our output Fortune favours the bold. by doing
local ezReplace = require(game.ReplicatedStorage.EzReplace)
ezReplace.AddNewChanging("Riches", "Fortune")
print(ezReplace:Replace("Riches favours the bold."))
Expected output
"Fortune favours the bold"
Part 3 - PrintChangings()
This will print everything which changes, we have our changing, where Riches turns into Fortune. So in the output it would print: “Riches → Fortune” and it will continue depending on how many changings you have created. Have fun with it!
Resource
Outroduction
If you have any questions, feedback or need support with EzReplace, PM me! Please do not reply to the actual page instead of PMing me, as I prefer to keep the page clean.