Skip to main content

Setup Guide

Prerequisites
PowerShell

If you're using PowerShell for the first time, you may get an error about "running scripts is disabled on this system". You can fix this by running the following in PowerShell as an administrator:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

More info here

Project Setup

In this guide, we will introduce how to create a roblox-ts game.

Make sure you have an up-to-date version of Node.js installed and your current working directory is an empty folder that you intend to create your project in. Run the following command in your command line:

Terminal
npm init roblox-ts

The tool will guide you through some questions to set up your project:

  1. Project directory - Since you're already in the directory you want to create a project in, just enter a period (.) to select your current directory and press Enter.
  2. Select template - What type of roblox-ts project is this? roblox-ts can be used to build plugins and packages too, but in this case we want to make a game, so press Enter once.
  3. Configure Git - Do you want to use Git for version control? Press Y or N to make your choise.
  4. Configure ESLint - Do you want to use ESLint to check your code for correctness?
  5. Configure Prettier - Do you want to use Prettier to format your code?
  6. Configure VSCode Project Settings - Do you want the tool to create a .vscode folder with settings optimized for roblox-ts development? If you're using VSCode to write code, you should use this.
  7. Multiple package managers detected. Select package manager: - Which package manager do you want to use with this project? roblox-ts works best with npm and support for alternative package managers is not guaranteed. (If you don't have other package managers installed, this step won't appear!)
tip

Many of the tools used here can be directly integrated into VSCode with extensions. We highly recommend the roblox-ts extension to improve your editing experience. The roblox-ts extension not only provides extra diagnostic information, but also lets you build your code with one click.

Then, open your project in your code editor of choice, such as VSCode:

Terminal
code project-name

Running Your Code

roblox-ts has a feature called "watch mode" where it will continuously build your code as you write it. You can start watch mode from the VSCode extension or via the command line:

Terminal
npm run watch

Once roblox-ts is running, you need to start Rojo to start syncing your code into Roblox studio you can do this from the VSCode extension or via the command line:

Terminal
rojo serve

You're all set up, go write some code 🎉