A code editor from zero: VS Code and Cursor

Learn VS Code from zero for Roblox development: open a folder, search, use the integrated terminal, install the Luau Language Server, read Problems, and compare Cursor.

Tool lesson, about 35 minutes, 14 steps

By the end you can

  • Install VS Code, open a folder, and find any file or line with Quick Open and search.
  • Use the integrated terminal, install an extension, and read the Problems panel.
  • Install the Luau Language Server and compare VS Code with Cursor and Studio's script editor.

Before this: Your computer: requirements, files, folders and paths, The terminal from zero (PowerShell and macOS Terminal)

1Why not just Notepad?

Here is part of Beacon Yard's Config.luau, the file that owns every gameplay number:

local Config = {
	ROUND_SECONDS = 40,
	COOLDOWN_SECONDS = 8,
	COIN_VALUE = 5,
	COIN_RESPAWN_SECONDS = 4,
	SURVIVAL_BONUS = 10,
	DRONE_SPEED = 12,
	DRONE_DAMAGE = 15,
	DRONE_HIT_COOLDOWN = 1,
	DRONE_MAX_HEALTH = 100,
	WRENCH_DAMAGE = 34,
	WRENCH_RANGE = 14,
	STUN_SECONDS = 1.6,
	WALK_SPEED = 16,
Figure 1.1

You could edit that in Notepad or TextEdit. A code editorCode editorA text editor for code: it colours syntax, numbers lines, searches whole folders and flags mistakes.Think of it as your bench in the workshop, with the project laid out on it. earns its place by doing four things a plain text editor cannot: it colours the code so you can read its structure, numbers every line so an error's line number means something, finds any name across hundreds of files in a second, and warns you about mistakes before you press Play.

Roblox Studio has its own Script Editor, and it is good for quick changes inside a place 1. Beacon Yard's code, though, lives as ordinary files in a folder, so that Git can track it and a tool called Rojo can copy it into Studio. Those files need an editor that works on folders. This course uses VS Code.

Why does this course edit Beacon Yard's code in VS Code rather than only in Studio's Script Editor?

  1. Studio's editor cannot edit Luau
  2. The code lives as files in a folder, tracked by Git and synced into Studio by Rojo, so it needs a folder-based editor
  3. VS Code runs the game faster
  4. Studio charges for its editor
Answer

The code lives as files in a folder, tracked by Git and synced into Studio by Rojo, so it needs a folder-based editor. Studio's editor is fine for scripts inside a place. Beacon Yard keeps its source as files, which Git tracks and Rojo syncs into Studio.

Open this step in lesson mode · Link to this step · This confused me

2Install VS Code

VS Code is free, under 200 MB to download and under 500 MB on disk, and it supports current Windows and recent macOS versions 2.

Windows. Download the User Installer from code.visualstudio.com and run it. On the Select Additional Tasks page, keep Add to PATH ticked; also tick both Add "Open with Code" action boxes, so you can right-click any folder and open it.

macOS. Download the macOS build from code.visualstudio.com, open the downloaded file, and drag Visual Studio Code into Applications. Then open VS Code, press Command + Shift + P, type shell command and choose Shell Command: Install 'code' and optionally 'copilot' commands in PATH (older versions call it Install 'code' command in PATH). Close the terminal window you were using and open a new one afterwards, so it picks up the change.

Build along

m00-baseplate

  1. Open a new terminal (PATH changed, remember) and run code --version.

    You should see A new terminal prints a version number (1.x.y), then a commit id and your processor type.

Open this step in lesson mode · Link to this step · This confused me

3Your bench in the workshop

Both sidesA code editor is your bench in the workshop, with one project laid out.
In the pictureIn Roblox
The opened folderThe project you are working on
The parts trayThe Explorer, listing every file
Parts in your handsOpen tabs
Tools in the drawersExtensions
The inspector's notesThe Problems panel
The tool counter built into the benchThe integrated terminal

See the whole analogy cast

Think of VS Code as your bench in the yard's workshop. When you open a folder, you clear the bench and lay out one project. Everything you do afterwards applies to that project: search looks only inside it, and the terminal starts in it.

  • The Explorer on the left is the parts tray: every file and folder in the project.
  • Tabs along the top are the parts in your hands right now.
  • Extensions are tools you add to the drawers.
  • The Problems panel is where the inspector pins notes about mistakes.
  • The integrated terminal is the tool counter from the last lesson, built into the bench.

Think of it as Your bench in the workshop, with one project laid out

Always open the project folder, not a single file. A single file on its own is a part with no bench: search, the terminal and the Luau checks all work less well.

You want to work on Beacon Yard. What should you open in VS Code?

  1. Just Config.luau
  2. The beacon-yard folder
  3. Your whole home folder
  4. The Roblox Studio app folder
Answer

The beacon-yard folder. Open the project folder. A single file loses project-wide search and checks, and your whole home folder makes every search crawl through thousands of unrelated files.

Open this step in lesson mode · Link to this step · This confused me

4Open a folder and make a file

You will get the real Beacon Yard code in the GitHub lesson. For now, make a practice copy of its config file.

Figure 4.1.

Opening the practice folder with code ., creating Config.luau and saving it. The transcript below lists every action.

Transcript
  1. 0:00 Open the folder from a terminal: code .
  2. 0:03 VS Code asks: do you trust the authors?
  3. 0:06 Your own folder, so answer Yes.
  4. 0:10 New File in the Explorer: Config.luau.
  5. 0:14 The dot on the tab means not saved.
  6. 0:17 Ctrl+S saves. The dot goes.

Build along

m00-baseplate

  • Code/practice/Config.luau
  1. Open a terminal in Code/practice (make the folder if the terminal challenge did not) and run code ., which opens the current folder in VS Code. When VS Code asks whether you trust the authors, choose Yes: it is your own folder.

    You should see VS Code's title bar and Explorer both show practice.

  2. Click New File in the Explorer, name it Config.luau, paste the code below, and save with Ctrl + S (Windows) or Command + S (macOS).

    You should see The Explorer lists Config.luau, the tab shows the code, and there is no dot on the tab after saving.

luau
local Config = {
	ROUND_SECONDS = 40,
	COOLDOWN_SECONDS = 8,
	COIN_VALUE = 5,
	COIN_RESPAWN_SECONDS = 4,
	WRENCH_DAMAGE = 34,
	WRENCH_RANGE = 14,
	WALK_SPEED = 16,
}
 
return Config

Open this step in lesson mode · Link to this step · This confused me

5Find anything: Quick Open, search, the Command Palette

Three shortcuts cover nearly every "where is it?" moment. On macOS, use Command wherever Windows uses Ctrl 3.

ShortcutOpensUse it to
Ctrl + PQuick Openjump to a file by typing part of its name
Ctrl + Shift + FSearchfind a word in every file of the folder
Ctrl + Shift + PCommand Paletterun any VS Code command by name
Ctrl + FFindfind a word in the current file only

The Command Palette is the one to remember. If you forget a shortcut or a menu, press Ctrl + Shift + P and type what you want, such as format or terminal.

VS Code
VS Code with the Search view open, searching COIN_VALUE, showing one result in Config.luau

Select a numbered pin, or a row below, to read what it marks.

Figure 5.1.

Ctrl+Shift+F searches every file in the folder.

Build along

m00-baseplate

  1. Press Ctrl + Shift + F, search for COIN_VALUE, and click the result.

    You should see The Search view lists Config.luau with the line COIN_VALUE = 5; clicking it puts the cursor on that line.

Open this step in lesson mode · Link to this step · This confused me

6The terminal inside the editor

Press **Ctrl + ** (the backtick key, usually left of 1) to open the <Term id="integrated-terminal">integrated terminal</Term>. On macOS the shortcut is also Control + . It is the same PowerShell or zsh you used in the last lesson, already standing in your project folder 4.

That last part saves a lot of cd. Whatever folder you opened is where the terminal starts. Later lessons run rojo serve and git from exactly here.

Build along

m00-baseplate

  1. Open the integrated terminal and run cat Config.luau.

    You should see The terminal's prompt ends in practice, and cat prints the Config table.

Open this step in lesson mode · Link to this step · This confused me

7Extensions: tools in the drawers

Good place for a break. Your answers and progress are saved in this browser, so you can stop here and come back to this step. Tick what you can do now; if something is shaky, go back one step first.

Checkpoint

  • VS Code is installed and I can open a project folder
  • I can find a file with Ctrl + P and a word with Ctrl + Shift + F
  • I can open the integrated terminal and see which folder it starts in

VS Code does a lot on its own, and extensionsVS Code extensionAn add-on that gives VS Code a new language, tool or theme.Think of it as a tool added to the drawers of your bench. add the rest: support for languages, linters, themes. Open the Extensions view with Ctrl + Shift + X 5.

An extension is a program that runs with your permissions, so install with care:

  • Check the publisher and the install count, and look for a link to the source code.
  • Install only what you need. This course will name every extension it uses.

The first one is the Luau Language Server by JohnnyMorganz, extension id JohnnyMorganz.luau-lsp 6. It is open source and is the standard Luau extension in the Roblox community 7.

Both sidesRemember: A code editor is your bench in the workshop, with one project laid out.

VS Code
VS Code Extensions view with luau-lsp searched and the Luau Language Server by JohnnyMorganz selected, showing its Install button

Select a numbered pin, or a row below, to read what it marks.

Figure 7.1.

Check the publisher before you install.

Build along

m00-baseplate

  1. Search the Extensions view for luau-lsp, check that the publisher is JohnnyMorganz, and click Install.

    You should see The extension page shows Uninstall and Disable instead of Install, and the status bar briefly shows the language server starting when you open Config.luau.

Open this step in lesson mode · Link to this step · This confused me

8The Problems panel

Now make a mistake on purpose. In Config.luau, delete the comma after COIN_VALUE = 5. A red squiggle appears under the next line almost at once.

Open the Problems panel with Ctrl + Shift + M. It lists every error and warning in your open files, with the file name and line number. Click an entry to jump straight to it. For the missing comma, the Luau Language Server reports:

text
Expected ',' after table constructor element

That error points at line 5, COIN_RESPAWN_SECONDS = 4,, rather than line 4 where the comma is missing. The parser only realised something was missing when the next item began. Errors often point just after the real mistake, and the errors lesson comes back to this.

VS Code
VS Code with a red squiggle in Config.luau and the Problems panel listing the missing-comma error

Select a numbered pin, or a row below, to read what it marks.

Figure 8.1.

The error names line 5. The missing comma is at the end of line 4.

Problems says: Expected ',' after table constructor element, on the COIN_RESPAWN_SECONDS line. Fix the code.

local Config = {
	COIN_VALUE = 5
	COIN_RESPAWN_SECONDS = 4,
}
print(Config.COIN_VALUE)
Answer

Line 2: COIN_VALUE = 5. Fixed: COIN_VALUE = 5,. The missing comma is at the end of the line before the one the error names. Put it back and the file parses again.

Open this step in lesson mode · Link to this step · This confused me

9What the Luau Language Server gives you

With the extension installed, VS Code understands Luau and Roblox:

  • Autocomplete. Type game:Get and it suggests GetService.
  • Hover documentation. Point at a Roblox API name to read its docs without leaving the editor. The latest Roblox type definitions are loaded by default 7.
  • Errors before Play. Syntax errors, unknown names, and (in files that turn on stricter checking, which module 2 teaches) mismatches such as adding text to a number, all in the Problems panel.

One piece is missing for now. The extension does not know which Roblox objects your place contains until a tool called Rojo describes the project to it. That arrives in the setup lesson, along with the companion settings. Until then, plain Luau files work fully and Roblox-specific paths are partly checked.

What does the Luau Language Server add to VS Code?

  1. Autocomplete for Luau and Roblox APIs
  2. Documentation on hover
  3. Errors in the Problems panel before you press Play
  4. It runs your game inside VS Code
  5. It uploads your code to Roblox
Answer

Autocomplete for Luau and Roblox APIs; Documentation on hover; Errors in the Problems panel before you press Play. It is a language server: it reads your code and reports on it. Running the game happens in Studio, and getting code into Studio is Rojo's job.

Open this step in lesson mode · Link to this step · This confused me

10Where the bench idea breaks

On a real workbench, once you have filed a part down, it is filed. Anyone who picks it up gets the new shape.

In an editor, your changes live in the editor's memory until you save. The file on disk, which Git, Rojo and Studio all read, keeps its old contents. A tab with unsaved changes shows a dot instead of a close button, and the Explorer shows a count of unsaved files.

You can make the dot a non-issue. Open the File menu and click Auto Save; a tick appears next to it, and VS Code now saves a file shortly after you stop typing.

Build along

m00-baseplate

  1. Turn on File, Auto Save, then edit any file and watch the dot.

    You should see The File menu shows a tick next to Auto Save, and a file you edit loses its unsaved dot a moment after you stop typing.

Where does it break?“Your bench in the workshop, with one project laid out” is a good picture of a code editor. Where does it stop being true?

It breaks here. Work on a real bench is real at once, but in the editor nothing reaches the disk, or the game, until you save.

The true model. The editor holds an in-memory buffer for each open file. Saving writes the buffer to the file on disk, which is the only copy that Git, Rojo and Studio can see.

You change COIN_VALUE to 10 in VS Code. The tab shows a dot. Rojo is syncing and you press Play. How much does a coin pay?

  1. 10, because you changed it
  2. 5, because the change is not saved, so the file on disk still says 5
  3. 0, because the file is broken
  4. It depends on Rojo's mood
Answer

5, because the change is not saved, so the file on disk still says 5. Rojo copies the file on disk into Studio, and the disk still says 5. Save first. To make this automatic, turn on File, Auto Save.

Open this step in lesson mode · Link to this step · This confused me

11Settings Sync

Once you have VS Code the way you like it, Settings Sync keeps your settings, keyboard shortcuts and extensions the same on every computer you use. Turn it on from the Accounts menu (the person icon at the bottom of the Activity Bar) with Backup and Sync Settings, and sign in with a GitHub or Microsoft account 8.

It is optional, and handy if you switch between a school computer and a home one. Settings Sync never syncs your project files. Those travel through Git and GitHub, in the next two lessons.

Build along

m00-baseplate

  1. Optional: turn on Settings Sync with your GitHub account.

    You should see The Accounts menu shows Settings Sync is On, or you have decided to skip it for now.

Open this step in lesson mode · Link to this step · This confused me

12Cursor and other editors

VS Code is not the only choice. Here are the common ones, honestly compared.

Which editor?

OptionWhat it isWhen pros pick itTrade-offs
VS CodeA free editor from Microsoft, and the one this course shows in every screenshot (the course default).Most Roblox teams that keep game code in files and sync it with Rojo; the Luau Language Server is built for it first.Extensions run with your permissions, so install only what you need.
CursorAn AI-native editor built on VS Code's open-source base, so it looks and works almost the same. It imports your VS Code extensions, themes and settings in one click.You already use it, or you want AI help inside the editor. Everything in this course works in it.The free plan has limited AI usage. Its extensions come from the Open VSX registry, where the Luau Language Server is also published. Use its AI as a tutor that explains, not one that writes your work.
Studio's Script EditorThe editor built into Roblox Studio.Small edits to scripts that live only inside a place.Changes made there never reach the files Git tracks, so in Beacon Yard you edit files instead.
Other editors (Neovim, Zed, JetBrains)Editors that speak the language server protocol, so the Luau Language Server can run in them.Only if you already use one and like it.This course will not cover their setup; the language server's repository links a guide for editor clients.

Sources: 9 10 11 7

You already use Cursor. What do you need to change to follow this course?

  1. Switch to VS Code; Cursor cannot run luau-lsp
  2. Nothing important: install the Luau Language Server from Cursor's extension view and map the VS Code shortcuts as you go
  3. Install VS Code alongside and edit in both
  4. Use only Studio's Script Editor
Answer

Nothing important: install the Luau Language Server from Cursor's extension view and map the VS Code shortcuts as you go. Cursor is built on VS Code's base and its extension registry carries luau-lsp. Shortcuts and menus are almost the same.

Open this step in lesson mode · Link to this step · This confused me

13Challenge: find and change

Level 1, Apprentice

Challenge

Find a value in the practice project the way a developer does, change it, and check your work three ways.

Start from
VS Code with Code/practice open and Config.luau saved.

Done means

  • Using Search (not scrolling), you found WRENCH_RANGE and changed it from 14 to 16.
  • The tab shows no dot: the change is saved.
  • In the integrated terminal, cat Config.luau shows WRENCH_RANGE = 16.
  • The Problems panel shows zero errors.

Hints

  1. Ctrl + Shift + F, or Command + Shift + F on macOS, opens Search.
  2. If Problems shows an error, check the commas at the ends of lines.

Open this step in lesson mode · Link to this step · This confused me

14Recap

Retiring the analogy

You no longer need “your bench in the workshop, with one project laid out”. The editor holds an in-memory buffer for each open file. Saving writes the buffer to the file on disk, which is the only copy that Git, Rojo and Studio can see.

Recap

  1. Open the project folder, not a file. Ctrl + P finds files, Ctrl + Shift + F searches every file, and Ctrl + Shift + P runs any command.
  2. The integrated terminal (Ctrl + `) starts in your project. Extensions run with your permissions; the Luau Language Server adds autocomplete, hover docs and errors in the Problems panel.
  3. Nothing reaches the disk, Git or Studio until you save: a dot on the tab means unsaved. Cursor works the same way, with the same extension.

A code editor is your bench in the workshop, with one project laid out, until work on a real bench is real at once, but in the editor nothing reaches the disk, or the game, until you save.

Next Git from zero: commits, diffs, branches, undo

Open this step in lesson mode · Link to this step · This confused me