"Run" and "Refresh" scripts from context menu

Running and testing Module scripts often involves using the command bar. It gets old typing / copy-pasting a long [size=2]Module = require(parent.child.child … .child.module)[/size] all the time, especially if you need to require multiple Modules or are using the command bar for something else at the same time.

Right-clicking a Module (or server script when not in Play Solo or Run modes) and selecting “Run” from the context menu would run that Module exactly as if it were just required, except that there’s no script which actually receives the return (or maybe a new global variable would be created, such as [size=2]ModReturn#[/size], with “#” being the number of Modules ran in this way).

On the same note, if said script errors, you have to cut and paste the script to get the new code to run when it’s required / ran. Right-clicking the script and selecting “Refresh” would have the same effect as cut-pasting in this regard.

Other than the [size=2]ModReturn#[/size] variable perhaps being a little clumsy, I think this would help the work flow when testing code greatly. Also, I sometimes run scripts while building to count the number of instances in the workspace, and it would be much faster running those scripts with the context menu rather than [size=2]Tools > Execute Script[/size] or copy-pasting the code into the command bar.

1 Like

Make sure your module is selected in the explorer…

local ObjectSelected = game.Selection:Get()[1]

or

local Module = require(game.Selection:Get()[1])

[quote] Make sure your module is selected in the explorer…

local ObjectSelected = game.Selection:Get()[1]

or

local Module = require(game.Selection:Get()[1]) [/quote]

Hmm…I forgot you can detect selections in Studio. I think I’ll make my own plugin for this :stuck_out_tongue:

I’d still love to have this as an official supported feature, though.