CodeReplacer: Replacing terms in all scripts

Hi guys! I am new to scripting and the devforum. This is my first release on here. So please give me constructive feedback. Thank you.

What is CodeReplacer?

CodeReplacer is a plugin that allows you to mass-replace instances of code.

Say you want to replace something like “123” with “321” in 30 scripts. This plugin can help.

What can this be used for?

-Mass-Replacing the same error on all your scripts.
-Mass-Replacing outdated info.
-Mass-Replacing IDs in opensourced games to your IDs.
Etc.

I hope you can find some use for this! :slight_smile:

So what are you waiting for? Get it today! Its FREE!

https://www.roblox.com/library/4656829453/CodeReplacer

36 Likes

Apparently this functionality would be done by default in studio with CTRL + SHIFT + H.


But it didn’t work at the time i’m writing this, however CTRL + SHIFT + F worked.

29 Likes

You just simplified almost every programmers’ life in one plugin :heart:

6 Likes

Is this auto set to match case and does it only change terms that are exactly inputted in?

I don’t think I’m being clear, but what I mean is that if I am replacing Warfare with Battle and I have

local Warfare
local WarfareConcept
local warfare

Will all of those be changed or just the first one which exactly matches case and is exactly what is inputted in rather than getting

local Battle
local BattleConcept
local Battle

All of them If I am understanding you correctly.

An approach to prevent replacing error messages and IDs (essentially addresses, like rbxassetid://) is to put all of your strings on a module, or a LocalizationTable and then refer to them by an error id or asset name.

I don’t see a functionality or use for this. I like to keep 1 local script and 1 module for the client and 1 script and 1 module for the server and I doubt anyone uses a crazy amount of scripts like 30 as you showed as an example (Not to mention that variables exist). This is also a feature in Roblox Studio, it is the replacement tool. I doubt there will be so much information to change to the point where you will need it. I don’t remember ever using it for as long as I remember developing. If anyone has hundreds of terms that they have to replace in hundreds of scripts in a daily basis then this is the module for them, but certainly not the case for most of the developers. I hope you create something more creative and useful in the future. Also a better UI design would make the use of the module easier, although it is totally understandable if you are not good at designing UIs. If I found a UI useful, the UI design wouldn’t be a problem to me.

Yeah, Sorry this was my first UI.

2 Likes

I think this is a great plugin for beginners to programming that might have a lot of code smell where they repeat the same functions instead of creating one function that’s reusable. I think we’ve all been at that point where we didn’t even see how we could possibly go about that. (I was like that only a few month ago and started to get the hang of not making your code so smelly). Also, for a first UI I think it’s pretty good however I would suggest porting it into a plugin panel. (getting a little off track here) This is a lot better than I could’ve done when I created my first plugin. All in all it has a good use however, I would suggest fixing your code smells therfore you don’t need to even use a plugin like this in the first place.

I was messing the code of the plugin a bit, and i found a deprecated line:
local plug = PluginManager():CreatePlugin();

PluginManager() is deprecated.

1 Like

I have decided I will no longer update this. If it breaks I may update it but I doubt it. :frowning:

1 Like

:slightly_frowning_face:
I just came across it not and it seems so useful!

It still works.

30 chars…

It still works, thank you so much!

I noticed that this will not replace anything if I have parenthesis anywhere in the text. (either that or it stops working after a certain amount of characters)

Besides that, it still works. Thanks so much for this useful plugin!

Select all scripts you need to replace terms in and run this in the commandbar

local termToReplace = "house"
local replaceWith = "House"

for _, s in ipairs(game.Selection:Get()) do
	s.Source = s.Source:gsub(termToReplace, replaceWith)
end

It’ll work for quotes and whatnot.

6 Likes

That isn’t working. It says it executes it but nothing was replaced.

Then you perhaps didn’t use it right; it’s valid lua.

One source of undesirable output could be that you didn’t have any occurrences to match, another that you tried executing it in a script object with insufficient permissions.

Thank you! This was an absolute lifesaver! If I didn’t find this, I would’ve just replaced 22 script-lines with what I wanted to, one by one. So yes, thank you very much :grin:

You need to put a percent sign (%) before every parenthesis. You shouldn’t need to do it with the replacement. Exeample:

The code you want to replace:

:Remove()

Your input:

:Remove%(%)