Editing a script inside tool with VS Code

How would you be able to edit a script inside a tool? or create a tool with a script inside it?

If you’re using Rojo + VS Code, then you can use a meta file as an init for the current folder and insert a script into that folder. This will transform the parent directory into a class when it is synced and the scripts inside that directory will be immediate children of the tool.

Your explorer should look like this (besides the colours, those are because I’m working in a repository that has Git enabled on it so it’s showing untracked changes):

image

Init files describe information about the parent directory. You can read more about Rojo Meta Files here for an explanation of what they do. Here’s the content of each script:

init.meta.json

{
    "className": "Tool"
}

foobar.lua

print("foobar")

When synced, it should look like this:

image

If you have other instances inside the tool, then add the ignoreUnknownInstances setting to your meta file so that other instances in the tool are not overwritten.

4 Likes

Thank you, I will start on doing this.

Im really really really sorry to bump this post but I have a question, how do I sync the script? Sorry if this is a stupid question.

Please read the documentation. :slight_smile:

1 Like

Yeah just found out how to. I had to right click on the script in vs code, click on rojo:sync from here, enter the info, then reopen the rojo port. Thanks for the help anyways :smile: