Find/Change mechanism for scripting work

As a Roblox Developer, it is currently time consuming to, for example, have a script in place that references specific parts or objects; when wanting to rename said parts or objects, you would have to rename all of the references of said items inside it’s child script.

If Roblox we’re to implement a “Find/Change” system, it would be easier to do a “Find All (x)” and then be able to replace all the found instances to a different value. I think that the system could also go a little deeper and be able to specify things like case-sensitive, whether or not there is space on either side of the values found and etc. I think that in some cases this could be a very useful feature.

5 Likes

What you’re requesting is known as refactoring. It would be very interesting to see a tool for this in Roblox Studio.

3 Likes

Yeah I think that might be more along the lines of what I’m thinking. It might be too in-depth, but something like the InDesign GREP finding tool I think would be an interesting addition, for example…

04 AM

AFAIK Ctrl + Shift + F works as a Find All but no replace I know of.
However this seems like a case that could be resolved differently.
If you’re indexing many parts for references, have you thought of using tables and looping?

1 Like

We already have a find/change system in roblox studio, however it you can’t replace all words in every script at once.

These can be found in the script menu that opens when a script is focused on screen

Find all cases a word is used

Find will open up a menu for the current script, while find all will search every script in the game
image
With find you can toggle “Match case” “Match whole word” and “Regular expression”
image
With find all you’ll also have these options and have the option to look in either the current script, or in all scripts
image

Replace them with another word

Replace can be found right next to find
image
You have the same options as find, but you can choose to replace all, or replace the next instance of the word in the current script
image

I would love to see refactoring added. Visual Studio already has it, so having it in ROBLOX Studio would decrease scripting time by 30%.

Refactoring is a good idea, but I don’t think it’s something we need at the top of the priority list, as nice as it would be to have it.

CTRL + H in script find and replace and there’s a button you can enable or disable to replace all. :slight_smile:

A feature that checks everything in all scripts would be cool tho.

Well, @SummerEquinox @Reshiram110, Visual Studio has it because the languages it uses are quite often the “type safe” and “strongly typed” to the point where it doesn’t need to make any assumptions. Renaming a class within a variable within a C# program is much different from Lua. Lua makes a lot of assumptions and therefore wouldn’t be prime to do these things.

Example:

  • Renaming a “class” (oop implementation) in Lua which is defined in a module and expecting it being renamed in all scripts which make use of it

Simply not possible due to the fact that you cannot assume the game environment will remain static once the game has begun.
The module could be switched out for a completely different module, or even a metamethod could take into effect instead of an actual function which could go wrong also.

TL;DR if it is ever implemented it would be buggy at best and broken in most use cases.

1 Like