Paste Path - Stop writing long Instance paths in your code

This is a simple plugin that adds two keyboard shortcuts to Studio to paste Instance paths into your code so you don’t have to write them manually. While editing a script, select any Instance in the Explorer, press the shortcut, and the path to the Instance will paste at your cursor’s position. It will also print the path in the console for use even when the script editor is not open. This means that instead of writing game:GetService("ReplicatedStorage").Remotes.AddMoney:FireServer(math.huge), you could just click on AddMoney and type Ctrl + P :FireServer(math.huge) and the plugin will convert that to the former automatically.

To use this plugin, first install it from the link below, then go to File > Advanced > Customize Shortcuts... and search for the following two shortcuts:

Paste Path (Recommended Ctrl + P) - Pastes the path as described above. Automatically uses the script global instead of the game global based on the relation of the script to the Instance you are pasting. (Specifically, if they have a common ancestor that isn’t a service or the DataModel, it will use script). If any Instance in the path can’t easily be differentiated from one of its siblings (if they have the same Name), the shortcut will parent a new ObjectValue to the script and use it to reference the Instance instead.

Paste Raw Path (Recommended Ctrl + Alt + P) - Pastes the path as described above, but always starts from the game variable, even if the resulting path is not scriptable due to, for example, two Instances with the same Parent sharing the same Name.

Download: https://create.roblox.com/store/asset/103856609831478/Paste-Path

The plugin has several other failsafes to ensure that it can always create a valid path: if an Instance Name has characters other than letters and numbers it will switch from dot indexing to bracket indexing, in which case it automatically escapes said strings for backslashes, quotes, control characters, and invalid utf8 characters. It can even use FindFirstChildOfClass if an Instance of one class and a sibling of another share the same name. Additionally, it is programmed to use game:GetService when indexing a service, and the workspace global when indexing Workspace

A shortcut used outside of the script editor will paste the path to the output console so you can copy it and paste it elsewhere.

If you find any bugs, let me know in the replies.

4 Likes

This is so simple but useful, good job