Rogen

Using roblox-ts

Compile with roblox-ts while Rogen routes your TypeScript files

Updated

roblox-ts compiles the TypeScript in src to Luau in out. Rogen routes by the files in src, and Rojo syncs the compiled files in out.

Start a Project

Start a new project with the command below. In a folder that already has a tsconfig.json, a bare rogen init sets Rogen up beside it instead.

rogen init --language roblox-ts

Compile and Serve

rbxtsc reads the project file, so on a fresh clone run rogen write before the first compile. After that, run each command in its own terminal:

npm run watch
rogen serve

Add a Feature

The routes that init writes for roblox-ts are lowercase. Code imports by relative file path, as in any TypeScript project:

my-game
MY-GAME
  • src
  • inventory
  • client
  • inventory-hud.client.ts
  • server
  • inventory-service.ts
  • shared
  • inventory-types.ts
Explorer
  • ReplicatedStorage
  • shared
  • inventory
  • inventory-types
  • ServerScriptService
  • inventory
  • inventory-service
  • StarterPlayer
  • StarterPlayerScripts
  • inventory
  • inventory-hud

Packages

Packages in @rbxts reach the game by themselves. Another scope, such as @rbxts-js for React, needs a mount of its own, and with pnpm the scopes must be hoisted side by side, such as with publicHoistPattern: ["@rbxts*"] in pnpm-workspace.yaml:

default.rogen.json
"node_modules": {
	"$className": "Folder",
	"@rbxts": { "$path": "node_modules/@rbxts" },
	"@rbxts-js": { "$path": "node_modules/@rbxts-js" }
}

On this page